Adding language detection

This commit is contained in:
Jeff Avallone 2018-02-11 18:43:11 -05:00
parent 355ef79d20
commit 21146549f7
3 changed files with 7 additions and 0 deletions

View File

@ -66,6 +66,7 @@
"feather-icons": "^4.5.0", "feather-icons": "^4.5.0",
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"i18next": "^10.3.0", "i18next": "^10.3.0",
"i18next-browser-languagedetector": "^2.1.0",
"jest": "^22.2.2", "jest": "^22.2.2",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"npm-run-all": "^4.1.2", "npm-run-all": "^4.1.2",

View File

@ -1,10 +1,12 @@
import i18n from 'i18next'; import i18n from 'i18next';
import { reactI18nextModule } from 'react-i18next'; import { reactI18nextModule } from 'react-i18next';
import LangDetector from 'i18next-browser-languagedetector';
import locales from './locales'; import locales from './locales';
i18n i18n
.use(reactI18nextModule) .use(reactI18nextModule)
.use(LangDetector)
.init({ .init({
fallbackLng: 'en', fallbackLng: 'en',
debug: (process.env.NODE_ENV !== 'production'), debug: (process.env.NODE_ENV !== 'production'),

View File

@ -3662,6 +3662,10 @@ husky@^0.14.3:
normalize-path "^1.0.0" normalize-path "^1.0.0"
strip-indent "^2.0.0" strip-indent "^2.0.0"
i18next-browser-languagedetector@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-2.1.0.tgz#1b0e17b09507f84e7a1fa761539a07544f92a0df"
i18next@^10.3.0: i18next@^10.3.0:
version "10.3.0" version "10.3.0"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-10.3.0.tgz#6866d14f6ae7b3629921f78bc028d04914f0654c" resolved "https://registry.yarnpkg.com/i18next/-/i18next-10.3.0.tgz#6866d14f6ae7b3629921f78bc028d04914f0654c"