www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - RTL language support for Dlang Tour

reply Mir H. S. Quadri <quadrishah846 gmail.com> writes:
Hi,

I have started the work of translating the tour.dlang.org website 
to Urdu. Languages such as Arabic/Urdu/Farsi/Hebrew are written 
from Right-To-Left (RTL). The problem that I am facing is that 
the content to translate is written in markdown which is being 
rendered into html on the website.

Now in order to translate the content to Urdu, I am having to add 
an extra "<p dir="rtl"></p>" tag for every new paragraph which is 
an inefficient way to do things.

Is there a way that I can add a script that makes the website 
detect if a given language is RTL and automatically render the 
page to RTL?

Also, is there any shortcut in markdown for this that I am 
missing? I did my research and couldn't find any efficient 
solution. Any guidance would be much appreciated.
Feb 08 2020
parent reply Alexandru Ermicioi <alexandru.ermicioi gmail.com> writes:
On Sunday, 9 February 2020 at 07:02:13 UTC, Mir H. S. Quadri 
wrote:
 Hi,

 I have started the work of translating the tour.dlang.org 
 website to Urdu. Languages such as Arabic/Urdu/Farsi/Hebrew are 
 written from Right-To-Left (RTL). The problem that I am facing 
 is that the content to translate is written in markdown which 
 is being rendered into html on the website.

 Now in order to translate the content to Urdu, I am having to 
 add an extra "<p dir="rtl"></p>" tag for every new paragraph 
 which is an inefficient way to do things.

 Is there a way that I can add a script that makes the website 
 detect if a given language is RTL and automatically render the 
 page to RTL?

 Also, is there any shortcut in markdown for this that I am 
 missing? I did my research and couldn't find any efficient 
 solution. Any guidance would be much appreciated.
Hi, Not sure if markdown has such support in spec itself. However you may try add unicode rtl mark to rtl text according to https://en.m.wikipedia.org/wiki/Right-to-left_mark . Browsers should properly interpret this mark and show text in rtl format (needs confirmation). Best regards, Alexandru.
Feb 09 2020
parent Mir H. S. Quadri <quadrishah846 gmail.com> writes:
On Sunday, 9 February 2020 at 09:49:16 UTC, Alexandru Ermicioi 
wrote:
 On Sunday, 9 February 2020 at 07:02:13 UTC, Mir H. S. Quadri 
 wrote:
 [...]
Hi, Not sure if markdown has such support in spec itself. However you may try add unicode rtl mark to rtl text according to https://en.m.wikipedia.org/wiki/Right-to-left_mark . Browsers should properly interpret this mark and show text in rtl format (needs confirmation). Best regards, Alexandru.
Hi, Thanks for the link. I will look into it. So far as my research goes, there is no built in solution in md for this.
Feb 09 2020