Opened 3 years ago
Last modified 2 years ago
#15677 new defect (bug)
It is not possible to install multiple variants of the same language
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | I18N | Version: | 3.1 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: |
Description
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.
I believe nikolay has suggested that there's a better alternative to mu_dropdown_languages() somewhere in GlotPress.