cms
cms copied to clipboard
[4.x] add rtl styles for control panel
This PR will add rtl styles for RTL languages like Arabic, Persian, Hebrew...
Amazing. We were about to do this ourselves.
Dude!

You're welcome 🤗. I like Statamic and would suggest it to whole world in any language and any region...

Make me think about at least one fieldtype (range) where you can prepend and append a text and I think RTL language can have a hard time with this, doesn't it?
Maybe the translation can be changed if it's a RTL language. e.g. instead of saying beginning (left-side) it would be translated to beginning (right-side).
Hey @peimn why did slug fields need to be ltr?
@jasonvarga It is common for slugs to be written in Latin words, and we prefer to write it in Latin words as non-Latin writers. It is easy to remember and write. Furthermore, Statamic itself converts non-latin words to Latin. Therefore, I decided to make it a ltr.
Okay I will leave it how you had it then. Thanks!
I've made a change to how the text direction of the CP is decided.
You had it so that it depends on the selected site. I've changed it so that it's based on the configured locale or preference. If you have configured a language that should be RTL (like Arabic or Hebrew), it will be RTL.
Similar to #9452, I didn't feel it was right that the whole control panel changed depending on what site you were targeting. If I speak one language, and I've set my preference to a specific language, I don't want the whole CP to change.
However I do think it's a good idea to change the direction of the fields inside the publish forms when you're editing an entry in a specific site. This behavior is consistent with how Craft CMS works, and they do a great job with localization and RTL support. See in this screenshot, everything is in English/LTR (my preferred language) except the field (I only configured one) which is RTL because the current entry is Arabic.
We can adjust that behavior in another PR though. There's so much in this one already. (It's fantastic!)
I haven't work with Craft CMS though I get the idea from your words. in #9452 we first had a look for prefered language and if user hadn't set any then switch would be done. But you are right, if we could apply language prefered direction to input fields and editors, it will suit to user needs.
@peimn Do you have translation files for Persian?
Everything seems to be ready to merge but I'm just curious what you are actually using since we don't include any RTL languages.
@jasonvarga yes I've, and I was waiting for this request to be merged then request to merge Persian language. I will send it in a minute.
@jasonvarga #9707 now has Persian translation. Sorry it took a time.