Problem replacing parameters in RTL languages

2 weeks 5 days ago #4252 by mferrier

I customize my game text by replacing parameters. For example, with the string "Hi, {[username]}" that has ID "home_hi" I will do the following:

LocalizationManager.GetTranslation("home_hi").Replace("{[username]}", player_username)

This normally works fine, but fails when translating to a RTL language such as Arabic.

When I view the Arabic translation in I2 Localization, it correctly looks like this:

مرحبًا {[username]}

But when I call LocalizationManager.GetTranslation("home_hi"), I get back this string:

@@}鱀@@ ﺎًﺒﺣﺮﻣ

Note that in I2 Localization it is being displayed L2R, and the returned string is R2L.

It appears that the returned string is also reversing the "{[username]}" characters, and then interpreting those reversed bytes as fewer, higher unicode code points.

This problem with RTL languages also breaks formatting code that I include in my strings, such as <color=red>.

What is the correct way to embed parameters and formatting in text that will be translated to R2L languages?

Thank you.

Please Log in or Create an account to join the conversation.

Time to create page: 0.120 seconds
Template by JoomlaShine