Ludeon / RimWorld-ar

Arabic translation of RimWorld.
6 stars 9 forks source link

Right-to-left language support #11

Closed mtimoustafa closed 6 months ago

mtimoustafa commented 7 years ago

So it seems there's no obvious right-to-left support in Rimworld right now, which breaks Arabic real bad in the game. Is there a way to set that up through the config files? Or do we have to go directly to Ludeon for this?

mtimoustafa commented 7 years ago

So upon further investigation, it seems this is an issue in Unity, as outlined in the language thread on the forum.

Apparently Unity still can't support right-to-left languages, but it seems there's a specific fix for certain languages like Arabic and Hindu (and some Persian too, apparently) in the form of a Unity package (found here).

@TynanSylvester: excuse the ping, but I thought you might find that package interesting! I know it might be asking too much to include something like this just for a couple of languages, but if it seems reliable enough it'd be much appreciated!

TynanSylvester commented 7 years ago

I appreciate the note! Although I'm afraid this really isn't a high priority and could create a lot of UI work. So I'll keep it in mind, but don't anticipate it soon. Sorry about that.

Ty

On Wed, Jun 14, 2017 at 5:15 PM, Mohamed Moustafa notifications@github.com wrote:

So upon further investigation, it seems this is an issue in Unity, as outlined in the language thread https://ludeon.com/forums/index.php?topic=2933.msg47485#msg47485 on the forum.

Apparently Unity still can't support right-to-left languages, but it seems there's a specific fix for certain languages like Arabic and Hindu (and some Persian too, apparently) in the form of a Unity package (found here https://github.com/Konash/arabic-support-unity).

@TynanSylvester https://github.com/tynansylvester: excuse the ping, but I thought you might find that package interesting! I know it might be asking too much to include something like this just for a couple of languages, but if it seems reliable enough it'd be much appreciated!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ludeon/RimWorld-ar/issues/11#issuecomment-308560352, or mute the thread https://github.com/notifications/unsubscribe-auth/AGmf4VU6sxW9auX4M1qdioWBiqTf_er-ks5sEE1egaJpZM4N6ceV .

mtimoustafa commented 7 years ago

No worries, thanks for checking it out regardless :)

mtimoustafa commented 7 years ago

(oops)

mtimoustafa commented 5 years ago

Looks like our friends over in Rimworld-Hebrew came up with a good idea for a solution. While it won't be a full fix for Arabic, it's worth pursuing.

3koozy commented 5 years ago

Very Interesting , please share any updates on that regard.

mtimoustafa commented 5 years ago

So I wrote a script that'll iterate over all the project files and reverse Arabic words in order to get them to appear right-to-left in the game. This fixes any language issues for Hebrew (https://github.com/soryy708/RimWorld-Hebrew/issues/5), but for Arabic it's only a partial fix. The other problem is that the display doesn't handle Unicode properly, so it doesn't connect the letters as it's supposed to.

I did even more digging (إلحقوني مخي بيسيح من وداني) and I found that there are Unicode codes for the letter connections (called the contextual forms). I manually created a string from those codes and put it through the letter reverser I wrote, and it renders correctly!

yes finally

So I'll be writing an Arabic-to-Unicode converter that'll go through all the translation files and convert all the letters into their appropriate Unicode codes, following the rules of the language, so the words all look right. God knows how long this'll take, but I'm really happy there's a workaround for this!

So the translation steps will be as follows:

  1. Translate the XML files as usual.
  2. Run the reversing and Unicode converting scripts against the files (which will create a new directory with the corrected translation files).
  3. Copy over the corrected translation files into the game as usual.

I'll put up a tutorial in the README when I'm done with all this work. Inshallah it should all be good to go soon!

mtimoustafa commented 5 years ago

Okay so I have a translation toolkit to correct the translation files: https://github.com/mtimoustafa/rimworld-rtl-translation-tools

After working on the translation files, there's a build script you can run to make a processed copy of the Arabic directory that can be used in-game. There's some installation to be done before using it; I'll try to automate as much of it as possible and put it in the README before closing this issue, but the link I posted can be used for now if anyone wants to jump in early.

CGUltimateno commented 5 years ago

That's great, I'm gonna give it a try right now and tell you if it's working as I was about to test the game and I found the same problem as everyone here. It's pretty great and nice from you to work on such tool.

mtimoustafa commented 5 years ago

Thank you @CGUltimateno! I appreciate the compliment 🙂

I noticed you mentioned elsewhere that you're working on fixing this issue in Rimworld. If you find that you can't fix it in Unity itself, feel free to integrate my toolkit into the game build process!

DanialPahlavan commented 1 year ago

Hi guys. The last unity Text mesh pro support RTL. When a middle east language is selected, this option can be enabled for text to be RTL. (I know the comments are for 2019, but I want to update the info for the contributor )

image

result image

It tested in unity 2022.2.0b16.112.5806

DanialPahlavan commented 1 year ago

I have a good idea to change the UI element's position to RTL compatible. @TynanSylvester It's like normal LTR UI. image

When the language is changed to one of the Middle Eastern languages, it only wants a negative coefficient behind the X-axis. image

It's Flip horizontal.

TynanSylvester commented 1 year ago

RimWorld uses IMGUI. There are no text meshes.

On Sun, Nov 27, 2022 at 7:16 PM dany pm @.***> wrote:

I have a good idea to change the UI element's position to RTL compatible .

It's like normal LTR UI. [image: image] https://user-images.githubusercontent.com/1260701/204155079-a56881a8-3234-45ab-aa5e-f239c631675d.png

When the language is changed to one of the Middle Eastern languages, it only wants a negative coefficient behind the X-axis. [image: image] https://user-images.githubusercontent.com/1260701/204155133-4a4dfb6d-bb85-4c30-84af-8a238e67086d.png

It's Flip horizontal.

— Reply to this email directly, view it on GitHub https://github.com/Ludeon/RimWorld-ar/issues/11#issuecomment-1328320424, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUZ7YOPEHFRA3NERP325MDWKOXSFANCNFSM4DPJY6KQ . You are receiving this because you were mentioned.Message ID: @.***>

mtimoustafa commented 6 months ago

Closing this issue as it's been stale for a while.

Currently, we can use https://github.com/mtimoustafa/rimworld-rtl-translation-tools as a workaround to get right-to-left text in the translation files.

Hopefully there will be a patch for this at some point, though 🤞🏽