Recommended way to handle RTL mixed with LTR languages

Fantastic! I have updated discourse to latest and it is working like a charm.

My first comment would be if you can do something for this button to not toggle entire editor and just toggle current paragraph. That would be great.

I keep an eye on this new feature and let you know about problems.

4 Likes

I would love to support partial ltr/rtl to be visible in the composer but it will require a pretty big change to the composer cause we can no longer use a text area and would have to use a content editable div

So maybe removing that button is better. because at least for my community, it is confusing the ppl. they think that it is that button that decides the direction of text.

another question.

I realized that to change the direction of text, rtl and ltr contents should be separated by two enters. Can you also support correct direction with one enter?

2 Likes

Please ignore this suggestion. It is good when it comes to a full ltr/rtl post.

1 Like

Thanks for the feedback! One of the main reasons for adding the button was to make it easier to add blocks of code on RTL sites.

2 Likes

Is this possible @simon ?

non tech people don’t understand the difference between one and two enters.

I think it is possible, but I’m not sure how efficient it will be. I’ll give it a try.

The easiest non-technical explanation for the difference between one and two enters is that two enters (a blank line) creates a new paragraph. The direction is being set at the paragraph level.

3 Likes

@simon, I found that there is a great performance drop in long topics containing mixed text direction. First I thought its because of rating plugin. However after further examination, I turned off this feature in our forum, and found that everything was back to normal.

4 Likes

We will get this sorted can you post a copy of a long post with that issue so we can have a look

Its not a long post.

its a topic with thousands of posts. here

3 Likes

I’m wondering if the bottleneck is Discourse generating the directional instructions or the browser interpreting them and rendering the display.

Have you compared the efficiency using different browsers?

The topic that you linked to seems to be loading correctly for me. I am using a fairly powerful computer, so that could be the difference. There is a small change that could be made to the code that I’m sure would improve performance, but we would loose support for Internet Explorer.

What browser and operating system are you using?

I am surprised that the number of posts in a topic is making a difference. I’ll look into that.

1 Like

I’m on Ubuntu 16.04 and I tested with Mozilla and Chrome

I also tested with my cellphone now. However surprisingly, the topic opened normally. Now what could be the problem? :thinking:

1 Like

What version? You mean not Edge, so IE11 only? That could be an acceptable tradeoff for many audiences.

There’s no support for dir="auto" in IE11 or Edge.

1 Like

Wow that’s really weird:

https://www.w3.org/International/tests/repo/results/the-dir-attribute-auto

Yes, I was surprised, so I tested it with BrowserStack as well. There is another approach we could take with this to make it more efficient, but we need to be sure there’s a problem first.

After installing discourse from Docker, what settings should I change to reach this?

I think these two :
https://your.domain/admin/site_settings/category/all_results?filter=default%20locale
https://your.domain/admin/site_settings/category/all_results?filter=mixed%20text

then wrapping your text with:

<div dir="rtl">
…
</div>

or

<div dir="ltr">
…
</div>

works

2 Likes