-
Notifications
You must be signed in to change notification settings - Fork 26
/
i18n.js
41 lines (38 loc) · 994 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
38
39
40
41
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import Backend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
import translationEN from "./public/locales/en/common.json";
import translationTR from "./public/locales/tr/common.json";
import { LANGUAGE_KEY_LOCAL_STORAGE } from "./src/utils/constants";
import { getLocalStorage } from "./src/utils/hooks";
const resources = {
EN: {
common: translationEN,
},
TR: {
common: translationTR,
},
};
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
fallbackLng: "TR",
localeDetection: false,
lng: getLocalStorage(LANGUAGE_KEY_LOCAL_STORAGE, "TR"),
debug: false,
preload: true,
returnNull: false,
ns: ["common"],
detection: {
order: ["localStorage", "cookie"],
cache: ["cookie"],
},
interpolation: {
escapeValue: false,
},
});
export default i18n;