henry pushed to branch tor-browser-115.22.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

2 changed files:

Changes:

  • browser/components/abouttor/AboutTorParent.sys.mjs
    ... ... @@ -23,6 +23,7 @@ export class AboutTorParent extends JSWindowActorParent {
    23 23
                 surveyDismissVersionPref,
    
    24 24
                 0
    
    25 25
               ),
    
    26
    +          appLocale: Services.locale.appLocaleAsBCP47,
    
    26 27
             });
    
    27 28
           case "AboutTor:SetSearchOnionize":
    
    28 29
             Services.prefs.setBoolPref(onionizePref, message.data);
    

  • browser/components/abouttor/content/aboutTor.js
    ... ... @@ -342,8 +342,9 @@ const SurveyArea = {
    342 342
        *   user has already dismissed.
    
    343 343
        * @param {boolean} isStable - Whether this is the stable release of Tor
    
    344 344
        *   Browser.
    
    345
    +   * @param {string} appLocale - The app locale currently in use.
    
    345 346
        */
    
    346
    -  potentiallyShow(dismissVersion, isStable) {
    
    347
    +  potentiallyShow(dismissVersion, isStable, appLocale) {
    
    347 348
         const now = Date.now();
    
    348 349
         if (
    
    349 350
           now < this._startDate ||
    
    ... ... @@ -356,14 +357,13 @@ const SurveyArea = {
    356 357
           return;
    
    357 358
         }
    
    358 359
     
    
    359
    -    // Determine the survey locale based on the about:tor locale.
    
    360
    +    // Determine the survey locale based on the app locale.
    
    360 361
         // NOTE: We do not user document.l10n to translate the survey banner.
    
    361 362
         // Instead we only translate the banner into a limited set of locales that
    
    362 363
         // match the languages that the survey itself supports. This should match
    
    363 364
         // the language of the survey when it is opened by the user.
    
    364
    -    const pageLocale = document.documentElement.getAttribute("lang");
    
    365 365
         for (const localeData of this._localeDataSet) {
    
    366
    -      if (localeData.browserLocales.includes(pageLocale)) {
    
    366
    +      if (localeData.browserLocales.includes(appLocale)) {
    
    367 367
             this._localeData = localeData;
    
    368 368
             break;
    
    369 369
           }
    
    ... ... @@ -403,8 +403,9 @@ window.addEventListener("InitialData", event => {
    403 403
         searchOnionize,
    
    404 404
         messageData,
    
    405 405
         surveyDismissVersion,
    
    406
    +    appLocale,
    
    406 407
       } = event.detail;
    
    407 408
       SearchWidget.setOnionizeState(!!searchOnionize);
    
    408 409
       MessageArea.setMessageData(messageData, !!isStable, !!torConnectEnabled);
    
    409
    -  SurveyArea.potentiallyShow(surveyDismissVersion, isStable);
    
    410
    +  SurveyArea.potentiallyShow(surveyDismissVersion, isStable, appLocale);
    
    410 411
     });