From ba7e22d61b601cd9ed3aa260313d9b0c58eabefe Mon Sep 17 00:00:00 2001 From: Cimbali Date: Mon, 2 Mar 2020 11:02:47 +0100 Subject: [PATCH] Consistently use browser.i18n language Make the language used for date formatting and document lang attribute consistent with the language used for strings by using browser.i18n for both mechanisms (instead of something relying on navigator.language which is a different setting). Also fixes the problems when navigator.language is not specified, see #487 and #274. --- background.js | 2 +- ui/brief.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index 4656c12e..a761a06d 100644 --- a/background.js +++ b/background.js @@ -259,7 +259,7 @@ const Brief = { let relativeDate = new this.common.RelativeDate(lastUpdateTime); let time, pluralForms, form; - let lang = Brief.window.navigator.language; + let lang = browser.i18n.getUILanguage(); switch (true) { case relativeDate.deltaMinutes === 0: diff --git a/ui/brief.js b/ui/brief.js index 4dc5ea84..a75ec411 100644 --- a/ui/brief.js +++ b/ui/brief.js @@ -67,7 +67,7 @@ async function init() { Commands.applyStyle(); let doc = contentIframe.contentDocument; - doc.documentElement.setAttribute('lang', navigator.language); + doc.documentElement.setAttribute('lang', browser.i18n.getUILanguage()); SplitterModule.init(); document.getElementById('sidebar-splitter').addEventListener(