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
2 changed files with 15 additions and 2 deletions

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);
});
}
});
});