From c1d5b5cbb7771c68f32bc0c48352f26d1553ba8a Mon Sep 17 00:00:00 2001 From: Songyi Huang Date: Tue, 25 May 2021 23:21:32 -0700 Subject: [PATCH] restructure translation files --- src/App.js | 1 - src/i18n.js | 22 ++++------------------ src/locales/en/translation.json | 9 +++++++++ src/locales/zh/translation.json | 9 +++++++++ 4 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 src/locales/en/translation.json create mode 100644 src/locales/zh/translation.json diff --git a/src/App.js b/src/App.js index c21b753..6816f58 100644 --- a/src/App.js +++ b/src/App.js @@ -21,7 +21,6 @@ function App() {
- {t('wdnmd')} {/* */} diff --git a/src/i18n.js b/src/i18n.js index ab887c0..413992a 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,31 +1,17 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; +import translationEN from './locales/en/translation.json'; +import translationZH from './locales/zh/translation.json'; // the translations // (tip move them in a JSON file and import them, // or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui) const resources = { en: { - translation: { - doudizhu: { - ai_hand_faceup: 'AI Hand Face-Up', - play_as_landlord: 'Play As Landlord', - play_as_peasant: 'Play As Peasant', - landlord_up: 'Landlord Up', - landlord_down: 'Landlord Down', - }, - }, + translation: translationEN, }, zh: { - translation: { - doudizhu: { - ai_hand_faceup: '显示AI手牌', - play_as_landlord: '扮演地主', - play_as_peasant: '扮演农民', - landlord_up: '地主上家', - landlord_down: '地主下家', - }, - }, + translation: translationZH, }, }; diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json new file mode 100644 index 0000000..cdf3767 --- /dev/null +++ b/src/locales/en/translation.json @@ -0,0 +1,9 @@ +{ + "doudizhu": { + "ai_hand_faceup": "AI Hand Face-Up", + "play_as_landlord": "Play As Landlord", + "play_as_peasant": "Play As Peasant", + "landlord_up": "Landlord Up", + "landlord_down": "Landlord Down" + } +} diff --git a/src/locales/zh/translation.json b/src/locales/zh/translation.json new file mode 100644 index 0000000..49b4700 --- /dev/null +++ b/src/locales/zh/translation.json @@ -0,0 +1,9 @@ +{ + "doudizhu": { + "ai_hand_faceup": "显示AI手牌", + "play_as_landlord": "扮演地主", + "play_as_peasant": "扮演农民", + "landlord_up": "地主上家", + "landlord_down": "地主下家" + } +}