Skip to content

A set of tools for processing Rimworld translation directories for right-to-left (RTL) languages.

Notifications You must be signed in to change notification settings

mtimoustafa/rimworld-rtl-translation-tools

Repository files navigation

rimworld-rtl-translation-tools

A set of tools for processing Rimworld translation directories for right-to-left (RTL) languages.

Rimworld is built on the Unity engine, which has poor support for RTL text. Because of that, the translation directories have to be put through some transformations in order for the text to appear correctly.

Current RTL translation projects:

Installation

  1. Install Ruby.
  2. Install Nokogiri.
  3. Run the script using <path_to_script>/xml-string-reverser.rb! Accepts a file or directory path as an argument.

Contributing

Feel free to fork and submit a pull request of your changes and I'll happily take a look!

This was written in a rush and the code is quite smelly in some places I'm so sorry

reverse_rtl_text.rb

Takes an XML file (or a directory of files) and reverses all Arabic and Hebrew strings in the leaf nodes.

Unity's text renderer does not set the text direction properly, so in order to show the characters in the correct order, we just reverse all the words in the translation files.

This fix is enough for Hebrew to display correctly in the game.

contextualize_arabic_letters.rb

Arabic is a cursive language by default, and its letters connect together according to certain rules. However, Unity's text renderer doesn't handle that correctly, either, and doesn't display the correct context (e.g. a letter should end with a stem to connect to the next letter, etc.).

This script converts all Arabic letters in a file or a directory of files and contextualizes them using the Unicode tables so they connect correctly. Combined with reverse_rtl_text.rb, this causes Arabic to display correctly in-game.

reverse_rtl_text.rb must be run on the translation files first before running contextualize_arabic_letters.rb

build_arabic.sh

Makes a new copy of an Arabic translation, then runs the required scripts to make a corrected translation directory for use in-game.

About

A set of tools for processing Rimworld translation directories for right-to-left (RTL) languages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published