diff --git a/locales/en/translation.json b/locales/en/translation.json new file mode 100644 index 0000000000000000000000000000000000000000..d67e188dfb89f10b2cca7a4a37eb37dfc78d7610 --- /dev/null +++ b/locales/en/translation.json @@ -0,0 +1,3 @@ +{ + "translation": {} +} diff --git a/package.json b/package.json index d147f892767a6bc609542207aa5e4a093cc8f04b..5e0c9cbdd54832473e5e6c0110ba08746cecc621 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "classnames": "^2.2.6", "css-ns": "^1.2.2", "deepmerge": "^3.1.0", + "i18next": "^14.0.1", "intersection-observer": "^0.5.1", "manifesto.js": "^3.0.9", "node-fetch": "^2.3.0", @@ -43,6 +44,7 @@ "react": "^16.7.0", "react-dom": "^16.4.0", "react-fullscreen-crossbrowser": "^1.0.9", + "react-i18next": "^9.0.10", "react-mosaic-component": "^2.0.2", "react-redux": "^6.0.0", "react-virtualized": "^9.21.0", diff --git a/src/i18n.js b/src/i18n.js new file mode 100644 index 0000000000000000000000000000000000000000..dac6958f05709d746f951f1f33fb68cbc2f62a6f --- /dev/null +++ b/src/i18n.js @@ -0,0 +1,22 @@ +import i18n from 'i18next'; +import { reactI18nextModule } from 'react-i18next'; +import en from '../locales/en/translation.json'; + +// Load translations for each language +const resources = { + en, +}; + +i18n + .use(reactI18nextModule) + .init({ + resources, + lng: 'en', + fallbackLng: 'en', + + interpolation: { + escapeValue: false, // react is already safe from xss + }, + }); + +export default i18n;