Add aliases for Georgian, Armenian, Spanish, and Japanese

Also make it possible to add multiple aliases for a language.

Bug: T178996
Change-Id: I00bb4a158caed0c1ba15d41e294281a001c917b1
This commit is contained in:
Vagrant Default User
2018-01-17 20:24:34 +00:00
committed by Amire80
parent 08079b9bb8
commit 91a54767b6
3 changed files with 41 additions and 8 deletions

View File

@@ -76,20 +76,28 @@ class LanguageNameIndexer extends Maintenance {
// To resolve this, some languages are added here locally.
$specialLanguages = [
// Catalan, sometimes searched as "Valencià"
'ca' => 'valencia',
'ca' => [ 'valencia' ],
// Spanish, the transliteration of the autonym is often used for searching
'es' => [ 'castellano' ],
// Armenian, the transliteration of the autonym is often used for searching
'hy' => [ 'hayeren' ],
// Georgian, the transliteration of the autonym is often used for searching
'ka' => 'kartuli',
'ka' => [ 'kartuli', 'qartuli' ],
// Japanese, the transliteration of the autonym is often used for searching
'ja' => [ 'nihongo', 'にほんご' ],
// Western Punjabi, doesn't start with the word "Punjabi" in any language
'pnb' => 'punjabi western',
'pnb' => [ 'punjabi western' ],
// Simplified and Traditional Chinese, because zh-hans and zh-hant
// are not mapped to any English name
'zh-hans' => 'chinese simplified',
'zh-hant' => 'chinese traditional',
'zh-hans' => [ 'chinese simplified' ],
'zh-hant' => [ 'chinese traditional' ],
];
foreach ( $specialLanguages as $targetLanguage => $translation ) {
$bucket = LanguageNameSearch::getIndex( $translation );
$buckets[$bucket]['prefix'][$translation] = $targetLanguage;
foreach ( $specialLanguages as $targetLanguage => $translations ) {
foreach ( $translations as $translation ) {
$bucket = LanguageNameSearch::getIndex( $translation );
$buckets[$bucket]['prefix'][$translation] = $targetLanguage;
}
}
$lengths = [];