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}
|
selected={k === initialLanguage}
|
||||||
value={k}
|
value={k}
|
||||||
>
|
>
|
||||||
{v}
|
{v.autonym}
|
||||||
</option>
|
</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";
|
import ru from "./translations/ru.json";
|
||||||
|
|
||||||
export const languages = {
|
export const languages = {
|
||||||
en: "English",
|
en: { autonym: "English", dir: "ltr" },
|
||||||
de: "Deutsch",
|
de: { autonym: "Deutsch", dir: "ltr" },
|
||||||
es: "Español",
|
es: { autonym: "Español", dir: "ltr" },
|
||||||
fr: "Français",
|
fr: { autonym: "Français", dir: "ltr" },
|
||||||
nl: "Nederlands",
|
nl: { autonym: "Nederlands", dir: "ltr" },
|
||||||
ru: "Русский",
|
ru: { autonym: "Русский", dir: "ltr" },
|
||||||
};
|
};
|
||||||
|
|
||||||
export const strings: Record<keyof typeof languages, Record<string, string>> = {
|
export const strings: Record<keyof typeof languages, Record<string, string>> = {
|
||||||
|
|
Reference in a new issue