From 4676c50504c0b815a941de755b972b028896d176 Mon Sep 17 00:00:00 2001 From: Lisa Hillebrand Date: Sun, 2 May 2021 20:51:15 +0200 Subject: [PATCH] 162 Add configuration for i18next --- i18n/en.json | 8 ++++++++ i18n/i18n.js | 28 ++++++++++++++++++++++++++++ index.js | 1 + 3 files changed, 37 insertions(+) create mode 100644 i18n/en.json create mode 100644 i18n/i18n.js diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..7178649 --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,8 @@ +{ + "components": { + "Home": { + "addDataForToday": "add data for today", + "noPrediction": "As soon as you have tracked 3 menstrual cycles, drip will make predictions for the next ones." + } + } +} diff --git a/i18n/i18n.js b/i18n/i18n.js new file mode 100644 index 0000000..61e4eab --- /dev/null +++ b/i18n/i18n.js @@ -0,0 +1,28 @@ +import i18n from 'i18next'; +import { initReactI18next } from 'react-i18next'; + +// translation files +import en from './en.json'; + +const resources = { + en: { translation: en }, + }; + + + i18n + // pass the i18n instance to react-i18next. + .use(initReactI18next) + // init i18next + // for all options read: https://www.i18next.com/overview/configuration-options + .init({ + resources, + fallbackLng: 'en', + debug: true, + + interpolation: { + escapeValue: false, // not needed for react as it escapes by default + } + }); + + +export default i18n; diff --git a/index.js b/index.js index 8a547fa..ceabe59 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ import { AppRegistry } from 'react-native' import AppWrapper from './components/app-wrapper' +import './i18n/i18n'; AppRegistry.registerComponent('drip', () => AppWrapper) \ No newline at end of file