client/src/i18n.js
author ymh <ymh.work@gmail.com>
Tue, 13 Nov 2018 16:46:15 +0100
changeset 172 4b780ebbedc6
parent 171 03334a31130a
permissions -rw-r--r--
- Upgrade libraries - Make things work again

import i18n from "i18next";
import { reactI18nextModule } from "react-i18next";
import detector from "i18next-browser-languagedetector";

import translationFR from "./locales/fr/translation.json";
import translationEN from "./locales/en/translation.json";

// the translations
const resources = {
  fr: {
    translation: translationFR
  },
  en: {
    translation: translationEN
  }
};

i18n
  .use(detector)
  .use(reactI18nextModule) // passes i18n down to react-i18next
  .init({
    resources,
    debug: true,
    fallbackLng: "fr",

    interpolation: {
      escapeValue: false // react already safes from xss
    }
  });

export default i18n;