From 66479a979194719a4cce99bba222432a4566a579 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Mon, 16 Sep 2024 15:13:44 +0000 Subject: [PATCH] web/translations: add fallback locale name to unnamed locales --- web/src/lib/i18n/translations.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/lib/i18n/translations.ts b/web/src/lib/i18n/translations.ts index 24dc3057..9a65c761 100644 --- a/web/src/lib/i18n/translations.ts +++ b/web/src/lib/i18n/translations.ts @@ -7,7 +7,7 @@ import type { LocalizationContent } from '$lib/types/i18n'; -import languages from '$i18n/languages.json'; +import _languages from '$i18n/languages.json'; const locFiles = import.meta.glob('$i18n/*/**/*.json'); const parsedLocfiles: StructuredLocfileInfo = {}; @@ -22,6 +22,8 @@ for (const [path, loader] of Object.entries(locFiles)) { } const defaultLocale = 'en'; +const languages: Record = _languages; + const config: Config<{ value?: string; formats?: string; @@ -30,6 +32,8 @@ const config: Config<{ }> = { fallbackLocale: defaultLocale, translations: Object.keys(parsedLocfiles).reduce((obj, lang) => { + languages[lang] ??= `${lang} (missing name)`; + return { ...obj, [lang]: { languages }