From 21146549f78361b2d999ffea7e20ba248f5d7a33 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 11 Feb 2018 18:43:11 -0500 Subject: [PATCH] Adding language detection --- package.json | 1 + src/i18n.js | 2 ++ yarn.lock | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/package.json b/package.json index 2ee8a06..4a9e96f 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "feather-icons": "^4.5.0", "html-webpack-plugin": "^2.30.1", "i18next": "^10.3.0", + "i18next-browser-languagedetector": "^2.1.0", "jest": "^22.2.2", "json-loader": "^0.5.7", "npm-run-all": "^4.1.2", diff --git a/src/i18n.js b/src/i18n.js index cce163a..ff8c835 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,10 +1,12 @@ import i18n from 'i18next'; import { reactI18nextModule } from 'react-i18next'; +import LangDetector from 'i18next-browser-languagedetector'; import locales from './locales'; i18n .use(reactI18nextModule) + .use(LangDetector) .init({ fallbackLng: 'en', debug: (process.env.NODE_ENV !== 'production'), diff --git a/yarn.lock b/yarn.lock index 282dd48..c12b12a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3662,6 +3662,10 @@ husky@^0.14.3: normalize-path "^1.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: version "10.3.0" resolved "https://registry.yarnpkg.com/i18next/-/i18next-10.3.0.tgz#6866d14f6ae7b3629921f78bc028d04914f0654c"