web/translations: add fallback locale name to unnamed locales
This commit is contained in:
parent
d93e97e06b
commit
66479a9791
1 changed files with 5 additions and 1 deletions
|
@ -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<string, string> = _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 }
|
||||
|
|
Loading…
Reference in a new issue