johnwdubois / rezonator

Rezonator: Dynamics of human engagement
35 stars 2 forks source link

Hebrew characters are displayed backwards #716

Closed johnwdubois closed 3 years ago

johnwdubois commented 3 years ago

Bug From the perspective of a Hebrew speaker, the Hebrew characters are displayed backwards within each word.
This is a problem for both the user language (menus) and the target language (main screen). This problem affects other languages with right-to-left RTL reading order (Arabic, Persian, Urdu...), who represent hundreds of millions of speakers.

Tip Here is some information on Hebrew in GMS from FrostyCat:
https://forum.yoyogames.com/index.php?threads/any-experience-with-hebrew.68591/#post-407622

What to do

  1. Make sure that within each word, Hebrew characters are displayed in the correct order (from the perspective of a Hebrew speaker). In other words, characters within each word must be RTL (right-to-left).
  2. Make sure that the punctuation also is displayed in the correct order (RTL means punctuation appears at the end of the sentence, namely on the left).
  3. Test the solution for Hebrew both with the user language (menus) and the target language (main screen).
  4. Test the solution for user input, especially:
    • text input for Search & Find
    • text input for user's on-the-fly Tags
    • single word and multi-word text input
  5. The best solution involves automatic recognition of Hebrew words be detecting words containing all Hebrew characters.
  6. Words which contain a both Hebrew and Latin characters may present a special challenge.
  7. Also, consider codes-switching between Hebrew (RTL) and another language (LTR), when both scripts are used in the same discourse (and even the same line).

Additional context

  1. The problem of displaying the correct RTL order applies in two different contexts, which represent 2 separate problems for Rezonator:
    • characters within each word must be RTL
    • words within each line (unit) must be RTL
  2. For the first problem (characters)., consider 2 solutions:
    • on-the-fly reversal of the order of characters within the word
    • one-time processing of the reversal of the order of characters within the word, which is stored in a separate field in the map or grid

Screenshot The Hebrew characters in the Rezonator menus are backwards within the word:

Hebrew characters are backwards within the word

The same problem will affect the display of characters in the main screen.

Code There is code for Hebrew suggested by FrostyCat here (not yet tested):

///@func Hebrew(str) ///@param str var hebrew_mode = false; var result = ""; var mode_start = 1; var mode_run = 0; var strlen = string_length(argument0); for (var i = 1; i <= strlen; i++) { var c = string_char_at(argument0, i); var oc = ord(c); var hebrew_mode_now = oc >= $590 && oc <= $5FF; if (hebrew_mode != hebrew_mode_now || i == strlen) { if (i == strlen) { mode_run++; } if (hebrew_mode) { var run = ""; for (var ii = mode_start+mode_run-1; ii >= mode_start; ii--) { run += string_char_at(argument0, ii); } result = run + result; } else { result = string_copy(argument0, mode_start, mode_run) + result; } mode_start = i; mode_run = 1; } else { mode_run++; } hebrew_mode = hebrew_mode_now; } return result;

Related to

125

hopesu21 commented 3 years ago

Hebrew, Arabic and other languages read from right to left are now displayed correctly.