Add support for script direction

This commit is contained in:
Nikita Karamov 2024-01-20 16:23:26 +01:00
parent 0806678b5a
commit fc617ff4f5
No known key found for this signature in database
GPG key ID: 41D6F71EE78E77CD
3 changed files with 11 additions and 7 deletions

View file

@ -24,7 +24,7 @@ const initialLanguage = "en";
selected={k === initialLanguage}
value={k}
>
{v}
{v.autonym}
</option>
);
})

View file

@ -71,4 +71,8 @@ export function applyTranslations(language: string) {
}
}
}
document.documentElement.lang = language;
document.documentElement.dir =
languages[language as keyof typeof languages].dir;
}

View file

@ -14,12 +14,12 @@ import nl from "./translations/nl.json";
import ru from "./translations/ru.json";
export const languages = {
en: "English",
de: "Deutsch",
es: "Español",
fr: "Français",
nl: "Nederlands",
ru: "Русский",
en: { autonym: "English", dir: "ltr" },
de: { autonym: "Deutsch", dir: "ltr" },
es: { autonym: "Español", dir: "ltr" },
fr: { autonym: "Français", dir: "ltr" },
nl: { autonym: "Nederlands", dir: "ltr" },
ru: { autonym: "Русский", dir: "ltr" },
};
export const strings: Record<keyof typeof languages, Record<string, string>> = {