forked from vergecurrency/vergecurrency.com
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathi18n.js
45 lines (33 loc) · 959 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
42
43
44
45
const Resources = require('./locales/index.js');
const i18n = require('i18next');
const LanguageDetector = require('i18next-browser-languagedetector');
const reactI18nextModule = require('react-i18next');
const options = {
fallbackLng: 'en',
load: 'languageOnly', // no region specific locals like en-US, de-DE
ns: ['common', 'home'], // have a common namespace used around the full app
defaultNS: 'common',
initImmediate: false,
appendNamespaceToMissingKey: true,
resources: Resources,
debug: false,
saveMissing: false,
updateMissing: false,
interpolation: {
escapeValue: true,
formatSeparator: ',',
format: (value, format) => {
if (format === 'uppercase') return value.toUpperCase();
return value;
},
},
react: {
wait: false,
},
};
if (process.browser) {
i18n.use(LanguageDetector);
}
i18n.use(reactI18nextModule);
if (!i18n.isInitialized) i18n.init(options);
module.exports = i18n;