Bug #13776
closedSome functions fail if the Language does not exactly match an available Locale
100%
Description
Some languages are defined in the pfSense translations system without a location, such as French which is defined as "fr". The problem is that certain functions expect to be able to load a locale using the same name. However, there are not always matches for these exactly as we specify them.
The easiest one to check if it works or not is Diagnostics > System Activity (diag_system_activity.php
) or run top
from Diagnostics > Command Prompt (diag_command.php
).
Looking in /usr/share/locale
on a dev snapshot there are several variations of French:
/usr/share/locale/fr_BE.UTF-8 /usr/share/locale/fr_CA.UTF-8 /usr/share/locale/fr_CH.UTF-8 /usr/share/locale/fr_FR.UTF-8
We should likely be setting the language as "fr_FR" in this case for example.
Languages we specify fully matching, such as en_US or pt_BR work as-is.
Some we have a location on but it doesn't match a locale (e.g. some of the variations of Chinese) and those maybe harder to fix.
So we either need to change the language names in the backend to match equivalent locale definitions or separately set the lang and locale to appropriate values.
If we change the names in the backend we will need upgrade code to ensure the user is moved to the new name on upgrade.
Related issues
Updated by Jim Pingle almost 2 years ago
Not a release blocker, can be pushed to 23.05 if we can't find a good solution near term.
Updated by Jim Pingle almost 2 years ago
- Plus Target Version changed from 23.01 to 23.05
Updated by Jim Pingle over 1 year ago
- Plus Target Version changed from 23.05 to 23.09
Updated by Marcos M over 1 year ago
- Related to Bug #14414: Diagnostics activité system (French language setup) don't work: Unable to gather system activity (1). The command top -aSH give invalid locale. added
Updated by Marcos M over 1 year ago
Potentially related https://redmine.pfsense.org/issues/14406
Updated by Jim Pingle over 1 year ago
- Target version changed from 2.7.0 to CE-Next
Updated by Jim Pingle about 1 year ago
- Status changed from New to In Progress
- Assignee set to Jim Pingle
- Target version changed from CE-Next to 2.8.0
It looks like the easiest path forward is to rename our translation directories and the internal IDs to match the base system locales that exist.
For example, rename them as follows in the filesystem under /usr/local/share/locale/
(and Zanata?):
"nl" => "nl_NL" "fr" => "fr_FR" "it" => "it_IT" "ko" => "ko_KR" "nb" => "nb_NO" "pl" => "pl_PL" "ru" => "ru_RU" "es" => "es_ES"
Then make the same changes to the language list in source:src/etc/inc/pfSense-utils.inc#L3185
And finally, create an upgrade code function to change the old language names to the new language names.
Updated by Jim Pingle about 1 year ago
- Status changed from In Progress to Feedback
- % Done changed from 0 to 100
Applied in changeset 6ce83e7455ea35243e2bd0645651ca22b43bc569.
Updated by Jim Pingle about 1 year ago
- Status changed from Feedback to Resolved
Works as expected on snapshots