Skip to content

Commit

Permalink
Add i18n support for new languages (#35)
Browse files Browse the repository at this point in the history
Add i18n support for:
 * hi-IN
 * da-DK

Signed-off-by: Catalin Ghenea <gcatalin@google.com>
  • Loading branch information
gmaniak committed May 15, 2023
1 parent 2a516ce commit 717c6b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const multipleLanguages = {
'nb-NO': {
msg1: 'This is a Norwegian (Bokmål) message',
},
'hi-IN': {
msg1: 'This is a Indian (Hindi) message',
},
'da-DK': {
msg1: 'This is a Danish message',
},
};

const defaultLanguage = {
Expand Down Expand Up @@ -118,6 +124,8 @@ describe('gettext', () => {
['pl-PL', 'pl-PL', 'Polish'],
['cs-CZ', 'cs-CZ', 'Czech'],
['en-NO', 'nb-NO', 'Norwegian (Bokmål)'],
['en-IN', 'hi-IN', 'Indian (Hindi)'],
['da-DK', 'da-DK', 'Danish'],
])('maps %s to %s', (from, to, expectedMessage) =>
expect(gettextFactory(multipleLanguages, from)('msg1')).toBe(
`This is a ${expectedMessage} message`,
Expand Down
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function mapToDeviceSupportedLocale(tag: string) {
if (tag === 'en-SE') return 'sv-SE';
if (tag === 'en-NL') return 'nl-NL';
if (tag === 'en-NO') return 'nb-NO';
if (tag === 'en-IN') return 'hi-IN';

// For iOS
if (tag === 'zh-Hant') return 'zh-TW';
Expand Down

0 comments on commit 717c6b6

Please sign in to comment.