aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/languages/LanguageCodeTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Move LanguageCodeTest from integration to unitAmir Sarabadani2019-07-111-200/+0
| | | | | | 76 more unit tests Change-Id: I68e9ffff30a744ef6b31598e0176e67892defb95
* Ensure LanguageCode::bcp47() returns a valid BCP 47 language codeC. Scott Ananian2018-10-111-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaWiki uses a number of nonstandard codes which do not validate according to the IANA language subtag registry. Some of them have the wrong semantics entirely: MediaWiki's `sr-ec` variant maps to BCP 47 `sr-EC` which is "Serbian as used in Ethiopia" (!). Extend LanguageCode::bcp47() to map our nonstandard codes to valid BCP 47 language codes. Export the mapping so that it can be used in JavaScript's corresponding mw.language.bcp47() implementation as well, and return the standard BCP 47 codes in the siteinfo API. Thanks to TheDJ (I10b4473c7e53f027812bbccf26bb47aec15fddfd) and Fomafix (I93efc190714ba76247d30ba49fc21ae872fc3555) for previous attempts at this! Also removed a fixme for the name of 'Twi', dating back to 2004 (f59c3be23b209e178a917cb14ebedcc243c847b6) -- checking tw.wikipedia.org it certainly appears that the autonym of 'Twi' is correctly 'Twi'. Tracking bugs for invalid language codes are T125073 and T145535. Discussion of zh-XX => zh-HanX-XX mapping is at T198419. This is a replay of an earlier merged patch, 8380f0173e79b66f0e2afd6c49cd88afb9f4f6f3, which had to be reverted because it caused regressions in the Babel extension (T199941). Bug: T34483 Bug: T106367 Bug: T120847 Depends-On: I27a5b8e45b34c6b57c1b612b11548001c88cd483 Change-Id: Iebbc604af21d7f2af9c1f1ab2574cb5f309bf6ed
* Revert "Ensure LanguageCode::bcp47() returns a valid BCP 47 language code"Greg Grossmeier2018-07-231-41/+2
| | | | | | | | | This reverts commit 8380f0173e79b66f0e2afd6c49cd88afb9f4f6f3. Reason for revert: Caused T199941 Bug: T199941 Change-Id: I93af756a2d70d6bc91f828fe6ac19bf10ca8788f
* Ensure LanguageCode::bcp47() returns a valid BCP 47 language codeC. Scott Ananian2018-07-131-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaWiki uses a number of nonstandard codes which do not validate according to the IANA language subtag registry. Some of them have the wrong semantics entirely: MediaWiki's `sr-ec` variant maps to BCP 47 `sr-EC` which is "Serbian as used in Ethiopia" (!). Extend LanguageCode::bcp47() to map our nonstandard codes to valid BCP 47 language codes. Export the mapping so that it can be used in JavaScript's corresponding mw.language.bcp47() implementation as well. Thanks to TheDJ (I10b4473c7e53f027812bbccf26bb47aec15fddfd) and Fomafix (I93efc190714ba76247d30ba49fc21ae872fc3555) for previous attempts at this! Also removed a fixme for the name of 'Twi', dating back to 2004 (f59c3be23b209e178a917cb14ebedcc243c847b6) -- checking tw.wikipedia.org it certainly appears that the autonym of 'Twi' is correctly 'Twi'. Tracking bugs for invalid language codes are T125073 and T145535. Discussion of zh-XX => zh-HanX-XX mapping is at T198419. Bug: T34483 Bug: T106367 Bug: T120847 Change-Id: I807dd55d49e9bd19443329231326a5b0d3e6c453
* build: Updating mediawiki/mediawiki-codesniffer to 16.0.0Umherirrender2018-02-171-1/+1
| | | | Change-Id: I59b59f79bbf3ce4feff3b3a20c1c31bc16370531
* Remove various redundant '@license' tags in file headersTimo Tijhof2018-01-121-2/+0
| | | | | | | | | | | | | Redundant given this is the project-wide license already, especially in file headers that already include the GPL license header. This and other minor fixups based on feedback from Ie0cea0ef5027c7e5. * Add @file where missing. * Move @ingroup and @deprecated from file to class doc where needed. Change-Id: I7067abb7abee1f0c238cb2536e16192e946d8daa
* Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCaseKunal Mehta2018-01-011-0/+2
| | | | Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13
* Family name of Thiemo changedThiemo Mättig2017-11-141-1/+1
| | | | Change-Id: I5477d02111e53790e858624c4b7c4f09dbc418fa
* Refactor global function wfBCP47 to static function LanguageCode::bcp47Fomafix2017-10-051-0/+115
| | | | | | Deprecate global function wfBCP47. Change-Id: Ie6bb061b5d6ca67289bb18bc468a87421f38fc94
* Add new static function LanguageCode::replaceDeprecatedCodesFomafix2017-08-101-0/+6
| | | | | | Refactor the deprecatedLanguageCodeMapping to a private variable. Change-Id: I5f8e601e53de183e6268c9ef601eef8390b725cd
* Break up $wgDummyLanguageCodesThis, that and the other2017-03-081-0/+40
$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