Uh oh!
There was an error while loading. Please reload this page.
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.
AhmedBaset
commented
Aug 9, 2023
@lunaleaps and @mattcarrollcode, could you please review this? As Arabic users, we have difficulties reading the Arabic docs with LTR directions. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lunaleaps
left a comment
There was a problem hiding this comment.
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?
lunaleaps
commented
Aug 11, 2023
Thanks for addressing, looks like just conflicting files and then I can merge! |
AhmedBaset
commented
Aug 11, 2023
Resolved |
rickhanlonii
commented
Aug 11, 2023
Wow this is awesome, thanks a ton for all that went into this! |
Nabeel20
commented
Aug 12, 2023
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
AhmedBaset
commented
Aug 28, 2023
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 |
lunaleaps
commented
Aug 29, 2023
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! |
AhmedBaset
commented
Aug 29, 2023
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
tailwindcssto the latest version to utilize logical properties..isRTLproperty to thesiteConfigobject note 1.dirattribute on the<html>element to eitherltrorrtlbased on theisRTLproperty.dirattributes of<InlineCode />,<CodeBlock />, and<Sandpack />asltrregardless of theisRTLproperty.pl-*,pr-*,ml-*, andmr-*withps-*,pe-*,ms-*, andme-*.text-leftandtext-rightwithtext-startandtext-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 thedisplayDirectionprop:startandend. These values behave differently based on the page direction and should be used instead ofleftandrightvalues 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
siteConfigobject 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
displayDirectionprop@gaearon, @rickhanlonii, @acdlite, and React Community, could you please review this PR?