Page MenuHomePhabricator

Get language fallback chain from URL parameter instead of from Language::getFallbacksFor
Open, Needs TriagePublic


Currently the ResourceLoader uses the user interface language from the URL parameter lang for language based messages, images and scripts. If there is no entry for the value in the lang parameter the language fallback chain from of the user interface language generated by Language::getFallbacksFor is used. This is a unwanted dependency when making ResourceLoader a standalone library (T32956). Language::getFallbacksFor has also a bad performance when the chain is not cached yet.

The ResourceLoader should use the whole fallback language chain instead of only the user interface language. This avoids a dependency on Language::getFallbacksFor and also allows individual language fallback chains.


The ResourceLoader still uses the URL parameter lang but interpret the value as array of language codes separated by a separator character like , or |. The last entry in the fallback language chain is always the language code qqx which is the default language code. The entry qqx should omitted. A language code array with the length 2 (e.g en, qqx) is equivalent to the current parameter lang=en and a language code array with the length 1 (qqx) is a empty or omitted URL parameter lang. So it is backward compatible.

The matching of the language codes should improved according to BCP 47 so that a language code de-AT is automatic matched to de when there is no entry for de-AT. Therefor it is not necessary to add de in the fallback chain of the language code de-AT.