Proposed solution for the co-existence of rtl Arabic and ltr English

Started by suikui, May 22, 2005, 11:37:37 AM

Previous topic - Next topic

suikui

Dear Friends,

As I recently worked on a Farsi/Arabic webpage, I came to understand the significant difference between the formation of the left-to-right English/Mandarin and the right-to-left Arabic/Farsi.

As I also am working on the solution to deal with the co-existence of right-to-left Arabic and left-to-right English on my unicode utf-8 SMF forum, here I've got a conceptual proposal in mind and I am posting to see if there's any other better solution?

My proposal is: to add up a BUTTON of "right-to-left Arabic/Farsi" among the existing SMF buttons in the "Start new topic" (such as "Bold", "Italic", ......, "Insert Code", "Insert Quote" , etc.) Therefore, once a submitter needs to use a section of the right-to-left Languages in his whole article in a English environment/browser by default (although the charset of the SMF I've set up is already set as utf-8), he or she can click on the new button of "right-to-left Arabic/Farsi" I mentioned, and then a BBCode-like tag (such as: [ArabicRTL][/ArabicRTL], which is like the tag of inserting "Quotes" or "Codes") will be inserted in order for filling in the Arabic/Farsi characters, and then, he/she can post a whole article which contains both English and Arabic/Farsi characters without fail.

The above proposal is actually from a left-to-right user's "imagination", which may or may not be a good solution for a right-to-left format users. I post it and welcome any of your kind feedbacks! I am very much appreciated if I can find a better solution in my environment: a unicode utf-8 charset SMF, which aims to set up tags to incorporate/accommodate both right-to-left and left-to-right in one post properly.

Thanks in advance for any suggestions!
:)

suikui

I think the above proposal needs to be optimised or complemented by using javascript/DHTML as well, which may change the TEXTAREA's text format simultaneously from the default English ltr to the Arabic rtl by adding up a DIV tag <div dir=rtl> prior to <textarea> -- because it's difficult to type/input rtl Arabic/Farsi characters into a ltr English environment/browser by default, isn't it? (But if you simply input the rtl somewhere else and then copy-and-paste into the above mentioned [ArabicRTL][/ArabicRTL], it might be less complicated, isn't it?)

What do you think?

Saleh

you are right :)
the textarea problem is easily solved by switching direction using the built-in features of the browsers (IE with CTRL+****** and FireFix with "Switch Text Direction") but many unexperinced users wont know that!
the button idea is good but if it can be done with Javascript it would be better IMHO!
textarea has a dir attribute!
I did some tests and this seems to be working great:

<script language="javascript">
function changeDIR(id)
{
   var input   = document.getElementById(id);
   var current = input.attributes['dir'].value;

   if (current == "")
      input.setAttribute('dir', 'rtl');

   if (current == "rtl") {
      input.attributes['dir'].value = "ltr";
      document.getElementById('change').value = "Change to RTL";
   } else if (current == "ltr") {
      input.attributes['dir'].value = "rtl"
      document.getElementById('change').value = "Change to LTR";
   }
}
</script>
<textarea dir="rtl" id="textarea"></textarea><br />
<input type="button" id="change" onclick="changeDIR('textarea');" value="Change to LTR">

so implementing this code would be easy! and I actually might release it as a mod :P
feel free to use it if you want.

as for the BBcode tag, there is already one! it's [ rtl ] [/ rtl ]
and it's working nicely :)

I am RTLed text! :P

We don't need a reason to help people

A.M.A

The text area idea is really nice. I do not think it will be hard to implement.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Advertisement: