Break up $wgDummyLanguageCodes
$wgDummyLanguageCodes is a set and mapping of different language codes:
* Renamed language codes: ['als' => 'gsw', 'bat-smg' => 'sgs',
'be-xold' => 'be-tarask', 'fiu-vro' => 'vro',
'roa-rup' => 'rup', 'zh-classical' => 'lzh',
'zh-min-nan' => 'nan', 'zh-yue' => 'yue'].
The old language codes are deprecated because they are invalid but
should be supported for compatibility reasons for a while.
* Language codes of macro languages, which get mapped to the main
language: ['bh' => 'bho', 'no' => 'nb'].
* Language variants which get mapped to main language:
['simple' => 'en'].
* Internal language codes of the private-use-area which get mapped to
itself: ['qqq' => 'qqq', 'qqx' => 'qqx']
This is a very strange conglomeration which should get differentiated,
and were split up in the following ways:
* Renamed language codes are available from
LanguageCode::getDeprecatedCodeMapping().
* Language codes of macro languages and the variants that are mapped to
the main language are available as $wgExtraLanguageCodes and are set
in DefaultSettings.php.
* Internal language codes are set in $wgDummyLanguageCodes in Setup.php.
Change-Id: If73c74ee87d8235381449cab7dcd9f46b0f23590
2017-01-12 14:17:41 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Methods for dealing with language codes.
|
|
|
|
|
* @todo Move some of the code-related static methods out of Language into this class
|
|
|
|
|
*
|
|
|
|
|
* @since 1.29
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
*/
|
|
|
|
|
class LanguageCode {
|
2017-06-27 14:25:01 +00:00
|
|
|
/**
|
|
|
|
|
* Mapping of deprecated language codes that were used in previous
|
|
|
|
|
* versions of MediaWiki to up-to-date, current language codes.
|
|
|
|
|
*
|
|
|
|
|
* @var array Mapping from language code to language code
|
|
|
|
|
*
|
|
|
|
|
* @since 1.30
|
|
|
|
|
*/
|
|
|
|
|
private static $deprecatedLanguageCodeMapping = [
|
|
|
|
|
// Note that als is actually a valid ISO 639 code (Tosk Albanian), but it
|
|
|
|
|
// was previously used in MediaWiki for Alsatian, which comes under gsw
|
|
|
|
|
'als' => 'gsw',
|
|
|
|
|
'bat-smg' => 'sgs',
|
|
|
|
|
'be-x-old' => 'be-tarask',
|
|
|
|
|
'fiu-vro' => 'vro',
|
|
|
|
|
'roa-rup' => 'rup',
|
|
|
|
|
'zh-classical' => 'lzh',
|
|
|
|
|
'zh-min-nan' => 'nan',
|
|
|
|
|
'zh-yue' => 'yue',
|
|
|
|
|
];
|
|
|
|
|
|
Break up $wgDummyLanguageCodes
$wgDummyLanguageCodes is a set and mapping of different language codes:
* Renamed language codes: ['als' => 'gsw', 'bat-smg' => 'sgs',
'be-xold' => 'be-tarask', 'fiu-vro' => 'vro',
'roa-rup' => 'rup', 'zh-classical' => 'lzh',
'zh-min-nan' => 'nan', 'zh-yue' => 'yue'].
The old language codes are deprecated because they are invalid but
should be supported for compatibility reasons for a while.
* Language codes of macro languages, which get mapped to the main
language: ['bh' => 'bho', 'no' => 'nb'].
* Language variants which get mapped to main language:
['simple' => 'en'].
* Internal language codes of the private-use-area which get mapped to
itself: ['qqq' => 'qqq', 'qqx' => 'qqx']
This is a very strange conglomeration which should get differentiated,
and were split up in the following ways:
* Renamed language codes are available from
LanguageCode::getDeprecatedCodeMapping().
* Language codes of macro languages and the variants that are mapped to
the main language are available as $wgExtraLanguageCodes and are set
in DefaultSettings.php.
* Internal language codes are set in $wgDummyLanguageCodes in Setup.php.
Change-Id: If73c74ee87d8235381449cab7dcd9f46b0f23590
2017-01-12 14:17:41 +00:00
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* @return string[]
|
2017-06-27 14:25:01 +00:00
|
|
|
*
|
|
|
|
|
* @since 1.29
|
Break up $wgDummyLanguageCodes
$wgDummyLanguageCodes is a set and mapping of different language codes:
* Renamed language codes: ['als' => 'gsw', 'bat-smg' => 'sgs',
'be-xold' => 'be-tarask', 'fiu-vro' => 'vro',
'roa-rup' => 'rup', 'zh-classical' => 'lzh',
'zh-min-nan' => 'nan', 'zh-yue' => 'yue'].
The old language codes are deprecated because they are invalid but
should be supported for compatibility reasons for a while.
* Language codes of macro languages, which get mapped to the main
language: ['bh' => 'bho', 'no' => 'nb'].
* Language variants which get mapped to main language:
['simple' => 'en'].
* Internal language codes of the private-use-area which get mapped to
itself: ['qqq' => 'qqq', 'qqx' => 'qqx']
This is a very strange conglomeration which should get differentiated,
and were split up in the following ways:
* Renamed language codes are available from
LanguageCode::getDeprecatedCodeMapping().
* Language codes of macro languages and the variants that are mapped to
the main language are available as $wgExtraLanguageCodes and are set
in DefaultSettings.php.
* Internal language codes are set in $wgDummyLanguageCodes in Setup.php.
Change-Id: If73c74ee87d8235381449cab7dcd9f46b0f23590
2017-01-12 14:17:41 +00:00
|
|
|
*/
|
|
|
|
|
public static function getDeprecatedCodeMapping() {
|
2017-06-27 14:25:01 +00:00
|
|
|
return self::$deprecatedLanguageCodeMapping;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Replace deprecated language codes that were used in previous
|
|
|
|
|
* versions of MediaWiki to up-to-date, current language codes.
|
|
|
|
|
* Other values will returned unchanged.
|
|
|
|
|
*
|
|
|
|
|
* @param string $code Old language code
|
|
|
|
|
* @return string New language code
|
|
|
|
|
*
|
|
|
|
|
* @since 1.30
|
|
|
|
|
*/
|
|
|
|
|
public static function replaceDeprecatedCodes( $code ) {
|
|
|
|
|
if ( isset( self::$deprecatedLanguageCodeMapping[$code] ) ) {
|
|
|
|
|
return self::$deprecatedLanguageCodeMapping[$code];
|
|
|
|
|
}
|
|
|
|
|
return $code;
|
Break up $wgDummyLanguageCodes
$wgDummyLanguageCodes is a set and mapping of different language codes:
* Renamed language codes: ['als' => 'gsw', 'bat-smg' => 'sgs',
'be-xold' => 'be-tarask', 'fiu-vro' => 'vro',
'roa-rup' => 'rup', 'zh-classical' => 'lzh',
'zh-min-nan' => 'nan', 'zh-yue' => 'yue'].
The old language codes are deprecated because they are invalid but
should be supported for compatibility reasons for a while.
* Language codes of macro languages, which get mapped to the main
language: ['bh' => 'bho', 'no' => 'nb'].
* Language variants which get mapped to main language:
['simple' => 'en'].
* Internal language codes of the private-use-area which get mapped to
itself: ['qqq' => 'qqq', 'qqx' => 'qqx']
This is a very strange conglomeration which should get differentiated,
and were split up in the following ways:
* Renamed language codes are available from
LanguageCode::getDeprecatedCodeMapping().
* Language codes of macro languages and the variants that are mapped to
the main language are available as $wgExtraLanguageCodes and are set
in DefaultSettings.php.
* Internal language codes are set in $wgDummyLanguageCodes in Setup.php.
Change-Id: If73c74ee87d8235381449cab7dcd9f46b0f23590
2017-01-12 14:17:41 +00:00
|
|
|
}
|
|
|
|
|
}
|