MediaWiki REL1_33
|
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. | |
static | getDeprecatedCodeMapping () |
Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes. | |
static | getNonstandardLanguageCodeMapping () |
Returns a mapping of non-standard language codes used by (current and previous version of) MediaWiki, mapped to standard BCP 47 names. | |
static | replaceDeprecatedCodes ( $code) |
Replace deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes. | |
Static Private Attributes | |
static array | $deprecatedLanguageCodeMapping |
Mapping of deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes. | |
static array | $nonstandardLanguageCodeMapping |
Mapping of non-standard language codes used in MediaWiki to standardized BCP 47 codes. | |
|
static |
Get the normalised IETF language tag See unit test for examples.
See mediawiki.language.bcp47 for the JavaScript implementation.
string | $code | The language code. |
Definition at line 179 of file LanguageCode.php.
Referenced by MediaWiki\Preferences\DefaultPreferencesFactory\profilePreferences().
|
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.
Definition at line 128 of file LanguageCode.php.
|
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().
Definition at line 144 of file LanguageCode.php.
|
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.
string | $code | Old language code |
Definition at line 165 of file LanguageCode.php.
References $code.
|
staticprivate |
Mapping of deprecated language codes that were used in previous versions of MediaWiki to up-to-date, current language codes.
These may or may not be valid BCP 47 codes; they are included here because MediaWiki renamed these particular codes at some point.
Mapping from deprecated MediaWiki-internal language code to replacement MediaWiki-internal language code.
Definition at line 42 of file LanguageCode.php.
|
staticprivate |
Mapping of non-standard language codes used in MediaWiki to standardized BCP 47 codes.
These are not deprecated (yet?): IANA may eventually recognize the subtag, in which case the -x-
infix could be removed, or else we could rename the code in MediaWiki, in which case they'd move up to the above mapping of deprecated codes.
As a rule, we preserve all distinctions made by MediaWiki internally. For example, de-formal
becomes de-x-formal
instead of just de
because MediaWiki distinguishes de-formal
from de
(for example, for interface translations). Similarly, BCP 47 indicates that kk-Cyrl
SHOULD not be used because it "typically does not add information", but in our case MediaWiki LanguageConverter distinguishes kk
(render content in a mix of Kurdish variants) from kk-Cyrl
(convert content to be uniformly Cyrillic). As the BCP 47 requirement is a SHOULD not a MUST, kk-Cyrl
is a valid code, although some validators may emit a warning note.
Mapping from nonstandard MediaWiki-internal codes to BCP 47 codes
Definition at line 82 of file LanguageCode.php.