wiziple / gatsby-plugin-intl

Gatsby plugin that turns your website into an internationalization-framework out of the box.
http://gatsby-starter-default-intl.netlify.com
325 stars 178 forks source link

How does React-Intl handle 'Right to Left' Locales? #99

Open vlknhslk opened 4 years ago

vlknhslk commented 4 years ago

e.g. Arabic, it does not align the text to read Right to Left. How can we do this?

jzabala commented 4 years ago

This is how you could do it:

As you can see in the gif the lib sets the lang attribute in the html tag.

Mar-31-2020 15-49-16

So in you css set a selector for the root element and the language that you are targeting and, change the text direction:

:root[lang='en'] {
    direction: rtl;
}