Preferences: Allow only languages with translations in user options
authorFomafix <fomafix@googlemail.com>
Sat, 24 Feb 2018 14:49:46 +0000 (15:49 +0100)
committerNikerabbit <niklas.laxstrom@gmail.com>
Thu, 14 Jun 2018 13:32:47 +0000 (13:32 +0000)
commitaad2e5c38bfea0e2def9b811e4ecda2cd132fc29
tree2d7904316bc0d6ea1ca0d2d92978ed21fbf53e4c
parent80f31ecac6ca70793341d1eba9300cfcf32b3178
Preferences: Allow only languages with translations in user options

This change allows only language codes with translations for the user
option 'language'. This restrict the selectable values in the
preferences and also prevents setting the user option via API.

With the URL parameter 'uselang' the user interface language can
still set to a language code without translation.

In the current situation this change will remove the following language
codes from the allowed values:
> print '* ' . implode( "\n* ", array_diff(
array_keys( Language::fetchLanguageNames( null, 'mw' ) ),
array_keys( Language::fetchLanguageNames( null, 'mwfile' ) )
) );
* aa
* als
* bat-smg
* be-x-old
* cho
* fiu-vro
* ho
* hz
* kj
* kr
* mh
* mus
* ng
* no
* rn
* roa-rup
* shi-latn
* shi-tfng
* simple
* tum
* uz-cyrl
* uz-latn
* zh-classical
* zh-min-nan
* zh-yue

The change I1dd6fb1f240ce3319b132d0f29f0622fba33e655 ensures that the
deprecated language codes get replaced by the new language codes. The
other untranslated language codes get replaced by the content language
codes when the user loads the preferences.

Bug: T118199
Change-Id: I1382996b031af3fe9f6e1568beeb6376dcbcd217
includes/preferences/DefaultPreferencesFactory.php