New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTL Languages Support #6138
RTL Languages Support #6138
Conversation
1- Update TailwindCSS to use the logical properities such as `ps-1` instead of `pl-1`. there are logical properities for margin, padding, inset, and text direction. 2- Install `rtl-detect` detect if the language is RTL direction. Note: this might be uninstalled if we use the manual way to specify rtl language.
instead of directions properties (e.g. `pr-0` to `pe-0`)
instead of directions properties (e.g. `pr-0` to `pe-0`)
instead of directions properties (e.g. `pr-0` to `pe-0`)
instead of directions properties (e.g. `pr-0` to `pe-0`)
…properties." This reverts commit df9620d.
@lunaleaps and @mattcarrollcode, could you please review this? As Arabic users, we have difficulties reading the Arabic docs with LTR directions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me! Just a couple small q's about alt properties and a CSS clarification.
Thanks for doing this work!
Question - is there a lint we can set up to ensure we don't start re-introducing left/right css properties?
Thanks for addressing, looks like just conflicting files and then I can merge! |
Resolved |
Wow this is awesome, thanks a ton for all that went into this! |
This is amazing, thanks 🙏🏻 |
* fix: wronge styles when applying RTL it was `top-0 left-0 ...` by wrong I made it `inset-x-0`. * fix wrong styles * fix wrong styles * style canary icon with RTL-friendly styles * chore: utilize mx-* instead of me-* & ms-* * utilize relative styles * chore: use mx-* instead of me-* & ms-* * style canary icon with RTL-frindly styles * Update OpenInTypeScriptPlayground.tsx
Regarding icons, we can eliminate the For Tailwindcss classes, I have released Note: Up til now, It doesn't detect like We have the option to install and extend it. By configuring What do you think? @lunaleaps @rickhanlonii |
Thanks @A7med3bdulBaset for looking into that! I'm curious if we do still need some left/right properties and how we exclude them from the lint? Otherwise, this looks like a great idea! |
Could you provide an example of left/right properties we need where start/end wouldn't resolve the issue? A: There are NONE. The only places we seem to need them are in the |
This PR addresses right-to-left (RTL) languages styles, directionality, and other relevant adjustments for the React documentation.
Types of changes
tailwindcss
to the latest version to utilize logical properties..isRTL
property to thesiteConfig
object note 1.dir
attribute on the<html>
element to eitherltr
orrtl
based on theisRTL
property.dir
attributes of<InlineCode />
,<CodeBlock />
, and<Sandpack />
asltr
regardless of theisRTL
property.pl-*
,pr-*
,ml-*
, andmr-*
withps-*
,pe-*
,ms-*
, andme-*
.text-left
andtext-right
withtext-start
andtext-end
.left-*
andright-*
withstart-*
andend-*
.rounded-l-*
androunded-r-*
withrounded-s-*
androunded-e-*
.border-l-*
andborder-r-*
withborder-s-*
andborder-e-*
.<IconNavArrow />
,<IconArrow />
,<IconArrowSmall />
, and<IconChevron />
, added two additional values to thedisplayDirection
prop:start
andend
. These values behave differently based on the page direction and should be used instead ofleft
andright
values note 2.Live demo:
See this live demo of the documentation with some Arabic data (from ar.react.dev)
Notes:
Note 1: The `.isRTL` property
We had several options to choose from:
Added a new property to the
siteConfig
object and set it manually for each language.Used language detection like rtl-detect to automatically detect the language direction and set the property.
Note 2: New values for the
displayDirection
prop@gaearon, @rickhanlonii, @acdlite, and React Community, could you please review this PR?