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

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) {