-
-
Notifications
You must be signed in to change notification settings - Fork 823
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 Support via Logical CSS Properties #191
Comments
This is something I'd love to get right, but I have zero experience with RTL languages. If someone wants to provide guidance, I'd love to make a reasonable effort to accommodate. |
I'm not that good with shoelace yet. I have not dived into its core yet. But I'm really hoping for this project to grow. Its neet. |
I managed to analyse the code your code is so elegant. It should not be difficult to have an RTL version. However. I never programed with ts. Please let me know what's the procedure... |
It might be good to start off explaining what needs to be done, before jumping into any code. For example, how is RTL configured? There’s a Looks like there’s also a I’d prefer to keep it simple and ensure we’re using native APIs as much as possible rather than introduce our own. |
Well, simply there are few steps involved
Will change to
This part will change the whole doc onto rtl including flex, grid, text direction,
Generally the issue with rtl is when the coder code specific alignments such as text align left and right I'm not sure yet. But I think a simple css file to overwrite some of the original css. Again I have not coded in ts before so I'm not sure... |
I will show you a sample from your code.
as above this is the only line needs to be modified from the whole component. so again im not familiar with TS but my humble suggestion would be it could a simple switcher and i could provide you with the list of things that need to be modified for you to analyze, hopefully will benefits you to come up with modular solution. I think its easy for you. God Bless. the html opening html lang="xx" dir="rtl" handles the conversion of almost all the html and css except the rules that are set explicitly by the developer like the example above. however, keep in mind this is not necessary everywhere like in tooltip component does not need to be modified. |
In modern css you could use https://css-tricks.com/building-multi-directional-layouts/ |
Edited: Added screen shots interesting point @staabm . thanks. but based on the same article logical properties we could use the supported way till the logical properties are fully supported for example to change the alert component to RTL i added this code
so when the user change his language from the doc type the browser will automatically use this properties. so there could be one of these as a solution
for option 1 it can be maintained by external developers and point users to it and maintained separately and till the new CSS features are implemented logical properties . However, there will be times where the extension RTL is always late, that's the case with Bootstrap RTL. and the core developers need to keep in mind when designing new components try not to over use margin-left and right, padding-left and right, and text-align:left and right (the current use of right and left is minimum in the current code which makes it so easy to implement RTL support). the rest will be pretty easy to implement. for option 2 the developers who are helping with the Shoelace core development have to work extra to make sure it works for both directions which presents a possibility of higher chances of bugs (many of the developers never had long experience with RTL). My humble suggestion would be |
I never said someone should use inline styles. the property mentioned can be defined like any other css property. I don't have opinions on this one - just wanted to share the modern way to solve this problem - which I learned about a few weeks ago. feel free to solve it in the way you like most |
My apologies i miss understood you.
your links led me to find a possible solution. thank you @staabm |
@edit: Sorry I haven't seen the reply from @staabm Hi I have some insights, because I'm working on a Design System at my workplace. We changed from Same for So we're relying on the browser to make the decision for us. |
Should we change the issue title, to support css logical properties? I have a lot of experience with RTL, but fixing it with dir + margin-left/right is the old way. Now that all modern browsers support CSS logical properties it's the way to go, and would support any language / flow direction. https://elad.medium.com/new-css-logical-properties-bc6945311ce7 |
I think logical properties are the right solution, but most people will be looking for RTL so I've update the title to reflect both. Any help to accomplish this would be greatly appreciated. My current focus is on the new website, #413, and #520. As a non-RTL user, how can I test for proper RTL implementations? Any suggestions here? |
@claviska To test RTL (even with English content), this seems simple and useful - |
I also have a small Shoelace application that is available in Hebrew and is suffering from RTL layout issues. It could happily serve as a proofing ground for any RTL changes being tested :D |
Yes, localization is on my list for Doxicity. There’s not much to do to get it there, just need some time to tackle it. Probably through a config option. |
@claviska |
Is your feature request related to a problem? Please describe.
Internationalization and the adaptation of UTF-8 became a necessity for Multilanguage apps.
a support for RTL in shoelace in its early stage in development will be great added advantage for developers.
Describe the solution you'd like
is it possible to put it under consideration while the project still in its alpha. As RTL support is lacked from many frameworks including Bootstrap.
Describe alternatives you've considered
using custom css on top of shoelace.
please consider this site https://rtlcss.com/playground/
The text was updated successfully, but these errors were encountered: