This is an automated email from the git hooks/post-receive script.
pierov pushed a change to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
from fb128239c335 fixup! Bug 40925: Implemented the Security Level component new 71f1cec6a9ea fixup! Bug 41369: Improve Firefox language settings for multi-lingual packages new afd362e621f5 squash! Bug 41369: Improve Firefox language settings for multi-lingual packages
The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
Summary of changes: browser/base/content/browser.xhtml | 2 + browser/base/content/languageNotification.js | 67 ++++++++++++++++++++++ browser/base/jar.mn | 2 + browser/components/preferences/main.inc.xhtml | 2 +- browser/components/preferences/main.js | 2 +- .../locales/en-US/browser/languageNotification.ftl | 10 ++++ 6 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 browser/base/content/languageNotification.js create mode 100644 browser/locales/en-US/browser/languageNotification.ftl
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit 71f1cec6a9ea94f311cc3eb0a749e5e9623798ba Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Mon Nov 14 17:00:53 2022 +0100
fixup! Bug 41369: Improve Firefox language settings for multi-lingual packages --- browser/components/preferences/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js index af53fa0403f7..5bc5b720f3f2 100644 --- a/browser/components/preferences/main.js +++ b/browser/components/preferences/main.js @@ -1042,7 +1042,7 @@ var gMainPane = { name = Services.intl.getLocaleDisplayNames(undefined, ["ja"], { preferNative: true, - }) + " (ja)"; + })[0] + " (ja)"; } else { name += ` (${code})`; }
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch tor-browser-102.4.0esr-12.0-2 in repository tor-browser.
commit afd362e621f53898a934d6f4bf61d5269095fd18 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Fri Nov 4 18:18:13 2022 +0100
squash! Bug 41369: Improve Firefox language settings for multi-lingual packages
Bug 41378: Tell users that they can change their language at the first start
With multi-lingual builds, Tor Browser matches the user's system language, but some users might want to change it. So, we tell them that it is possible, but only once. --- browser/base/content/browser.xhtml | 2 + browser/base/content/languageNotification.js | 67 ++++++++++++++++++++++ browser/base/jar.mn | 2 + browser/components/preferences/main.inc.xhtml | 2 +- .../locales/en-US/browser/languageNotification.ftl | 10 ++++ 5 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/browser/base/content/browser.xhtml b/browser/base/content/browser.xhtml index 6a9103f4e16e..ac4ddb8c3979 100644 --- a/browser/base/content/browser.xhtml +++ b/browser/base/content/browser.xhtml @@ -95,6 +95,7 @@ #ifdef NIGHTLY_BUILD <link rel="localization" href="preview/firefoxView.ftl"/> #endif + <link rel="localization" href="browser/languageNotification.ftl"/>
<title data-l10n-id="browser-main-window-title"></title>
@@ -122,6 +123,7 @@ Services.scriptloader.loadSubScript("chrome://browser/content/places/places-menupopup.js", this); Services.scriptloader.loadSubScript("chrome://browser/content/search/autocomplete-popup.js", this); Services.scriptloader.loadSubScript("chrome://browser/content/search/searchbar.js", this); + Services.scriptloader.loadSubScript("chrome://browser/content/languageNotification.js", this); Services.scriptloader.loadSubScript("chrome://torbutton/content/tor-circuit-display.js", this); Services.scriptloader.loadSubScript("chrome://torbutton/content/torbutton.js", this); Services.scriptloader.loadSubScript("chrome://browser/content/torconnect/torBootstrapUrlbar.js", this); diff --git a/browser/base/content/languageNotification.js b/browser/base/content/languageNotification.js new file mode 100644 index 000000000000..73a5da0b58aa --- /dev/null +++ b/browser/base/content/languageNotification.js @@ -0,0 +1,67 @@ +"use strict"; + +// Show a prompt to suggest to the user that they can change the UI language. +// Show it only the first time, and then do not show it anymore +window.addEventListener("load", async () => { + const PREF_NAME = "intl.language_notification.shown"; + + if (Services.prefs.getBoolPref(PREF_NAME, false)) { + return; + } + + // Already customized, we do not suggest to change it again... + if (Services.prefs.getCharPref("intl.locale.requested", "") !== "") { + // ... and we never show the notification, either + Services.prefs.setBoolPref(PREF_NAME, true); + return; + } + + // In sync with our changes on browser/components/preferences/main.js for + // tor-browser#41369 and tor-browser#41372. + const code = + Services.locale.appLocaleAsBCP47 === "ja-JP-macos" + ? "ja" + : Services.locale.appLocaleAsBCP47; + const language = Services.intl + .getLocaleDisplayNames(undefined, [code], { preferNative: true })[0] + .replace(/\s*(.+)$/g, ""); + + // We want to determine whether the current locale was chosen based on the + // system locales, in which case langauge negotiation returns a match, or + // whether it simply defaulted to en-US. + const matchingSystem = !!Services.locale.negotiateLanguages( + // Since intl.locale.requested is empty, we expect requestedLocales to match + // the user's system locales. + Services.locale.requestedLocales, + Services.locale.availableLocales + ).length; + const label = await document.l10n.formatValue( + matchingSystem + ? "language-notification-label-system" + : "language-notification-label", + { language } + ); + + const buttons = [ + { + "l10n-id": "language-notification-button", + callback() { + openPreferences("general-language"); + }, + }, + ]; + + gNotificationBox.appendNotification( + "language-notification", + { + label, + priority: gNotificationBox.PRIORITY_INFO_HIGH, + }, + buttons + ); + + // We do not wait for the user to either click on the button or dismiss the + // notification: after we have shown it once, we take for granted that the + // user has seen it and we never show it again. + Services.prefs.setBoolPref(PREF_NAME, true); +}); diff --git a/browser/base/jar.mn b/browser/base/jar.mn index 02ee0b359515..5b603d0d5483 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -111,6 +111,8 @@ browser.jar: content/browser/spotlight.js (content/spotlight.js) * content/browser/default-bookmarks.html (content/default-bookmarks.html)
+ content/browser/languageNotification.js (content/languageNotification.js) + % override chrome://global/content/netError.xhtml chrome://browser/content/certerror/aboutNetError.xhtml
# L10n resources and overrides. diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/preferences/main.inc.xhtml index c4ada41e3d75..7c750203fb54 100644 --- a/browser/components/preferences/main.inc.xhtml +++ b/browser/components/preferences/main.inc.xhtml @@ -322,7 +322,7 @@ </groupbox>
<!-- Languages --> -<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true"> +<groupbox id="languagesGroup" data-category="paneGeneral" hidden="true" data-subcategory="language"> <label><html:h2 data-l10n-id="language-header"/></label>
<vbox id="browserLanguagesBox" align="start" hidden="true"> diff --git a/browser/locales/en-US/browser/languageNotification.ftl b/browser/locales/en-US/browser/languageNotification.ftl new file mode 100644 index 000000000000..2ad06bf5c2d5 --- /dev/null +++ b/browser/locales/en-US/browser/languageNotification.ftl @@ -0,0 +1,10 @@ +# 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/. + +# $language is the language Tor Browser is displayed in (already translated) +language-notification-label-system = { -brand-short-name } has set your display language to { $language } based on your system’s language. +# This is shown when the system language is not supported, so we fall back to another language instead. +# $language is the language Tor Browser is displayed in (already translated). +language-notification-label = { -brand-short-name } has set your display language to { $language }. +language-notification-button = Change Language…
tor-commits@lists.torproject.org