Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use fallback language for when translation is empty #548

Merged
merged 5 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
kkuepper marked this conversation as resolved.
Show resolved Hide resolved
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
Loading