aa202277fb
Close #1250 Squashed commit of the following: commit e722a3e3b4b1049c5df22b3f11b5826992d3cc6c Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Dec 12 18:27:51 2019 +0300 update ru commit 086e722a4dc1922ac7b8aff537050689900a8bd0 Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Dec 12 18:15:15 2019 +0300 fix cloudflare -> quad9, update es commit 86c235936d2f86e536f45fc475f29b43eb695e3d Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Dec 12 18:01:20 2019 +0300 * update es, ru, sr-cs commit 2b6b510b998b7e7b2f4c3fa5d7af57dc5413a611 Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Dec 12 17:43:05 2019 +0300 * update 'no' commit 1de6215aa90374ee147bbd0a685643232e98e4c8 Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Dec 12 17:41:37 2019 +0300 * use dnsproxy v0.23.2 commit c545a1bf7e4e706b45b4670b804a50bf8d75bae3 Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Dec 12 17:36:37 2019 +0300 update ru commit c22eec9bcfad67284e21cfc4e6b06fb63a64d25d Author: Simon Zolin <s.zolin@adguard.com> Date: Thu Dec 12 17:22:03 2019 +0300 * update translations; add sr-cs, fa, hr
146 lines
3.0 KiB
JavaScript
146 lines
3.0 KiB
JavaScript
import i18n from 'i18next';
|
|
import { reactI18nextModule } from 'react-i18next';
|
|
import { initReactI18n } from 'react-i18next/hooks';
|
|
import langDetect from 'i18next-browser-languagedetector';
|
|
|
|
import { DEFAULT_LANGUAGE } from './helpers/constants';
|
|
|
|
import vi from './__locales/vi.json';
|
|
import en from './__locales/en.json';
|
|
import ru from './__locales/ru.json';
|
|
import es from './__locales/es.json';
|
|
import fr from './__locales/fr.json';
|
|
import ja from './__locales/ja.json';
|
|
import sv from './__locales/sv.json';
|
|
import ptBR from './__locales/pt-br.json';
|
|
import zhTW from './__locales/zh-tw.json';
|
|
import bg from './__locales/bg.json';
|
|
import zhCN from './__locales/zh-cn.json';
|
|
import cs from './__locales/cs.json';
|
|
import da from './__locales/da.json';
|
|
import de from './__locales/de.json';
|
|
import id from './__locales/id.json';
|
|
import it from './__locales/it.json';
|
|
import ko from './__locales/ko.json';
|
|
import no from './__locales/no.json';
|
|
import nl from './__locales/nl.json';
|
|
import pl from './__locales/pl.json';
|
|
import ptPT from './__locales/pt-pt.json';
|
|
import sk from './__locales/sk.json';
|
|
import sl from './__locales/sl.json';
|
|
import tr from './__locales/tr.json';
|
|
import srCS from './__locales/sr-cs.json';
|
|
import hr from './__locales/hr.json';
|
|
import fa from './__locales/fa.json';
|
|
|
|
const resources = {
|
|
en: {
|
|
translation: en,
|
|
},
|
|
vi: {
|
|
translation: vi,
|
|
},
|
|
ru: {
|
|
translation: ru,
|
|
},
|
|
es: {
|
|
translation: es,
|
|
},
|
|
fr: {
|
|
translation: fr,
|
|
},
|
|
ja: {
|
|
translation: ja,
|
|
},
|
|
sv: {
|
|
translation: sv,
|
|
},
|
|
'pt-br': {
|
|
translation: ptBR,
|
|
},
|
|
'zh-tw': {
|
|
translation: zhTW,
|
|
},
|
|
bg: {
|
|
translation: bg,
|
|
},
|
|
'zh-cn': {
|
|
translation: zhCN,
|
|
},
|
|
cs: {
|
|
translation: cs,
|
|
},
|
|
da: {
|
|
translation: da,
|
|
},
|
|
de: {
|
|
translation: de,
|
|
},
|
|
id: {
|
|
translation: id,
|
|
},
|
|
it: {
|
|
translation: it,
|
|
},
|
|
ko: {
|
|
translation: ko,
|
|
},
|
|
no: {
|
|
translation: no,
|
|
},
|
|
nl: {
|
|
translation: nl,
|
|
},
|
|
pl: {
|
|
translation: pl,
|
|
},
|
|
'pt-pt': {
|
|
translation: ptPT,
|
|
},
|
|
sk: {
|
|
translation: sk,
|
|
},
|
|
sl: {
|
|
translation: sl,
|
|
},
|
|
tr: {
|
|
translation: tr,
|
|
},
|
|
'sr-cs': {
|
|
translation: srCS,
|
|
},
|
|
hr: {
|
|
translation: hr,
|
|
},
|
|
fa: {
|
|
translation: fa,
|
|
},
|
|
};
|
|
|
|
const availableLanguages = Object.keys(resources);
|
|
|
|
i18n
|
|
.use(langDetect)
|
|
.use(initReactI18n)
|
|
.use(reactI18nextModule)
|
|
.init({
|
|
resources,
|
|
lowerCaseLng: true,
|
|
fallbackLng: DEFAULT_LANGUAGE,
|
|
keySeparator: false,
|
|
nsSeparator: false,
|
|
returnEmptyString: false,
|
|
interpolation: {
|
|
escapeValue: false,
|
|
},
|
|
react: {
|
|
wait: true,
|
|
},
|
|
}, () => {
|
|
if (!availableLanguages.includes(i18n.language)) {
|
|
i18n.changeLanguage(DEFAULT_LANGUAGE);
|
|
}
|
|
});
|
|
|
|
export default i18n;
|