Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
core\locale Class Reference

Helper utility to interact with Locales. More...

Static Public Member Functions

static get_locale (int $category=LC_ALL)
 Get the current locale.
 
static set_locale (int $category=LC_ALL, string $locale='0')
 Wrap for the native PHP function setlocale().
 
static standardise_locale (string $locale)
 Standardise a string-based locale, removing any deprecated locale categories and ordering it.
 

Detailed Description

Helper utility to interact with Locales.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_locale()

static core\locale::get_locale ( int $category = LC_ALL)
static

Get the current locale.

Parameters
int$category
Return values
string|false

◆ set_locale()

static core\locale::set_locale ( int $category = LC_ALL,
string $locale = '0' )
static

Wrap for the native PHP function setlocale().

Parameters
int$categorySpecifying the category of the functions affected by the locale setting.
string$localeE.g.: en_AU.utf8, en_GB.utf8, es_ES.utf8, fr_FR.utf8, de_DE.utf8.
Return values
string|falseReturns the new current locale, or FALSE on error.

◆ standardise_locale()

static core\locale::standardise_locale ( string $locale)
static

Standardise a string-based locale, removing any deprecated locale categories and ordering it.

Parameters
string$locale
Return values
string

The documentation for this class was generated from the following file: