It is not possible to install multiple variants of the same language
|Reported by:||caesarsgrunt||Owned by:|
Because of the way mu_dropdown_languages() and format_code_lang() work, it is impossible to have multiple variants of the same language installed. The list of languages returned by mu_dropdown_languages() only includes one variant of each language (the one with the country code which comes last when sorted alphabetically).
For example, if .mo files for es_ES and es_PE are both installed, then only es_PE will be shown.
Furthermore, whatever variant of the language is installed, the name will be the same, not indicating the correct language variant. In the example above, the language name will be "Spanish; Castillian", even for the es_PE localisation. This is highly misleading.
A final problem is that the langauge names are not localised themselves, with the exception of "English".
The cause of these problems is the fact that format_code_lang() ignores the country code and only considers the language code when choosing the name to return. Furthermore, it returns hardcoded language names rather than translated names.
Since mu_dropdown_languages() uses the return value of format_code_lang() as the key for its internal $output array, this means that later language variants overwrite earlier ones.