... |
... |
@@ -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
|
}); |