MediaWiki  master
LanguageCode Class Reference

Methods for dealing with language codes. More...

Static Public Member Functions

static bcp47 ( $code)
 Get the normalised IETF language tag See unit test for examples. More...
 
static getDeprecatedCodeMapping ()
 Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes. More...
 
static getNonstandardLanguageCodeMapping ()
 Returns a mapping of non-standard language codes used by (current and previous version of) MediaWiki, mapped to standard BCP 47 names. More...
 
static replaceDeprecatedCodes ( $code)
 Replace deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes. More...
 

Detailed Description

Methods for dealing with language codes.

Since
1.29

Definition at line 28 of file LanguageCode.php.

Member Function Documentation

◆ bcp47()

static LanguageCode::bcp47 (   $code)
static

◆ getDeprecatedCodeMapping()

static LanguageCode::getDeprecatedCodeMapping ( )
static

Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes.

This array is merged into $wgDummyLanguageCodes in Setup.php, along with the fake language codes 'qqq' and 'qqx', which are used internally by MediaWiki's localisation system.

Returns
string[]
Since
1.29

Definition at line 125 of file LanguageCode.php.

Referenced by LanguageConverter\getVarSeparatorPattern().

◆ getNonstandardLanguageCodeMapping()

static LanguageCode::getNonstandardLanguageCodeMapping ( )
static

Returns a mapping of non-standard language codes used by (current and previous version of) MediaWiki, mapped to standard BCP 47 names.

This array is exported to JavaScript to ensure mediawiki.language.bcp47 stays in sync with LanguageCode::bcp47().

Returns
string[]
Since
1.32

Definition at line 141 of file LanguageCode.php.

Referenced by ResourceLoaderLanguageDataModule\getData().

◆ replaceDeprecatedCodes()

static LanguageCode::replaceDeprecatedCodes (   $code)
static

Replace deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes.

Other values will returned unchanged.

Parameters
string$codeOld language code
Returns
string New language code
Since
1.30

Definition at line 162 of file LanguageCode.php.

Referenced by User\loadOptions(), and LanguageConverter\validateVariant().


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