UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

assets

[Localization] Fix Arabic Glyph Shaping in String Tables

Solution

serializationcustom toolseditor scripting

Unity 2021.x - Unity 6.3.x

Published 1 days ago

Issue

 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.

Explanation

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.

  1. Identify the StringTable containing your Arabic translations within the Localization Tables window.
  2. Create a script that references this StringTable asset.
  3. Iterate through the Values collection of the table to access each StringTableEntry.
  4. Use a dedicated Arabic shaping utility to process the Value of each entry.
  5. 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.Localization namespace 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.