Fixes #2381
This commit is contained in:
parent
a778f3866a
commit
3e5bd34141
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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<window.navigator.languages.length && !locale; i++) {
|
||||
for (let i=0; i<window.navigator.languages.length && !locale; i++) {
|
||||
locale = isLocaleAvailable(window.navigator.languages[i], library_check);
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,8 @@ Object.assign(i18n, {
|
||||
_converse.locale = 'en';
|
||||
} else {
|
||||
try {
|
||||
_converse.locale = i18n.getLocale(api.settings.get('i18n'), api.settings.get("locales"));
|
||||
const preferred_locale = api.settings.get('i18n');
|
||||
_converse.locale = i18n.getLocale(preferred_locale, api.settings.get("locales"));
|
||||
await fetchTranslations(_converse);
|
||||
} catch (e) {
|
||||
log.fatal(e.message);
|
||||
|
Loading…
Reference in New Issue
Block a user