Skip to content

Commit

Permalink
fix(i18n): replace local language (en-US with en) for better language…
Browse files Browse the repository at this point in the history
… support and detection
  • Loading branch information
SimonGolms committed May 13, 2021
1 parent 497a31a commit b7683ca
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/i18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export const I18N_DEFAULT = 'en-US';

// Language identifiers as specified by RFC 3066: https://www.i18nguy.com/unicode/language-identifiers.html
export const I18N_LANGUAGES_SUPPORTED = [
{ cultureLang: 'en-US', name: 'English', nativeName: 'English' },
{ cultureLang: 'ta-IN', name: 'Tamil (India)', nativeName: 'தமிழ்' },
{ cultureLang: 'en', name: 'English', nativeName: 'English' },
];

// const translations = {
Expand All @@ -17,7 +16,7 @@ export const I18N_LANGUAGES_SUPPORTED = [
// };

export const resources = {
'en-US': enUS,
en: enUS,
};

export default i18n
Expand All @@ -34,10 +33,14 @@ export default i18n
cleanCode: true,
debug: false,
ns: Object.keys(enUS),
supportedLngs: ['en-US', 'ta-IN'],
fallbackLng: 'en-US',
supportedLngs: ['en'],
fallbackLng: 'en',
defaultNS: 'app',
lng: 'en-US',
detection: {
// Took me some time to realize that the fallback language also depends on the detection order.
// Just keep it simple and don't use storage, etc.
order: ['navigator'],
},
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
},
Expand Down

0 comments on commit b7683ca

Please sign in to comment.