Bug 1481852 - Port bug 1469684 to TB: Allow users to switch to an installed locale. r=jorgk
--HG-- extra : rebase_source : f9bfef9bcae8ef76bf99423e213a24b82b55dc51
This commit is contained in:
Родитель
d6a140d878
Коммит
ba44e28568
|
@ -836,3 +836,6 @@ pref("security.sandbox.content.level", 0);
|
||||||
|
|
||||||
// Enable FIDO U2F
|
// Enable FIDO U2F
|
||||||
pref("security.webauth.u2f", true);
|
pref("security.webauth.u2f", true);
|
||||||
|
|
||||||
|
// Multi-lingual preferences
|
||||||
|
pref("intl.multilingual.enabled", false);
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
## Thunderbird Brand
|
||||||
|
##
|
||||||
|
## Thunderbird must be treated as a brand, and kept in English.
|
||||||
|
## It cannot be:
|
||||||
|
## - Transliterated.
|
||||||
|
## - Translated.
|
||||||
|
##
|
||||||
|
## Reference: https://www.mozilla.org/styleguide/communications/translation/
|
||||||
|
|
||||||
|
-brand-short-name = Daily
|
||||||
|
-vendor-short-name = mozilla.org
|
|
@ -3,6 +3,9 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
[localization] @AB_CD@.jar:
|
||||||
|
branding (en-US/**/*.ftl)
|
||||||
|
|
||||||
|
|
||||||
@AB_CD@.jar:
|
@AB_CD@.jar:
|
||||||
% locale branding @AB_CD@ %locale/branding/
|
% locale branding @AB_CD@ %locale/branding/
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
## Thunderbird Brand
|
||||||
|
##
|
||||||
|
## Thunderbird must be treated as a brand, and kept in English.
|
||||||
|
## It cannot be:
|
||||||
|
## - Transliterated.
|
||||||
|
## - Translated.
|
||||||
|
##
|
||||||
|
## Reference: https://www.mozilla.org/styleguide/communications/translation/
|
||||||
|
|
||||||
|
-brand-short-name = Thunderbird
|
||||||
|
-vendor-short-name = Mozilla
|
|
@ -1,4 +1,10 @@
|
||||||
#filter substitution
|
#filter substitution
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
[localization] @AB_CD@.jar:
|
||||||
|
branding (en-US/**/*.ftl)
|
||||||
|
|
||||||
@AB_CD@.jar:
|
@AB_CD@.jar:
|
||||||
% locale branding @AB_CD@ %locale/@AB_CD@/branding/
|
% locale branding @AB_CD@ %locale/@AB_CD@/branding/
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
|
<stringbundle id="bundleBrand" src="chrome://branding/locale/brand.properties"/>
|
||||||
<stringbundle id="bundlePreferences"
|
<stringbundle id="bundlePreferences"
|
||||||
src="chrome://messenger/locale/preferences/preferences.properties"/>
|
src="chrome://messenger/locale/preferences/preferences.properties"/>
|
||||||
|
<link rel="localization" href="branding/brand.ftl"/>
|
||||||
|
<link rel="localization" href="messenger/preferences/preferences.ftl"/>
|
||||||
<link rel="localization" href="messenger/preferences/fonts.ftl"/>
|
<link rel="localization" href="messenger/preferences/fonts.ftl"/>
|
||||||
<script type="application/javascript" src="chrome://global/content/l10n.js"/>
|
<script type="application/javascript" src="chrome://global/content/l10n.js"/>
|
||||||
|
|
||||||
|
|
|
@ -183,6 +183,32 @@
|
||||||
</hbox>
|
</hbox>
|
||||||
</groupbox>
|
</groupbox>
|
||||||
|
|
||||||
|
<groupbox id="messengerLanguagesBox" hidden="true">
|
||||||
|
<caption label="&languageSelector.label;"/>
|
||||||
|
<vbox align="start">
|
||||||
|
<description flex="1"
|
||||||
|
controls="chooseMessengerLanguage"
|
||||||
|
data-l10n-id="choose-messenger-language-description"/>
|
||||||
|
<menulist id="defaultMessengerLanguage"
|
||||||
|
class="accessory-button"
|
||||||
|
flex="1"
|
||||||
|
oncommand="gAdvancedPane.onLanguageChange(event)">
|
||||||
|
<menupopup/>
|
||||||
|
</menulist>
|
||||||
|
</vbox>
|
||||||
|
<hbox id="confirmMessengerLanguage"
|
||||||
|
class="message-bar"
|
||||||
|
align="center"
|
||||||
|
hidden="true">
|
||||||
|
<image class="message-bar-icon"/>
|
||||||
|
<hbox class="message-bar-content" align="center" flex="1">
|
||||||
|
<description flex="1"/>
|
||||||
|
<button class="message-bar-button"
|
||||||
|
oncommand="gAdvancedPane.confirmLanguageChange()"/>
|
||||||
|
</hbox>
|
||||||
|
</hbox>
|
||||||
|
</groupbox>
|
||||||
|
|
||||||
#ifdef HAVE_SHELL_SERVICE
|
#ifdef HAVE_SHELL_SERVICE
|
||||||
<groupbox id="systemDefaultsGroup" orient="vertical">
|
<groupbox id="systemDefaultsGroup" orient="vertical">
|
||||||
<caption label="&systemIntegration.label;"/>
|
<caption label="&systemIntegration.label;"/>
|
||||||
|
|
|
@ -8,6 +8,8 @@ ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm");
|
||||||
|
ChromeUtils.import("resource://gre/modules/Localization.jsm");
|
||||||
|
|
||||||
var gAdvancedPane = {
|
var gAdvancedPane = {
|
||||||
mPane: null,
|
mPane: null,
|
||||||
|
@ -22,6 +24,10 @@ var gAdvancedPane = {
|
||||||
this.mBundle = document.getElementById("bundlePreferences");
|
this.mBundle = document.getElementById("bundlePreferences");
|
||||||
this.formatLocaleSetLabels();
|
this.formatLocaleSetLabels();
|
||||||
|
|
||||||
|
if (Services.prefs.getBoolPref("intl.multilingual.enabled")) {
|
||||||
|
this.initMessengerLocale();
|
||||||
|
}
|
||||||
|
|
||||||
if (!(("arguments" in window) && window.arguments[1]))
|
if (!(("arguments" in window) && window.arguments[1]))
|
||||||
{
|
{
|
||||||
// If no tab was specified, select the last used tab.
|
// If no tab was specified, select the last used tab.
|
||||||
|
@ -533,4 +539,69 @@ updateWritePrefs: function ()
|
||||||
appLocaleRadio.accessKey = this.mBundle.getString("appLocale.accesskey");
|
appLocaleRadio.accessKey = this.mBundle.getString("appLocale.accesskey");
|
||||||
rsLocaleRadio.accessKey = this.mBundle.getString("rsLocale.accesskey");
|
rsLocaleRadio.accessKey = this.mBundle.getString("rsLocale.accesskey");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Load the preferences string bundle for a given locale.
|
||||||
|
getBundleForLocale(locale) {
|
||||||
|
function generateContexts(resourceIds) {
|
||||||
|
return L10nRegistry.generateContexts([locale], resourceIds);
|
||||||
|
}
|
||||||
|
return new Localization([
|
||||||
|
"messenger/preferences/preferences.ftl",
|
||||||
|
"branding/brand.ftl",
|
||||||
|
], generateContexts);
|
||||||
|
},
|
||||||
|
|
||||||
|
initMessengerLocale() {
|
||||||
|
let localeCodes = Services.locale.getAvailableLocales();
|
||||||
|
let localeNames = Services.intl.getLocaleDisplayNames(undefined, localeCodes);
|
||||||
|
let locales = localeCodes.map((code, i) => ({code, name: localeNames[i]}));
|
||||||
|
locales.sort((a, b) => a.name > b.name);
|
||||||
|
|
||||||
|
let fragment = document.createDocumentFragment();
|
||||||
|
for (let {code, name} of locales) {
|
||||||
|
let menuitem = document.createElement("menuitem");
|
||||||
|
menuitem.setAttribute("value", code);
|
||||||
|
menuitem.setAttribute("label", name);
|
||||||
|
fragment.appendChild(menuitem);
|
||||||
|
}
|
||||||
|
let menulist = document.getElementById("defaultMessengerLanguage");
|
||||||
|
let menupopup = menulist.querySelector("menupopup");
|
||||||
|
menupopup.appendChild(fragment);
|
||||||
|
menulist.value = Services.locale.getRequestedLocale();
|
||||||
|
|
||||||
|
document.getElementById("messengerLanguagesBox").hidden = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Show the confirmation message bar to allow a restart into the new language. */
|
||||||
|
async onLanguageChange(event) {
|
||||||
|
let locale = event.target.value;
|
||||||
|
let messageBar = document.getElementById("confirmMessengerLanguage");
|
||||||
|
if (locale == Services.locale.getRequestedLocale()) {
|
||||||
|
messageBar.hidden = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Set the text in the message bar for the new locale.
|
||||||
|
let newBundle = this.getBundleForLocale(locale);
|
||||||
|
let description = messageBar.querySelector("description");
|
||||||
|
description.textContent = await newBundle.formatValue(
|
||||||
|
"confirm-messenger-language-change-description");
|
||||||
|
let button = messageBar.querySelector("button");
|
||||||
|
button.setAttribute(
|
||||||
|
"label", await newBundle.formatValue(
|
||||||
|
"confirm-messenger-language-change-button"));
|
||||||
|
messageBar.hidden = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Confirm the locale change and restart the Thunderbird in the new locale. */
|
||||||
|
confirmLanguageChange() {
|
||||||
|
let locale = document.getElementById("defaultMessengerLanguage").value;
|
||||||
|
Services.locale.setRequestedLocales([locale]);
|
||||||
|
|
||||||
|
// Restart with the new locale.
|
||||||
|
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
|
||||||
|
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
|
||||||
|
if (!cancelQuit.data) {
|
||||||
|
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<!ENTITY enableGlodaSearch.label "Enable Global Search and Indexer">
|
<!ENTITY enableGlodaSearch.label "Enable Global Search and Indexer">
|
||||||
<!ENTITY enableGlodaSearch.accesskey "G">
|
<!ENTITY enableGlodaSearch.accesskey "G">
|
||||||
<!ENTITY dateTimeFormatting.label "Date and Time Formatting">
|
<!ENTITY dateTimeFormatting.label "Date and Time Formatting">
|
||||||
|
<!ENTITY languageSelector.label "Language">
|
||||||
<!ENTITY allowHWAccel.label "Use hardware acceleration when available">
|
<!ENTITY allowHWAccel.label "Use hardware acceleration when available">
|
||||||
<!ENTITY allowHWAccel.accesskey "h">
|
<!ENTITY allowHWAccel.accesskey "h">
|
||||||
<!ENTITY storeType.label "Message Store Type for new accounts:">
|
<!ENTITY storeType.label "Message Store Type for new accounts:">
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
choose-messenger-language-description = Choose the languages used to display menus, messages, and notifications from { -brand-short-name }.
|
||||||
|
confirm-messenger-language-change-description = Restart { -brand-short-name } to apply these changes
|
||||||
|
confirm-messenger-language-change-button = Apply and Restart
|
|
@ -402,6 +402,10 @@ richlistbox:focus > richlistitem[selected="true"] {
|
||||||
color: var(--in-content-selected-text) !important;
|
color: var(--in-content-selected-text) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#defaultMessengerLanguage {
|
||||||
|
min-width: 20em;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog
|
* Dialog
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче