Skip to content

Commit

Permalink
fix(i18n): use explicit supported language
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonGolms committed Mar 26, 2021
1 parent 07f80c7 commit 4920339
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/Chapters/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as translations from '../../translations/en.json';
import * as translations from '../../translations/en-US.json';

export type Chapter = Record<string, Record<string, Section>>;

Expand Down
2 changes: 1 addition & 1 deletion src/components/Chapters/utils.tsx
Original file line number Diff line number Diff line change
@@ -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 '.';

Expand Down
7 changes: 4 additions & 3 deletions src/i18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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') },
};

Expand All @@ -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
},
Expand Down
File renamed without changes.

0 comments on commit 4920339

Please sign in to comment.