Split some Language methods to LanguageNameUtils
authorAryeh Gregor <ayg@aryeh.name>
Thu, 2 May 2019 14:23:42 +0000 (17:23 +0300)
committerPpchelko <ppchelko@wikimedia.org>
Tue, 8 Oct 2019 21:52:07 +0000 (21:52 +0000)
commite3537bdc00244cefdaa34710be0fb0d920336ed8
tree164d745b428aa4f1b3a2a6d8c3761c9229a38467
parent4bfbf2c225d7f45aff167613f35d7d9153abe252
Split some Language methods to LanguageNameUtils

These are static methods that have to do with processing language names
and codes. I didn't include fallback behavior, because that would mean a
circular dependency with LocalisationCache.

In the new class, I renamed AS_AUTONYMS to AUTONYMS, and added a class
constant DEFINED for 'mw' to match the existing SUPPORTED and ALL. I
also renamed fetchLanguageName(s) to getLanguageName(s).

There is 100% test coverage for the code in the new class.

This was previously committed as 2e52f48c2ed and reverted because it
depended on e4468a1d6b6, which had to be reverted for performance
issues. There should be no changes other than rebasing.

Bug: T201405
Change-Id: Ifa346c8a92bf1eb57dc5e79458b32b7b26f1ee8a
(cherry picked from commit 6d80b6c0827401cf8e41589bf134147bb0aa407f)
17 files changed:
RELEASE-NOTES-1.34
autoload.php
includes/MediaWikiServices.php
includes/ServiceWiring.php
includes/cache/localisation/LocalisationCache.php
includes/language/LanguageCode.php
includes/language/LanguageNameUtils.php [new file with mode: 0644]
languages/Language.php
languages/data/Names.php
maintenance/rebuildLocalisationCache.php
tests/common/TestsAutoLoader.php
tests/phpunit/MediaWikiUnitTestCase.php
tests/phpunit/includes/api/ApiQuerySiteinfoTest.php
tests/phpunit/includes/cache/LocalisationCacheTest.php
tests/phpunit/languages/LanguageTest.php
tests/phpunit/unit/includes/language/LanguageNameUtilsTest.php [new file with mode: 0644]
tests/phpunit/unit/includes/language/LanguageNameUtilsTestTrait.php [new file with mode: 0644]