Arabic Localization of a Game – Our Experience
Although there are lots of comprehensive articles and informations about Arabic translation, we were missing ones that explain the challenges for developers doing a localization. So we decided to create our own summary to help other devs to quickly grasp the most important challenges. Feedback, corrections, additions are welcome!
Last week, we were asked to localize our recent game “Lern Deutsch”, a German language learning game for beginners by the Goethe Institut, to Arabic. Translation of the texts would be handled by the client, our job was the incorporation of the language and type into the game and the correct display of the text. The cross-platform mobile game is made with Unity (NGUI), and we already had a localization system in place. Apart from that, we had no knowledge about the Arabic language or typography. Neither did we have native speakers on the project. Despite that, we managed to set-up our system for arabic support within roughly 3 person days.
So here is what we learned:
Some facts about Arabic script that you should know before starting
Arabic and Arabic Script
Like the Latin alphabet is used to write lots of different languages and has sets of extended characters, the same goes for the Arabic alphabet. “Arabic” usually means Modern Standard Arabic. Other languages using the Arabic script are Farsi, Pashto or Urdu. Some require additional character subsets.
Which form to use?
There are different variants of the Arabic script, used for different purposes. The most widely used that you most likely want to incorporate into your program is called Naskh.
Characters
Arabic in its basic form has 28 letters. Words are separated by spaces. There is interpunctuation, although with non-latin punctuation marks. There is no distinction between capital and small letters. Instead, letters are modified depending on their context: A character will look different, depending on its position in a word. Most characters therefore have 4 different contextualized forms: isolated (default), linked left (at the end of a word), linked right (at the beginning of a word) and between two characters.
Here are the Unicode spans of characters you definitely need for Arabic, Farsi, Pashto & Urdu. The first one contains the basic characters and numbers, the next two all the contextual variants.
- Arabic (0600—06FF, 255 characters)
- Arabic Presentation Forms-A (FB50—FDFF, 611 characters)
- Arabic Presentation Forms-B (FE70—FEFF, 140 characters)
RTL (Right-to-left) support
Arabic languages are written from right to left, top to bottom.
A label of text that has RTL support will render the characters of a string from the right to the left, breaking overflowing text on the left side of a line and is per default aligned right.
Though these rules might sound simple, implementing correct RTL support for a label is not particularly trivial. Luckily, you can fake it. But more about his later.
Doing the localization
The font
We downloaded the Arabic fonts from Google Fonts. They are open source and “you can use them in every way you want, privately or commercially — in print, on your computer, or in your websites.” - Google
Here are the other tools we used:
Since we use bitmap fonts in our project, we first merged the new Arabic Font into into our default Font using FontForge. Then we re-created our font texture with BMFont. Afterwards, our font texture was almost twice as big and we had to shift some assets around to make it fit in our atlas again.
The strings
The nature of arabic strings took as a while to understand.To explain, I’ll start from the beginning: The input system. This is how an arabic keyboard looks like:
Notice how there are the 28 characters mentioned above, but not the contextualized variants. They are not part of the input, because contextualization is handled by the software. However, this usually does not change the string in the background. There is usually only dynamic contextualization at render time.
To explain this more clearly: An Arabic string will usually contain only the isolated character variants that are part of the “Arabic” Unicode set. To display it correctly, the software needs to take care of the RTL line direction and the character replacement.
Here’s another example: In the first line, you can see a correctly rendered string (screenshot taken from Google Chrome/Google Translate). In the second line, the same string is rendered in a label that has no Arabic support (in this case Unity).
That said, most of the modern-day programs have Arabic language support. So keep in mind that if you look at a dynamic string of Arabic text rendered somewhere, chances are very high that it is already interpreted and the characters are displayed correctly.
How to fake it
Luckily, we didn’t have to re-write NGUI labels for correct RTL and Arabic support. Instead we found this great Arabic Support package by Abdullah Konash that took most of the task from our hands.
The idea is this: Since RTL labels effectively only render characters from back to front and place the line breaks differently, you can process a string in a way that even if displayed with an LTR label it will still look like RTL.
Processing the string from the above example with the ArabicSupport.ArabicFixer resulted in the following string (try not to get confused now ;))
So the new string now renders correctly in the default label. All done right?
Unfortunately not. Although the ArabicSupport package does process for order of characters, character contextualization and line breaks, there was one last issue that it could not tackle, and that was dynamic line breaks:
Because some of our labels are shorter than the lines of text from the localization system, they are wrapped. But we saw before, LTR and RTL line breaks are not compatible, so the dynamic line breaks again messed up the strings. And this is where we finally had to get dirty and re-write parts of the NGUI label code, to add correct dynamic line breaks to the processed Arabic strings. If someone is interested in the code, we’d be happy to share.
Conclusion
Since our project does not feature input or editing of Arabic text, the “faked RTL labels” are more than sufficient and in the end saved a lot of time for the localization development. And since we are processing the strings at the moment of the import (which is not at runtime), we save (some small amount of) runtime calculation.
For all who are interested in implementing RTL labels for real: Since the new Unity GUI also does not have Arabic or RTL support, there would still be demand for that in in Unity 5.







