Please add BBcode for RTL in version 2.5 (General)

by shian ⌂ @, Monday, March 02, 2020, 10:35 (89 days ago)

hi,

Just like the "code" BBcode, please add an optional "RTL" BBcode for Right-to-Left languages, for example:

in-line rtl:
<span dir="rtl">טקסט בעברית</span>

block rtl:
<div dir="rtl">
טקסט בעברית
</div>

This is very essential for writing in Right-to-Left languages.

An example for RTL text (here I must use a 'page' for adding the dir="rtl" in HTML):
https://www.rapideuphoria311.com/forum/index.php?mode=page&id=10

Thank you for this great forum,
shian.

Avatar

Please add BBcode for RTL in version 2.5

by Auge ⌂ @, Tuesday, March 03, 2020, 09:25 (89 days ago) @ shian

Hello

Just like the "code" BBcode, please add an optional "RTL" BBcode for Right-to-Left languages

This is very essential for writing in Right-to-Left languages.

Is your forum working in a genuine RTL environment (i.e. as shown for Hebrew or Arabic) or in an LTR environment with a few RTL writings?

In the first case you can alter the main template and set <html dir="rtl"> for the whole document. For the second case your proposal is comprehensible but not complete. The script also has to be aware of RTL main language of the forum page and LTR writings within it.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Please add BBcode for RTL in version 2.5

by shian ⌂ @, Tuesday, March 03, 2020, 10:35 (88 days ago) @ Auge
edited by shian, Tuesday, March 03, 2020, 10:41

Is your forum working in a genuine RTL environment (i.e. as shown for Hebrew or Arabic) or in an LTR environment with a few RTL writings?

My forum is working in LTR environment. I've only added a 'Category' for Hebrew readers, and for this specific category I really need the RTL BBcode feature; as well as for adding some Hebrew text inside English posts.

In the first case you can alter the main template and set <html dir="rtl"> for the whole document. For the second case your proposal is comprehensible but not complete. The script also has to be aware of RTL main language of the forum page and LTR writings within it.

To be honest, <div dir="rtl"> & <span dir="rtl"> is more then enough. It works perfectly inside LTR documents as we can see in the example:
https://www.rapideuphoria311.com/forum/index.php?mode=page&id=10

I do not need RTL environment such as:

 
<!DOCTYPE html>
<html lang="he">
<body dir="rtl">
etc.
 


since the main forum language is English.

The main reason for using dir="rtl" is to be able to add Latin letters inside RTL text - without scrambling the entire sentence (which is currently the obvious case).

There is no need for "perfect" support for RTL languages, as far as I concerned.

I don't know what it means from the PHP and CSS perspective of the forum, but it worth doing a little test I guess.

Thank you,
Please let me know if I can help somehow.
Shian.

Edit:
this is an example for a Hebrew post, where I really need a BBcode for RTL:
https://www.rapideuphoria311.com/forum/index.php?id=73

Avatar

Please add BBcode for RTL in version 2.5

by Auge ⌂ @, Tuesday, March 03, 2020, 10:59 (88 days ago) @ shian

Hello

Is your forum working in a genuine RTL environment (i.e. as shown for Hebrew or Arabic) or in an LTR environment with a few RTL writings?


My forum is working in LTR environment. I've only added a 'Category' for Hebrew readers, and for this specific category I really need the RTL BBcode feature; as well as for adding some Hebrew text inside English posts.

Ok.

There is no need for "perfect" support for RTL languages, as far as I concerned.

There is no need for it for your personal case. But we develop the forum not only for your case and if the feature exists, it has to work everywhere in every scenario.

As addition because of my suggestion to set the writing direction for the wohle page in <html>. This is not necessary because the forum script does it by itself with the value of dir from the language file (linked example from the tamil language file and the line of the main template to place the value in).

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Please add BBcode for RTL in version 2.5

by shian ⌂ @, Tuesday, March 03, 2020, 17:40 (88 days ago) @ Auge

