-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add support for RTL scripts #138
Comments
Interesting! RTL is absolutely important. Is there a a use-case for mixing LTR and RTL in a single post or page, though? Would it be enough that the wp-admin was set to an RTL language and so the block editor became RTL entirely as well? |
There are many use cases of LTR in a RTL script (say Persian). For instance: Case 1: A company active in oil & gas industry is listing its products and services as well as its foreign partners. They usually list these items in English (LTR). For instance: شرکت نفت کاو در سال ۱۳۸۴ با هدف ارائه خدمات و کالاهای مورد نیاز صنایع نفت، گاز و پتروشیمی و بویژه پروژههای خطوط لوله و تاسیسات آغاز بکار نمود. این شرکت از همان ابتدا بعنوان نماینده رسمی و انحصاری کارخانجات نورد و پروفیل ساوه عرضه کننده انواع لولهها با استانداردهای ASTM و API فعالیت خود را آغاز نمود و با به دست آوردن رزومهای قابل توجه در زمینه فروش انواع لولهها به شرکتهای نفت، گاز و پتروشیمی و آب و همچنین شرکتهای پیمانکاری فعال در این صنایع بعنوان یکی از شرکتهای پیشرو در ارائه خدمات و کالاها به صنایع نفت و گاز اعم از مصارف جهت سرویسهای ترش و شیرین و صنایع پایین دستی و بالا دستی معرفی میگردد. (Company Introduction) کالاهای قابل تامین: (Products) شیرآلات: (Valves)
شرکای خارجی: (partners)
پمپها: (Valves)
شرکای خارجی: (partners)
Case 2: Consider a university website that includes a section for academic papers. At the end of academic articles, they list their references in two sections: Persian & Latin (LTR). For example: منابع فارسی: (Persian References)
مدارک تهیه شده توسط واحد مهندسی فرآیند عبارتند از:
مکالمه: ل- سلام، نام من لیلا است. س- سلام، من سارا هستم. ... Translation (English) P.S.: As a simple trick, some may try to use tables and left and right alignments (provided by current WordPress default editor / TinyMCE editor) in those tables, but it will not work. e.g.:
|
Wow that is really interesting. Thanks so much for explaining this! |
The block concept perhaps lends itself to approaching this challenge in a new light. For example, do we have RTL and LTR blocks where whatever you put inside them is flipped? Or are LTR and RTL advanced properties that can be toggled for each block? See also #16 |
Let's make sure we remember to add an LTR button when a user has an RTL language. This is what's been done in the past, let's consider that a baseline task. We should add this button as an inline button, as suggested here. |
How about a language switcher as well? |
@yurynix and @ranh given your experience with RTL on WordPress.com, do you have a suggestion what would be the best way to tackle it? I remember that you even worked on auto language direction in Reader (Automattic/wp-calypso#9664). |
Until we have a way to apply styles to an inner element in a block ( nested block? ), So there are 2 issues here:
Both of them needs to be applied to a parent html element, in a block context such as a table, As an intermediary solution, we might want to make it easy for people to insert these special unicode characters:
For more info see here.
This solves the directionality issue, but not the alignment issue. Adding @yoavf as he might have more insights on that. |
This ticket was mentioned in Slack in #core-editor by jeffpaul. View the logs. |
I tried addding these buttons in the formatting toolbar. The problem here is that they work only on multiine RichTexts (quote) and not in single line ones (paragraph), I guess that's because this direction applies to the paragraph level only. So instead of adding it as a formatting toolbar, I wonder if this should be a block level control instead. What do you think? |
The classic editor gets only one button, LTR. It works by changing the text direction (on/off), no need for two buttons there.
Right, the The alternative is to always have the LTR button in the formatting toolbar and apply it either to the whole block or one of the block elements according to the selection (this is how it works in the classic editor). |
We discussed this a bit in WCEU and I think we should be pragmatic. The main way to create content in Gutenberg is using single line blocks (paragraph, headings...), let's try to get the block level support first and we can iterate to see if we add the multi-line support as well. |
A bit late, but chiming in an attempt to add a little bit of clarity to what we need to do, at least in order prevent a usability regression for users with RTL UI. @jasmussen said it right
In the classic editor, when in RTL UI, you get an extra button to your toolbar, in both visual and HTML modes: Visual Editor - the button works on a paragraph level HTML Editor- the button applies to the entire editor For Gutenberg, I'd say that the minimum required would be a similar button on the paragraph block formatting toolbar when UI is RTL.
For reference, Google Sheets has the following buttons on the main toolbar (possibly only for relevant users): Sheet direction button, cell direction buttons |
I use the admin panel in english even if the front end is RTL , switching to RTL would create a mayhem with most of the plugins |
I think this is a good start, that means users who need to show individual paragraphs as LTR can do that. Applying this across paragraphs or blocks would be a nice enhancenement, but can be addressed/ticketed separately. Mockup: @yoavf can you verify if the above approach is sufficient/right for now? |
Yes, LGTM! |
Pull request at #10663 |
…ntCount-hidden-to-components Update GB hash
Just wanted to check on when RTL support is expected for the end users. I am having a hard time writing posts containing English and Arabic. |
As a temporary solution I've added a "rtl-content" class at block level and
|
@aahani i think i came up with a solution via custom block smart-paragraph |
I cannot find the right-to-left button in the new Gutenberg blocks. |
@oussjarrousse Would you mind creating an issue yourself and describe what you're seeing (screenshots, language...) and on which blocks? Thanks. |
@youknowriad @oussjarrousse this comment on 10663 talks about the problem. I am using a en_US system, but need to be able to write Arabic and Hebrew, so RTL, but cannot find any button to do this.. or any reference online to the right way to get it. should this issue actually be closed? |
@dirad I believe this issue matched the behavior in the classic editor: show the button when using an RTL locale but I can see the value for non-RTL languages too. Please do create an issue for it to discuss how it can be more globally made visible. |
@yoavf I am looking for a solution for this issue and I see that even after 2-3 years I can't find a proper solution. |
Have been waiting for the solution since Gutenberg launched. |
Oh, but it is needed: A single button is therefore ambiguous. When 2 buttons are shown, the user gets clear unambiguous indication of the current direction, A separate UI for wordpress alianates end users. |
I propose adding LTR, RTL (Left to right, Right to left) direction functionality to blocks. It is useful for RTL scripts (Persian, Pashto, Arabic, Hebrew).
It is supported by TinyMCE: https://www.tinymce.com/docs/plugins/directionality/ as shown here:
It can be a toggling button (Default LTR, toggle to RTL) before trash.
The text was updated successfully, but these errors were encountered: