1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 11:24:37 +02:00

fix(web): language selector for chinese and norwegian (#10107)

* fix(web): language selector for chinese and norwegian

* add unit test

* formatter

* undo name change
This commit is contained in:
Michel Heusschen 2024-06-11 11:07:42 +02:00 committed by GitHub
parent 71a132b0b8
commit 79705dc58d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View File

@ -265,7 +265,7 @@ export const langs = [
{ name: 'Lithuanian', code: 'lt', loader: () => import('$lib/i18n/lt.json') },
{ name: 'Latvian', code: 'lv', loader: () => import('$lib/i18n/lv.json') },
{ name: 'Mongolian', code: 'mn', loader: () => import('$lib/i18n/mn.json') },
{ name: 'Norwegian Bokmål', code: 'nb_NO', loader: () => import('$lib/i18n/nb_NO.json') },
{ name: 'Norwegian Bokmål', code: 'nb-NO', loader: () => import('$lib/i18n/nb_NO.json') },
{ name: 'Dutch', code: 'nl', loader: () => import('$lib/i18n/nl.json') },
{ name: 'Polish', code: 'pl', loader: () => import('$lib/i18n/pl.json') },
{ name: 'Portuguese', code: 'pt', loader: () => import('$lib/i18n/pt.json') },
@ -278,6 +278,6 @@ 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 (Simplified)', code: 'zh_SIMPLIFIED', loader: () => import('$lib/i18n/zh_SIMPLIFIED.json') },
{ name: 'Chinese (Simplified)', code: 'zh-Hans', loader: () => import('$lib/i18n/zh_SIMPLIFIED.json') },
{ name: 'Development (keys only)', code: 'dev', loader: () => Promise.resolve({}) },
];

View File

@ -1,3 +1,4 @@
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';
@ -30,4 +31,16 @@ 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);
});
}
});
});