From 492033922ed0d4ae9609eb99399aca022165fe47 Mon Sep 17 00:00:00 2001 From: Simon G Date: Fri, 26 Mar 2021 08:33:09 +0100 Subject: [PATCH] fix(i18n): use explicit supported language --- src/components/Chapters/index.tsx | 2 +- src/components/Chapters/utils.tsx | 2 +- src/i18n.tsx | 7 ++++--- src/translations/{en.json => en-US.json} | 0 4 files changed, 6 insertions(+), 5 deletions(-) rename src/translations/{en.json => en-US.json} (100%) diff --git a/src/components/Chapters/index.tsx b/src/components/Chapters/index.tsx index afc509d..aea3aad 100644 --- a/src/components/Chapters/index.tsx +++ b/src/components/Chapters/index.tsx @@ -1,4 +1,4 @@ -import * as translations from '../../translations/en.json'; +import * as translations from '../../translations/en-US.json'; export type Chapter = Record>; diff --git a/src/components/Chapters/utils.tsx b/src/components/Chapters/utils.tsx index 75b9c4f..cd5c205 100644 --- a/src/components/Chapters/utils.tsx +++ b/src/components/Chapters/utils.tsx @@ -1,5 +1,5 @@ import { CHAPTER_COLOR } from '../../data/chapter/chapter.constants'; -import * as translations from '../../translations/en.json'; +import * as translations from '../../translations/en-US.json'; import { increaseValue, decreaseValue } from '../../utils/format'; import { ChapterId } from '.'; diff --git a/src/i18n.tsx b/src/i18n.tsx index 9f74c51..f7ccb8f 100644 --- a/src/i18n.tsx +++ b/src/i18n.tsx @@ -6,12 +6,12 @@ export const I18N_DEFAULT = 'en'; // Language identifiers as specified by RFC 3066: https://www.i18nguy.com/unicode/language-identifiers.html export const I18N_LANGUAGES_SUPPORTED = [ - { cultureLang: 'en', name: 'English', nativeName: 'English' }, + { cultureLang: 'en-US', name: 'English', nativeName: 'English' }, { cultureLang: 'ta-IN', name: 'Tamil (India)', nativeName: 'தமிழ்' }, ]; const translations = { - en: { translation: require('./translations/en.json') }, + 'en-US': { translation: require('./translations/en-US.json') }, 'ta-IN': { translation: require('./translations/ta-IN.json') }, }; @@ -27,7 +27,8 @@ export default i18n resources: translations, cleanCode: true, debug: false, - fallbackLng: 'en', + supportedLngs: ['en-US', 'ta-IN'], + fallbackLng: 'en-US', interpolation: { escapeValue: false, // not needed for react as it escapes by default }, diff --git a/src/translations/en.json b/src/translations/en-US.json similarity index 100% rename from src/translations/en.json rename to src/translations/en-US.json