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개의 좋아요

@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개의 좋아요

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개의 좋아요

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개의 좋아요

수년이 지났지만 여전히 이 문제가 남아 있습니다. 게시물이 완전히 RTL(오른쪽에서 왼쪽으로 읽는) 언어로 작성되어도 자동으로 정렬되지 않습니다.


(이것은 에디터 화면이며, 오른쪽의 미리보기는 최종 결과물을 정확히 보여줍니다)
유일하게 작동하는 해결책은 <div dir="auto"> 태그를 추가하는 것입니다. @hnaseri가 지적했듯이 <p> 태그는 작동하지 않으며, <dir> 태그만 작동합니다.

솔직히 말해, 이것은 매우 실망스럽습니다. 사용자가 <div dir="auto"> 태그를 추가하도록 요구하는 것보다 더 나은 방법이 분명 있을 것입니다. 사실 이는 충분한 해결책이 아닙니다. 왜냐하면 div를 열기만 하고 닫지 않으면 나머지 텍스트가 단락별로 정렬되는 대신, 첫 번째 줄의 방향으로 강제로 정렬되기 때문입니다. 모든 단락 앞에 <div dir="auto"> 태그를 추가해야 한다는 것은 진정한 해결책이라고 보기 어렵습니다.


이 문제가 영어 포럼에서 가끔 히브리어로 게시물을 작성할 때 발생하는 것인지 확인하려고 합니다. (혼합 언어 환경)

히브리어 로케일에서는 모든 것이 정상으로 보입니다.

여기서 도움이 될 수 있는 한 가지는 다음과 같습니다:

도구 모음에서 이 버튼을 활성화하면 훨씬 유용합니다. 활성화하려면 혼합 텍스트 방향 지원 설정을 켜면 됩니다.