Fix translations

This commit is contained in:
Nikita Karamov 2023-08-30 13:43:09 +02:00
parent 498a515f46
commit e24b89bba7
No known key found for this signature in database
GPG Key ID: 41D6F71EE78E77CD
1 changed files with 4 additions and 1 deletions

View File

@ -48,11 +48,14 @@ export function applyTranslations(language: string) {
continue;
}
const splitTranslated = t(dataset.translate!).split("{}");
let splitTranslated = t(dataset.translate!).split("{}");
if (splitTranslated.length === 1) {
node.innerHTML = t(dataset.translate!);
continue;
}
// XXX: this is needed for the strings where the placholder sits at the very
// beginning, which introduces phantom empty strings.
splitTranslated = splitTranslated.filter((string) => string !== "");
for (const child of node.childNodes) {
if (child.nodeType === Node.TEXT_NODE) {