Language detection code will not work for all languages
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu Translations |
Fix Released
|
High
|
Unassigned | ||
WebApps: Applications Data |
Fix Released
|
Undecided
|
Unassigned | ||
webapps-applications (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Quantal |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[IMPACT]
Language detection code will not work for some languages, impeding their translations from being loaded and thus displaying English prompts to non-English speakers who have an otherwise localized desktop.
[TESTCASE]
1. LC_ALL=zn_CN.UTF8 firefox
2. open gmail
action's name in launcher should be localized
[Regression Potential]
none
Currently the code to detect the user's language preference to load the translations for webapps is the following (in common/utils.js):
var lang = unsafeWindow.
if (dict.hasOwnPro
return dict[lang][strid];
} else {
return strid;
}
'dict' is a variable containing a JSON string that is populated at build time with the contents of the translations in .po files in the source tree. It includes the locale code as read from the .po (or LINGUAS) files, which is a gettext-style locale code.
The problem is that the 'lang' variable as returned from the browser in some cases won't match the user's locale. This is mainly due to the fact that Firefox uses IETF-style language codes, whereas the system uses gettext-style language codes. That means for some languages there won't be a match, and thus translations won't be loaded. Here's an example for Simplified Chinese:
- Gettext locale code: zh_CN
- Firefox locale code: zh-cn
So there must be a translation gettext -> Firefox (and Chromium, if it returns locales in a different format) at build time, so that locale names from the system and from the browser can match and translations can be loaded.
Also notice that in some cases either the country code in the locale code might be present in the system locale but not in the browser, and viceversa, so it might be an idea to ignore the country code apart from some exceptions (e.g. zh_CN and zh_TW, pt_BR, etc., to name a few)
visibility: | private → public |
Changed in ubuntu-translations: | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in webapps-applications: | |
status: | New → Fix Committed |
Changed in ubuntu-translations: | |
status: | Triaged → Fix Committed |
description: | updated |
description: | updated |
Changed in webapps-applications: | |
status: | Fix Committed → Fix Released |
Changed in ubuntu-translations: | |
status: | Fix Committed → Fix Released |
no longer affects: | webapps-applications (Ubuntu Raring) |
[IMPACT]
Language detection code will not work for some languages
[TESTCASE]
1. LC_ALL=zn_CN.UTF8 firefox
2. open gmail
action's name in launcher should be localized
[Regression Potential]
none