Skip to content

High performance self-hosted photo and video management solution.

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

Michel Heusschen79705dc58d3a
diff --git a/web/src/lib/constants.ts b/web/src/lib/constants.ts
index 5de3e3fdd6..225b2fdf4f 100644
--- a/web/src/lib/constants.ts
+++ b/web/src/lib/constants.ts
@@ -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({}) },
];
diff --git a/web/src/lib/i18n.spec.ts b/web/src/lib/i18n.spec.ts
index 43f3a689e9..156dfcb79b 100644
--- a/web/src/lib/i18n.spec.ts
+++ b/web/src/lib/i18n.spec.ts
@@ -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);
+ });
+ }
+ });
});