From 761deda4a2ea4dd5dbf4bbdacad72fac55cd6f3c Mon Sep 17 00:00:00 2001 From: Bruno Costa Date: Tue, 7 Jan 2020 00:40:20 -0300 Subject: [PATCH] feat(i18n): reorganize public translation resources re #1668 --- .../actions/ar/translation.json | 0 .../actions/de/translation.json | 0 .../actions/en/translation.json | 0 .../actions/es/translation.json | 0 .../actions/in/translation.json | 0 .../actions/ja/translation.json | 0 .../actions/pt/translation.json | 0 .../actions/ru/translation.json | 0 .../actions/zr/translation.json | 0 .../dashboard/ar/translation.json | 0 .../dashboard/de/translation.json | 0 .../dashboard/en/translation.json | 0 .../dashboard/es/translation.json | 0 .../dashboard/in/translation.json | 0 .../dashboard/ja/translation.json | 0 .../dashboard/pt/translation.json | 0 .../dashboard/ru/translation.json | 0 .../dashboard/zr/translation.json | 0 .../patient/ar/translation.json | 0 .../patient/de/translation.json | 0 .../patient/en/translation.json | 0 .../patient/es/translation.json | 0 .../patient/in/translation.json | 0 .../patient/ja/translation.json | 0 .../patient/pt/translation.json | 0 .../patient/ru/translation.json | 0 .../patient/zr/translation.json | 0 .../patients/ar/translation.json | 0 .../patients/de/translation.json | 0 .../patients/en/translation.json | 0 .../patients/es/translation.json | 0 .../patients/in/translation.json | 0 .../patients/ja/translation.json | 0 .../patients/pt/translation.json | 0 .../patients/ru/translation.json | 0 .../patients/zr/translation.json | 0 src/i18n.js | 21 ++++++++++++++++++- 37 files changed, 20 insertions(+), 1 deletion(-) rename public/{languages => locales}/actions/ar/translation.json (100%) rename public/{languages => locales}/actions/de/translation.json (100%) rename public/{languages => locales}/actions/en/translation.json (100%) rename public/{languages => locales}/actions/es/translation.json (100%) rename public/{languages => locales}/actions/in/translation.json (100%) rename public/{languages => locales}/actions/ja/translation.json (100%) rename public/{languages => locales}/actions/pt/translation.json (100%) rename public/{languages => locales}/actions/ru/translation.json (100%) rename public/{languages => locales}/actions/zr/translation.json (100%) rename public/{languages => locales}/dashboard/ar/translation.json (100%) rename public/{languages => locales}/dashboard/de/translation.json (100%) rename public/{languages => locales}/dashboard/en/translation.json (100%) rename public/{languages => locales}/dashboard/es/translation.json (100%) rename public/{languages => locales}/dashboard/in/translation.json (100%) rename public/{languages => locales}/dashboard/ja/translation.json (100%) rename public/{languages => locales}/dashboard/pt/translation.json (100%) rename public/{languages => locales}/dashboard/ru/translation.json (100%) rename public/{languages => locales}/dashboard/zr/translation.json (100%) rename public/{languages => locales}/patient/ar/translation.json (100%) rename public/{languages => locales}/patient/de/translation.json (100%) rename public/{languages => locales}/patient/en/translation.json (100%) rename public/{languages => locales}/patient/es/translation.json (100%) rename public/{languages => locales}/patient/in/translation.json (100%) rename public/{languages => locales}/patient/ja/translation.json (100%) rename public/{languages => locales}/patient/pt/translation.json (100%) rename public/{languages => locales}/patient/ru/translation.json (100%) rename public/{languages => locales}/patient/zr/translation.json (100%) rename public/{languages => locales}/patients/ar/translation.json (100%) rename public/{languages => locales}/patients/de/translation.json (100%) rename public/{languages => locales}/patients/en/translation.json (100%) rename public/{languages => locales}/patients/es/translation.json (100%) rename public/{languages => locales}/patients/in/translation.json (100%) rename public/{languages => locales}/patients/ja/translation.json (100%) rename public/{languages => locales}/patients/pt/translation.json (100%) rename public/{languages => locales}/patients/ru/translation.json (100%) rename public/{languages => locales}/patients/zr/translation.json (100%) diff --git a/public/languages/actions/ar/translation.json b/public/locales/actions/ar/translation.json similarity index 100% rename from public/languages/actions/ar/translation.json rename to public/locales/actions/ar/translation.json diff --git a/public/languages/actions/de/translation.json b/public/locales/actions/de/translation.json similarity index 100% rename from public/languages/actions/de/translation.json rename to public/locales/actions/de/translation.json diff --git a/public/languages/actions/en/translation.json b/public/locales/actions/en/translation.json similarity index 100% rename from public/languages/actions/en/translation.json rename to public/locales/actions/en/translation.json diff --git a/public/languages/actions/es/translation.json b/public/locales/actions/es/translation.json similarity index 100% rename from public/languages/actions/es/translation.json rename to public/locales/actions/es/translation.json diff --git a/public/languages/actions/in/translation.json b/public/locales/actions/in/translation.json similarity index 100% rename from public/languages/actions/in/translation.json rename to public/locales/actions/in/translation.json diff --git a/public/languages/actions/ja/translation.json b/public/locales/actions/ja/translation.json similarity index 100% rename from public/languages/actions/ja/translation.json rename to public/locales/actions/ja/translation.json diff --git a/public/languages/actions/pt/translation.json b/public/locales/actions/pt/translation.json similarity index 100% rename from public/languages/actions/pt/translation.json rename to public/locales/actions/pt/translation.json diff --git a/public/languages/actions/ru/translation.json b/public/locales/actions/ru/translation.json similarity index 100% rename from public/languages/actions/ru/translation.json rename to public/locales/actions/ru/translation.json diff --git a/public/languages/actions/zr/translation.json b/public/locales/actions/zr/translation.json similarity index 100% rename from public/languages/actions/zr/translation.json rename to public/locales/actions/zr/translation.json diff --git a/public/languages/dashboard/ar/translation.json b/public/locales/dashboard/ar/translation.json similarity index 100% rename from public/languages/dashboard/ar/translation.json rename to public/locales/dashboard/ar/translation.json diff --git a/public/languages/dashboard/de/translation.json b/public/locales/dashboard/de/translation.json similarity index 100% rename from public/languages/dashboard/de/translation.json rename to public/locales/dashboard/de/translation.json diff --git a/public/languages/dashboard/en/translation.json b/public/locales/dashboard/en/translation.json similarity index 100% rename from public/languages/dashboard/en/translation.json rename to public/locales/dashboard/en/translation.json diff --git a/public/languages/dashboard/es/translation.json b/public/locales/dashboard/es/translation.json similarity index 100% rename from public/languages/dashboard/es/translation.json rename to public/locales/dashboard/es/translation.json diff --git a/public/languages/dashboard/in/translation.json b/public/locales/dashboard/in/translation.json similarity index 100% rename from public/languages/dashboard/in/translation.json rename to public/locales/dashboard/in/translation.json diff --git a/public/languages/dashboard/ja/translation.json b/public/locales/dashboard/ja/translation.json similarity index 100% rename from public/languages/dashboard/ja/translation.json rename to public/locales/dashboard/ja/translation.json diff --git a/public/languages/dashboard/pt/translation.json b/public/locales/dashboard/pt/translation.json similarity index 100% rename from public/languages/dashboard/pt/translation.json rename to public/locales/dashboard/pt/translation.json diff --git a/public/languages/dashboard/ru/translation.json b/public/locales/dashboard/ru/translation.json similarity index 100% rename from public/languages/dashboard/ru/translation.json rename to public/locales/dashboard/ru/translation.json diff --git a/public/languages/dashboard/zr/translation.json b/public/locales/dashboard/zr/translation.json similarity index 100% rename from public/languages/dashboard/zr/translation.json rename to public/locales/dashboard/zr/translation.json diff --git a/public/languages/patient/ar/translation.json b/public/locales/patient/ar/translation.json similarity index 100% rename from public/languages/patient/ar/translation.json rename to public/locales/patient/ar/translation.json diff --git a/public/languages/patient/de/translation.json b/public/locales/patient/de/translation.json similarity index 100% rename from public/languages/patient/de/translation.json rename to public/locales/patient/de/translation.json diff --git a/public/languages/patient/en/translation.json b/public/locales/patient/en/translation.json similarity index 100% rename from public/languages/patient/en/translation.json rename to public/locales/patient/en/translation.json diff --git a/public/languages/patient/es/translation.json b/public/locales/patient/es/translation.json similarity index 100% rename from public/languages/patient/es/translation.json rename to public/locales/patient/es/translation.json diff --git a/public/languages/patient/in/translation.json b/public/locales/patient/in/translation.json similarity index 100% rename from public/languages/patient/in/translation.json rename to public/locales/patient/in/translation.json diff --git a/public/languages/patient/ja/translation.json b/public/locales/patient/ja/translation.json similarity index 100% rename from public/languages/patient/ja/translation.json rename to public/locales/patient/ja/translation.json diff --git a/public/languages/patient/pt/translation.json b/public/locales/patient/pt/translation.json similarity index 100% rename from public/languages/patient/pt/translation.json rename to public/locales/patient/pt/translation.json diff --git a/public/languages/patient/ru/translation.json b/public/locales/patient/ru/translation.json similarity index 100% rename from public/languages/patient/ru/translation.json rename to public/locales/patient/ru/translation.json diff --git a/public/languages/patient/zr/translation.json b/public/locales/patient/zr/translation.json similarity index 100% rename from public/languages/patient/zr/translation.json rename to public/locales/patient/zr/translation.json diff --git a/public/languages/patients/ar/translation.json b/public/locales/patients/ar/translation.json similarity index 100% rename from public/languages/patients/ar/translation.json rename to public/locales/patients/ar/translation.json diff --git a/public/languages/patients/de/translation.json b/public/locales/patients/de/translation.json similarity index 100% rename from public/languages/patients/de/translation.json rename to public/locales/patients/de/translation.json diff --git a/public/languages/patients/en/translation.json b/public/locales/patients/en/translation.json similarity index 100% rename from public/languages/patients/en/translation.json rename to public/locales/patients/en/translation.json diff --git a/public/languages/patients/es/translation.json b/public/locales/patients/es/translation.json similarity index 100% rename from public/languages/patients/es/translation.json rename to public/locales/patients/es/translation.json diff --git a/public/languages/patients/in/translation.json b/public/locales/patients/in/translation.json similarity index 100% rename from public/languages/patients/in/translation.json rename to public/locales/patients/in/translation.json diff --git a/public/languages/patients/ja/translation.json b/public/locales/patients/ja/translation.json similarity index 100% rename from public/languages/patients/ja/translation.json rename to public/locales/patients/ja/translation.json diff --git a/public/languages/patients/pt/translation.json b/public/locales/patients/pt/translation.json similarity index 100% rename from public/languages/patients/pt/translation.json rename to public/locales/patients/pt/translation.json diff --git a/public/languages/patients/ru/translation.json b/public/locales/patients/ru/translation.json similarity index 100% rename from public/languages/patients/ru/translation.json rename to public/locales/patients/ru/translation.json diff --git a/public/languages/patients/zr/translation.json b/public/locales/patients/zr/translation.json similarity index 100% rename from public/languages/patients/zr/translation.json rename to public/locales/patients/zr/translation.json diff --git a/src/i18n.js b/src/i18n.js index 31835373b1..ee02f75eb2 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -3,8 +3,9 @@ import Backend from 'i18next-xhr-backend' import LanguageDetector from 'i18next-browser-languagedetector' import { initReactI18next } from 'react-i18next' +import * as en from './example.json'; i18n - // load translation using xhr -> see /public/app-sections/languages + // load translation using xhr -> see /public/languages // learn more: https://github.com/i18next/i18next-xhr-backend .use(Backend) // detect user language @@ -15,6 +16,24 @@ i18n // init i18next // for all options read: https://www.i18next.com/overview/configuration-options .init({ + // we init with resources + resources: { + en: { + translations: { + "To get started, edit <1>src/App.js and save to reload.": + "To get started, edit <1>src/App.js and save to reload.", + "Welcome to React": "Welcome to React and react-i18next", + welcome: "Hello
World" + } + }, + de: { + translations: { + "To get started, edit <1>src/App.js and save to reload.": + "Starte in dem du, <1>src/App.js editierst und speicherst.", + "Welcome to React": "Willkommen bei React und react-i18next" + } + } + }, fallbackLng: 'en', debug: true,