Fix some locale detection bugs after 513f7d6555

- When upgrading from Fx52, don't show "Automatic" for
  a manually selected locale.
- Make sure Zotero.locale is always set to a known language tag
- Fix inconsistencies between Zotero.Locale.availableLocales and
  chrome.manifest
This commit is contained in:
Dan Stillman 2019-10-26 01:27:14 -04:00
parent 5779b60418
commit e7d0e282e7
3 changed files with 8 additions and 5 deletions

View file

@ -470,7 +470,6 @@ Zotero_Preferences.Advanced = {
refreshLocale: function () {
var requestedLocale = Services.locale.getRequestedLocale();
var autoLocaleName, currentValue;
// If matching OS, get the name of the current locale
@ -481,7 +480,7 @@ Zotero_Preferences.Advanced = {
// Otherwise get the name of the locale specified in the pref
else {
autoLocaleName = Zotero.getString('zotero.preferences.locale.automatic');
currentValue = requestedLocale;
currentValue = Zotero.locale;
}
// Populate menu

View file

@ -41,6 +41,7 @@ Zotero.Intl = new function () {
else if (prevLocale) {
try {
Services.locale.setRequestedLocales([prevLocale]);
Zotero.Prefs.set('intl.regional_prefs.use_os_locales', false, true);
}
catch (e) {
// Don't panic if the value is not a valid locale code
@ -58,7 +59,10 @@ Zotero.Intl = new function () {
[pluralFormGet, pluralFormNumForms] = PluralForm.makeGetter(parseInt(getIntlProp('pluralRule', 1)));
setOrClearIntlPref('intl.accept_languages', 'string');
Zotero.locale = Services.locale.getRequestedLocale();
Zotero.locale = Zotero.Utilities.Internal.resolveLocale(
Services.locale.getRequestedLocale(),
Services.locale.getAvailableLocales()
);
// Also load the brand as appName
Zotero.appName = Services.strings

View file

@ -15,8 +15,8 @@ Zotero.Locale = {
'es-ES': 'Español',
'et-EE': 'Eesti keel',
'fa': 'فارسی',
'fi': 'suomi',
'fr': 'Français',
'fi-FI': 'suomi',
'fr-FR': 'Français',
'gl-ES': 'Galego',
'hu-HU': 'magyar',
'id-ID': 'Bahasa Indonesia',