As addition because of my suggestion to set the writing direction for the wohle page in <html>. This is not necessary because the forum script does it by itself with the value of dir from the language file (linked example from the tamil language file and the line of the main template to place the value in).

Sorry, I did not understand your suggestion: are you suggesting to switch the entire forum to RTL direction?

As an Hebrew (RTL) writer I'm only aware of two scenarios in HTML:

(1) Switching the entire page to RTL using <html> or <body> tags.
(2) Switching specific blocks of text to RTL using <div>, <p>, <span>, or other tags.

method (2) is occasionally required by anyone that needs to insert RTL text into LTR page. It is a very common scenario. It can only be implemented as a BBcode feature.

Surely I wasn't asking to implement this feature for my own sake :-), anyone who uses RTL language can tell...

Avatar

Please add BBcode for RTL in version 2.5

by Auge ⌂ @, Tuesday, March 03, 2020, 19:07 (88 days ago) @ shian

Hello

As addition because of my suggestion to set the writing direction for the wohle page in <html>. This is not necessary because the forum script does it by itself with the value of dir from the language file (linked example from the tamil language file and the line of the main template to place the value in).


Sorry, I did not understand your suggestion: are you suggesting to switch the entire forum to RTL direction?

No, I didn't. I said, that my proposal in this forum entry to do it is obsolete because the forum script does it by itself, if and when the information is provided in the langauge file.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

Please add BBcode for RTL in version 2.5

by shian ⌂, Tuesday, March 03, 2020, 21:10 (88 days ago) @ Auge
edited by shian, Tuesday, March 03, 2020, 21:26

Sorry, I did not understand your suggestion: are you suggesting to switch the entire forum to RTL direction?


No, I didn't. I said, that my proposal in this forum entry to do it is obsolete because the forum script does it by itself, if and when the information is provided in the langauge file.

OK.

I took a screenshot from Gmail as an example:
[image]

As you can see, Gmail offers two types of paragraphs:

 
<p dir="ltr">
<p dir="rtl">
 

Well, maybe Gmail is just using alignment, yet it actually works perfectly as if Gmail is using direction. (I don't know how).

Anyway, this feature is fundamental.

Without this feature it is impossible for RTL users to add Wikipedia entries, write in social media, etc. It's really fundamental - yet missing in lots of forum systems, probably due to unawareness.

In RTL direction you can mix Right-to-left text with Left-to-right text without any issues.

--
Everyone knows the truth about himself, except the fool who considers himself wise.

Avatar

Please add BBcode for RTL in version 2.5

by shian ⌂, Wednesday, March 04, 2020, 18:19 (87 days ago) @ Auge

Just to be complete, since some forums are in LTR direction while others are in RTL direction, the correct implementation must consider both cases, so that:

1) If the forum is in LTR direction and one wants to insert RTL text, we need:

<p dir="rtl"> ... </p>

2) If the forum is in RTL direction and one wants to insert LTR text, we need:

<p dir="ltr"> ... </p>

This way we cover all scenarios.


Honestly "my little forum" is really better then other forums I've used, including the most popular PHP forums; Yet most forums don't have the direction feature (that's one of the main reasons that I found "my little forum", since I was looking for a practical forum that also supports direction through BBcode).
What I mean is that adding this feature is another big advantage over many other forums.

For example, if I want to teach programming in Hebrew, then most of the text will be in English (LTR) of course, only some explanation will be in Hebrew (RTL).
Without the direction feature it is literally impossible - the text will turn into gibberish;
Look, the following sentence is completely out of order in LTR direction, i.e. it is displayed in reverse:

הפונקציה floor() מקבלת ארגומנט אחד: atom או sequence.

This is why we need the direction feature.


Thank you, shian.


Reference: https://www.w3schools.com/tags/att_global_dir.asp

--
Everyone knows the truth about himself, except the fool who considers himself wise.

Avatar

Please add BBcode for RTL in version 2.5

by Micha ⌂, Saturday, March 14, 2020, 16:24 (77 days ago) @ shian

Hi,

1) If the forum is in LTR direction and one wants to insert RTL text, we need:

