-
Notifications
You must be signed in to change notification settings - Fork 0
/
i18n.js
37 lines (30 loc) · 844 Bytes
/
i18n.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import En from "./src/translations/en/en.json";
import Ru from "./src/translations/ru/ru.json";
import Uz from "./src/translations/uz/uz.json";
import De from "./src/translations/de/de.json";
const domain = window.location.hostname.split('.').pop();
const resources = {
Uz,
En,
Ru,
De
};
const resourcesUz = {
Uz,
En,
Ru
};
const resourcesDe = {
De,
En,
};
export const availableLanguages = domain == "de" ? Object.keys(resourcesDe) : Object.keys(resourcesUz);
i18n.use(initReactI18next).init({
resources,
lng: window.localStorage.i18nextLng?.toString().toLowerCase() == domain ? window.localStorage.i18nextLng : "En",
defaultNS: "common",
fallbackLng: domain == "de" ? "De" : "Uz"
});
export default i18n;