-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathi18n.js
36 lines (30 loc) · 905 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
import i18n from "i18next";
import intervalPlural from "i18next-intervalplural-postprocessor";
import { initReactI18next } from "react-i18next";
import AsyncStoragePlugin from 'i18next-react-native-async-storage'
import Fetch from "i18next-fetch-backend";
i18n
.use(Fetch)
.use(AsyncStoragePlugin('en'))
.use(initReactI18next)
.use(intervalPlural)
.init({
backend: {
loadPath: "http://localhost:3000/infra/locales/{{ns}}.json",
// path to post missing resources
addPath: "locales/add/{{ns}}",
// define how to stringify the data when adding missing resources
stringify: JSON.stringify
},
cache: {
enabled: true,
prefix: "i18next_translations_",
expirationTime: 24 * 60 * 60 * 1000 //one day
},
defaultNS: "base",
fallbackLng: "en",
initImmediate: true,
ns: "base",
debug: false
});
export default i18n;