<p dir="rtl"> ... </p>

2) If the forum is in RTL direction and one wants to insert LTR text, we need:

<p dir="ltr"> ... </p>

This way we cover all scenarios.

I changed the functions.inc.php and just added

  $bbcode->addCode ('rtl', 'simple_replace', null, array ('start_tag' => '<div dir="rtl">', 'end_tag' => '</div>'), 'rtl', array ('block','rtl'), array ());
  $bbcode->setCodeFlag ('rtl', 'paragraphs', true);
  $bbcode->setCodeFlag ('rtl', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
  $bbcode->setCodeFlag ('rtl', 'closetag.after.newline', BBCODE_NEWLINE_IGNORE);
  $bbcode->setCodeFlag ('rtl', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
  $bbcode->setCodeFlag ('rtl', 'closetag.before.newline', BBCODE_NEWLINE_DROP);

Now, it is possible to use the new BB code

[rtl]Some Text[/rtl]

as a block element (<div>-Element). You can try this modification in my forum - please use the preview option only ;-)

Does it works as expected?

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

Test for block [rtl] ... [/rtl]

by shian ⌂, Saturday, March 14, 2020, 20:29 (77 days ago) @ Micha

Thank you...

I've tested in preview mode the following text (inside the code block).

It works well. I've compared it to https://www.w3schools.com/tags/att_dir.asp and it works exactly the same.

The only problem is that I could not insert another BBcode within the [rtl] block, such as [b], etc (yet it works as HTML, e.g. [rtl]<b>...</b>[/rtl] works, while [rtl][b]...[/b][/rtl] does not work - the BBcode is treated as regular text).

Thanks a lot.




Some text in English...

[b]Some bold text in English...[/b]

[link=https://mylittleforum.net/]Link in English...[/link]

[rtl]
קצת טקסט בעברית... and in English! וחזרה לעברית???

English text & טקסט בעברית!!

מכשיר Wi-Fi בתדר 2.45Ghz! {/test}.

מכשיר Wi-Fi בתדר 2.45Ghz! איננו תקני.

<b>קצת טקסט בעברית... and in English (bold)??</b>

[b/]קצת טקסט בעברית... and in English (bold)??[b]

[/b]קצת טקסט בעברית... and in English (bold)??[b]

[b]קצת טקסט בעברית... and in English (bold)??[/b]


[link=https://www.rapideuphoria311.com/]קצת טקסט בעברית... and in English (with link) ועוד טקסט בעברית!![/link]
[/rtl]

Back to LTR mode
חזרה לשמאל לימין

--
Everyone knows the truth about himself, except the fool who considers himself wise.

Avatar

Test for block [rtl] ... [/rtl]

by Micha ⌂, Saturday, March 14, 2020, 22:26 (77 days ago) @ shian

Hi Shian,

I'm not an expert in preparing the BBCode-Parser. I try to fix your notices and - I believe - it should works now, cf. screenshot. You can try it again in my forum.

regards
Micha

[image]

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Tags:
BB-code, structural markup, left-to-right, ltr, right-to-left, rtl, HTML

Avatar

Test-2 for block [rtl] ... [/rtl]

by shian ⌂, Sunday, March 15, 2020, 11:36 (76 days ago) @ Micha

Thank you,

Now it works [almost] perfectly!


The problems that I found in [rtl] mode until now are:

1. When two lines are written one immediately after the other - they are joined into one line (no <br>).

2. Does not parse smiles into icons - :-)

3. The [code] BBcode is not parsed.


This is the basic test code:


Some text in English...

[b]Some bold text in English...[/b]

[link=https://mylittleforum.net/]Link in English...[/link]

[rtl]
[img=thumbnail-right]https://animated.name/uploads/posts/2016-09/1474627999_2266.gif[/img]
קצת טקסט בעברית... and in English! וחזרה לעברית???

English text & טקסט בעברית!!

מכשיר Wi-Fi בתדר 2.45Ghz! {/test}.

מכשיר Wi-Fi בתדר 2.45Ghz! איננו תקני.

[b]קצת טקסט [i][color=#f60]בעברית[/color][/i]... and in [i][color=#3c0]English[/color][/i] (bold)??[/b]


[link=https://www.rapideuphoria311.com/]קצת טקסט [i][b]בעברית[/b][/i]... and in [b]English[/b] :-)  (with link) ועוד טקסט בעברית!![/link]
[/rtl]

[b][color=#939]Back to LTR mode[/color][/b]
חזרה לשמאל לימין

And this is the result screenshot:
[image]

--
Everyone knows the truth about himself, except the fool who considers himself wise.

Avatar

Test-2 for block [rtl] ... [/rtl]

by Micha ⌂, Sunday, March 15, 2020, 12:19 (76 days ago) @ shian

Hello Shian,

thank you for testing and reporting.

The problems that I found in [rtl] mode until now are:

1. When two lines are written one immediately after the other - they are joined into one line (no <br>).

Okay, I solved this issue.

2. Does not parse smiles into icons - :-)

I added the rtl code to the smilies

3. The [code] BBcode is not parsed.

This issue should be solved now. I also try the undocumented code [pre] and [monospace].

Can you check the last modification in my forum?

Kind regards
Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Tags:
BB-code, structural markup, left-to-right, ltr, right-to-left, rtl, HTML

Avatar

Test-3 for block [rtl] ... [/rtl]

by shian ⌂, Sunday, March 15, 2020, 15:12 (76 days ago) @ Micha
edited by shian, Sunday, March 15, 2020, 15:38

Thank you Micha,

Can you check the last modification in my forum?

Yes, I did - both line-break and smiles are working great.

BTW, [list] and [TeX] and other BBcodes are working as expected.


The test code:


Some text in English...

[b]Some bold text in English...[/b]

[link=https://mylittleforum.net/]Link in English...[/link]

[rtl]
[img=thumbnail-right]https://animated.name/uploads/posts/2016-09/1474627999_2266.gif[/img]
קצת טקסט בעברית... and in English! וחזרה לעברית???

English text & [link=https://www.rapideuphoria311.com/forum/][color=#3f3][i][b]טקסט בעברית[/b][/i][/color][/link]!! :-) 

מכשיר Wi-Fi בתדר 2.45Ghz! {/test}.


מכשיר Wi-Fi בתדר 2.45Ghz :-D ! איננו תקני.
[b]קצת טקסט [i][color=#f60]בעברית[/color][/i]... and in [i][color=#3c0]English[/color][/i] (bold)??[/b]
[link=https://www.rapideuphoria311.com/]קצת טקסט [i][b]בעברית[/b][/i]... :-) [/link] and in [b]English[/b] :-)  (with link) ועוד טקסט בעברית!!
[/rtl]

[b][color=#939]Back to LTR mode[/color][/b]
חזרה לשמאל לימין

The result:
[image]

--
Everyone knows the truth about himself, except the fool who considers himself wise.

Avatar

Test-3 for block [rtl] ... [/rtl]

by Micha ⌂, Sunday, March 15, 2020, 17:04 (76 days ago) @ shian

Hello Shian,

Yes, I did - both line-break and smiles are working great.

Thank you! I added the changes to github. So, it will included to the upcoming 2.5. I also added the option [LTR] in a similar way.

/Regards
Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Tags:
BB-code, structural markup, left-to-right, ltr, right-to-left, rtl, HTML

Avatar

Test-3 for block [rtl] ... [/rtl]

by shian ⌂, Monday, March 16, 2020, 21:35 (75 days ago) @ Micha

Thanks a lot Micha,

"my little forum" will be one of the few forums to provide this feature! among all the other great features that it is already offering.

Great software.

Thank you,
Shian.

--
Everyone knows the truth about himself, except the fool who considers himself wise.

RSS Feed of thread
powered by my little forum