From 3e5bd341418760a1d765ed096b6675247c5f3035 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Wed, 3 Mar 2021 22:24:13 +0100 Subject: [PATCH] Fixes #2381 --- CHANGES.md | 1 + src/headless/core.js | 2 +- src/i18n/index.js | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e404c831e..2eba6b572 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -36,6 +36,7 @@ Removed events: - #2377: The @converse/headless NPM package is missing the dist directory, causing import errors - #2396: @converse/headless wrongly depends on `CustomElement` from the view layer +- #2381: Converse does not reflect the browser language ## 7.0.4 (2020-12-09) diff --git a/src/headless/core.js b/src/headless/core.js index 5f476d0b7..e3c19f45b 100644 --- a/src/headless/core.js +++ b/src/headless/core.js @@ -108,7 +108,7 @@ const DEFAULT_SETTINGS = { discover_connection_methods: true, geouri_regex: /https\:\/\/www.openstreetmap.org\/.*#map=[0-9]+\/([\-0-9.]+)\/([\-0-9.]+)\S*/g, geouri_replacement: 'https://www.openstreetmap.org/?mlat=$1&mlon=$2#map=18/$1/$2', - i18n: 'en', + i18n: undefined, idle_presence_timeout: 300, // Seconds after which an idle presence is sent jid: undefined, keepalive: true, diff --git a/src/i18n/index.js b/src/i18n/index.js index 4b48a24b7..39b60e2e2 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -16,12 +16,12 @@ function detectLocale (library_check) { * @param { Function } library_check - Returns a boolean indicating whether * the locale is supported. */ - var locale, i; + let locale; if (window.navigator.userLanguage) { locale = isLocaleAvailable(window.navigator.userLanguage, library_check); } if (window.navigator.languages && !locale) { - for (i=0; i