Set direction of text depending on text itself

Facebook has it !

When Writing with an RTL language the ticker goes to the other way which gives a very intuitive experience.

I need this for my community because we are bilingual.
Thanks Discourse … Love

6 „Gefällt mir“

@codinghorror, Hi Jeff, do you think this is something we can have in the short term ?

Have a look at an old topic here about RTL support.

https://meta.discourse.org/t/rtl-support/1784

There is a library that automatically sets the direction of each paragraph based on the content.

https://github.com/hasenj/bidiweb

1 „Gefällt mir“

Sure, submit a pull request with the work if you want it. This is how open source works.

Is there any update for this feature? I desperately need it.

Even if there is a button to change direction of text, when we write english/arabic/persian, would be great.

I just added pr-welcome on this, hopefully a bilingual developer looking for a contribution will look at this one day.

1 „Gefällt mir“

I just found that there is an html5 tag dir=auto that simply works in most situations.

For example I wrote this html

<html>
<body>

<p dir="auto">Write this جمله چپ به راست text left-to-right!</p>

<p dir="auto">این RTL sentence  جمله را از راست به چپ بنویس</p>

</body>
</html>

And pasted it in a simple html editor and it works perfectly fine

Could we use the same thing in discourse @sam?

btw I tried dir="auto" with firebug on <p> tags in discourse. However it didn’t do anything. I don’t know why.

1 „Gefällt mir“

Jahre später ist dies immer noch ein Problem. Selbst wenn ein Beitrag vollständig in einer RTL-Sprache verfasst ist, wird er nicht automatisch ausgerichtet.

Screenshot_20251114_122348
(Dies ist der Editor, aber die Vorschau auf der rechten Seite ist eine genaue Darstellung des Endergebnisses)
Die einzige funktionierende Lösung ist das Hinzufügen von \u003cdiv dir=\"auto\"\u003e-Tags. Wie @hnaseri bemerkte, funktioniert \u003cp\u003e nicht, nur \u003cdir\u003e funktioniert.
Screenshot_20251114_122656
Screenshot_20251114_122429

Ich muss ehrlich sein, das ist ziemlich erbärmlich. Sicherlich gibt es eine bessere Möglichkeit, als Benutzer zu zwingen, \u003cdiv dir=\"auto\"\u003e hinzuzufügen. Tatsächlich ist es keine gute Lösung, denn wenn Sie Ihr Div nur öffnen, aber nicht schließen, wird der Rest des Textes in die Richtung der allerersten Zeile gezwungen, anstatt absatzweise. Das Hinzufügen eines weiteren \u003cdiv dir=\"auto\"\u003e vor jedem Absatz ist keine wirkliche Lösung.
Screenshot_20251114_122937
Screenshot_20251114_122959

image

Ich möchte nur bestätigen, dass dies ein Problem speziell in englischen Foren ist, wo Sie gelegentlich auf Hebräisch posten? (Orte mit gemischter Sprache)

Denn unter der hebräischen Locale scheint alles in Ordnung zu sein

Eine Sache, die hier helfen könnte, ist:

image

Mit diesem aktivierten Button in der Symbolleiste ist es hier weitaus einfacher zu helfen. Um ihn zu aktivieren, würden Sie die Einstellung support mixed text direction aktivieren.