diff --git a/extensions/ohif-i18n/package.json b/extensions/ohif-i18n/package.json index 291e46352..812afabdc 100644 --- a/extensions/ohif-i18n/package.json +++ b/extensions/ohif-i18n/package.json @@ -17,9 +17,9 @@ "prepublishOnly": "npm run build" }, "peerDependencies": { + "i18next": "^15.1.3", "react": "^16.0.0", "react-dom": "^16.0.0", - "i18next": "^15.1.3", "react-i18next": "^10.11.0" }, "devDependencies": { @@ -51,7 +51,8 @@ "rollup-plugin-node-resolve": "^4.0.0", "rollup-plugin-peer-deps-external": "^2.2.0", "rollup-plugin-postcss": "^2.0.3", - "rollup-plugin-url": "^2.1.0" + "rollup-plugin-url": "^2.1.0", + "i18next-browser-languagedetector": "^3.0.1" }, "husky": { "hooks": { diff --git a/extensions/ohif-i18n/src/index.js b/extensions/ohif-i18n/src/index.js index 41d7362b8..69b2b9f9d 100755 --- a/extensions/ohif-i18n/src/index.js +++ b/extensions/ohif-i18n/src/index.js @@ -1,5 +1,6 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; +import LngDetector from 'i18next-browser-languagedetector'; const currentLanguage = process.env.REACT_APP_LANG || 'en-US'; const debugMode = !!( @@ -63,6 +64,7 @@ function addLocales(context) { let translate; i18n + .use(LngDetector) .use(initReactI18next) .init({ resources: getLocales(),