- client: Make language tag in HTML same as setting language

Close #1797

Squashed commit of the following:

commit b822a83cb05cc5ba92000cdb7d1c12629471bc57
Merge: e2fa24fb 72ce5f57
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Fri Jul 3 11:02:56 2020 +0300

    Merge branch 'master' into fix/1797

commit e2fa24fb9fa0c15f8411e186e90e0ffb1c705fb2
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Thu Jul 2 18:21:30 2020 +0300

    Extract helper

commit ba8473e7b16ab8b1abbee4b42a4ef2b0de8c136b
Author: ArtemBaskal <a.baskal@adguard.com>
Date:   Thu Jul 2 15:31:42 2020 +0300

    - client: Make language tag in HTML same as setting language
This commit is contained in:
Artem Baskal
2020-07-03 11:14:54 +03:00
parent 72ce5f57c1
commit 205680b71b
5 changed files with 106 additions and 75 deletions

View File

@@ -33,6 +33,7 @@ import hr from './__locales/hr.json';
import fa from './__locales/fa.json';
import th from './__locales/th.json';
import ro from './__locales/ro.json';
import { setHtmlLangAttr } from './helpers/helpers';
const resources = {
en: {
@@ -143,10 +144,12 @@ i18n
wait: true,
},
whitelist: availableLanguages,
}, () => {
},
() => {
if (!availableLanguages.includes(i18n.language)) {
i18n.changeLanguage(BASE_LOCALE);
}
setHtmlLangAttr(i18n.language);
});
export default i18n;