I need to set the direction for the selected language.
If it's RTL, I need to set <html dir='rtl'>, otherwise <html dir='ltr'>.
The selected language comes in a cookie in the HTTP Request.
How can I do that in Vite?
I need to set the direction for the selected language.
If it's RTL, I need to set <html dir='rtl'>, otherwise <html dir='ltr'>.
The selected language comes in a cookie in the HTTP Request.
How can I do that in Vite?
You can query the document for the <html>, and set its dir attribute:
const setHtmlLangDir = () => {
const dir = /* direction of lang from cookie */
document.querySelector('html').setAttribute('dir', dir);
}