From 2685682f8272c40c8cb7813bf05207967fa53a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ku=CC=88pper?= Date: Wed, 8 Jan 2025 15:04:48 -0500 Subject: [PATCH] try using fallback language for when translation is "" --- i18n.config.ts | 17 +++++++++++++++++ locales/de.json | 10 +++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/i18n.config.ts b/i18n.config.ts index 325b771f..6d70a49b 100644 --- a/i18n.config.ts +++ b/i18n.config.ts @@ -35,4 +35,21 @@ export default defineI18nConfig(() => ({ ro, ru, }, + fallbackRootWithEmptyString: true, + postTranslation: (value, path) => { + if (value === "") { + const parts = path.split("."); + let message = en; + return "empty translation"; + for (const key of parts) { + if (key in message) { + message = message[key]; + } else { + return value; + } + } + return message; + } + return value; + }, })); diff --git a/locales/de.json b/locales/de.json index 67f736c1..97986792 100644 --- a/locales/de.json +++ b/locales/de.json @@ -5,21 +5,21 @@ }, "nav": { "home": "Start", - "browse": "Stöbern", + "browse": "", "playlist": "Playlist", "profile": "Profil", "messages": "Reden", "recent-messages": "Neue Reden", "recent-music": "Neue Musik", "audiobooks": "Hörbücher", - "search": "Suche", + "search": "", "album": "Album", "podcast": "Podcast", "not-found": "Seite nicht gefunden", "contributor": "Mitwirkender", "contributors": "Mitwirkende", "archive": "Archiv", - "transcribe": "Transkribieren", + "transcribe": "", "lyrics": "Liedtext" }, "sidebar": { @@ -66,7 +66,7 @@ }, "collection": { "track-count": "{count} Titel | {count} Titel", - "album-count": "{count} Album | {count} Alben", + "album-count": "", "resume": "Weiterhören" }, "login": { @@ -144,7 +144,7 @@ "more-info": "Weitere Informationen", "show-all": "Alle anzeigen", "remove-from-playlist": "Aus Wiedergabeliste entfernen", - "transcription": "Transkription" + "transcription": "" }, "a11y": { "download": "Herunterladen",