Skip to content

Commit

Permalink
try using fallback language for when translation is ""
Browse files Browse the repository at this point in the history
  • Loading branch information
kkuepper committed Jan 8, 2025
1 parent 83a44b2 commit 2685682
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
17 changes: 17 additions & 0 deletions i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
}));
10 changes: 5 additions & 5 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -66,7 +66,7 @@
},
"collection": {
"track-count": "{count} Titel | {count} Titel",
"album-count": "{count} Album | {count} Alben",
"album-count": "",
"resume": "Weiterhören"
},
"login": {
Expand Down Expand Up @@ -144,7 +144,7 @@
"more-info": "Weitere Informationen",
"show-all": "Alle anzeigen",
"remove-from-playlist": "Aus Wiedergabeliste entfernen",
"transcription": "Transkription"
"transcription": ""
},
"a11y": {
"download": "Herunterladen",
Expand Down

0 comments on commit 2685682

Please sign in to comment.