Adding RTL markers in RTL localization for GameTextCompiler #2659
DevGeniusCode
started this conversation in
Ideas
Replies: 2 comments
-
I think that is a good idea, as it gives full control over the direction to the text. |
Beta Was this translation helpful? Give feedback.
0 replies
-
The algorithm can be very simple
But it won't know how to handle punctuation marks and numbers that appear inside a substring, so that |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background:
Users wishing to add RTL (Right-to-Left) languages to CNC Generals face an issue where the GUI engine renders text left-to-right, which forces users to manually reverse strings. Currently, there is a tool called GameTextCompiler that converts text to Unicode supported by the game. The idea of adding RTL support to this tool has been proposed, so the tool would automatically handle the reversal of RTL strings.
So, the text needs to be displayed from right to left. However, when working with
.str
files, all lines are reversed, making the text unreadable. A potential solution could be to reverse each line's characters to make it more readable, and then, when generating the.csf
files, reverse them again to ensure proper rendering in the game.Example:
Challenges & Edge Cases:
-
appears at the beginning of a word or sentence (e.g., "- GLA has SCUD Storm").Solution Proposal:
In response to the problem of mixed RTL and LTR content, and to handle edge cases more efficiently, one potential approach is to use specific Unicode characters that mark RTL segments. These characters, like LRM (Left-to-Right Mark) and RLM (Right-to-Left Mark), can help the engine automatically detect RTL text segments and render them accordingly.
To address these, I suggest adding a feature where the reversal is only applied if certain RTL characters are present in the string, and avoiding reversal for specific sections like
%
format fields or ASCII characters.Example Usage:
How it Works:
Using LRM and RLM characters will also allow for future updates to the engine's Unicode library, enabling native support for RTL languages without manual intervention.
Links:
GameTextCompiler
engineBeta Was this translation helpful? Give feedback.
All reactions