Add support for script direction
This commit is contained in:
parent
0806678b5a
commit
fc617ff4f5
3 changed files with 11 additions and 7 deletions
|
@ -24,7 +24,7 @@ const initialLanguage = "en";
|
|||
selected={k === initialLanguage}
|
||||
value={k}
|
||||
>
|
||||
{v}
|
||||
{v.autonym}
|
||||
</option>
|
||||
);
|
||||
})
|
||||
|
|
|
@ -71,4 +71,8 @@ export function applyTranslations(language: string) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.documentElement.lang = language;
|
||||
document.documentElement.dir =
|
||||
languages[language as keyof typeof languages].dir;
|
||||
}
|
||||
|
|
|
@ -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>> = {
|
||||
|
|
Reference in a new issue