[Localization] Fix Arabic Glyph Shaping in String Tables
Solution
Unity 2021.x - Unity 6.3.x
Published 1 days ago
The Unity Localization package stores Arabic text in a disconnected form by default. Shaping logic applied at runtime via custom scripts or GameObjectLocalizer often fails because the StringTableEntry data is processed and assigned to the TMP_Text component before the shaping utility can intercept the string, resulting in disjointed character rendering.
To resolve incorrect Arabic character connectivity, the glyph shaping must be applied directly to the StringTable entries. This ensures that when the LocalizationSettings swaps locales, the provided string is already correctly shaped for Right-to-Left (RTL) display.
- Identify the
StringTablecontaining your Arabic translations within the Localization Tables window. - Create a script that references this
StringTableasset. - Iterate through the
Valuescollection of the table to access eachStringTableEntry. - Use a dedicated Arabic shaping utility to process the Value of each entry.
- Reassign the shaped string back to the Value property to update the database.
Additional Tips
- This process should ideally be run as an Editor script or a pre-build step to avoid runtime performance overhead.
- If your project uses
TextMeshPro, ensure the font asset contains the ‘Arabic’ and ‘Arabic Presentation Forms’ Unicode ranges. - Use the
UnityEditor.Localizationnamespace if you are automating this within the Unity Editor environment.
TL;DR
Programmatically iterate through the StringTable to apply glyph shaping to every Value property within the localization database.
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.