gaialive commited on
Commit
f7774d9
·
verified ·
1 Parent(s): 5cfe685

Upload i18n.js

Browse files
Files changed (1) hide show
  1. web/src/i18n.js +30 -0
web/src/i18n.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import i18n from 'i18next';
2
+ import { initReactI18next } from 'react-i18next';
3
+ import LanguageDetector from 'i18next-browser-languagedetector';
4
+ import enTranslations from './locales/en.json';
5
+ import viTranslations from './locales/vi.json';
6
+
7
+ i18n
8
+ .use(LanguageDetector) // Use the language detector
9
+ .use(initReactI18next)
10
+ .init({
11
+ resources: {
12
+ en: {
13
+ translation: enTranslations
14
+ },
15
+ vi: {
16
+ translation: viTranslations
17
+ }
18
+ },
19
+ fallbackLng: 'en',
20
+ debug: false, // Set to true for debugging i18next issues
21
+ interpolation: {
22
+ escapeValue: false
23
+ },
24
+ detection: {
25
+ order: ['localStorage', 'navigator'], // Prioritize localStorage over browser language
26
+ caches: ['localStorage'], // Cache the detected language
27
+ }
28
+ });
29
+
30
+ export default i18n;