Problem replacing parameters in RTL languages
3 years 8 months ago #4252
by mferrier
Problem replacing parameters in RTL languages was created by mferrier
Hello,
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.
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.
3 years 8 months ago #4276
by UltraRat
Replied by UltraRat on topic Problem replacing parameters in RTL languages
This is broken in I2. You're going to need to rip out their RTL fixes and replace it, then not do the rtl flip until right before you are ready to display. More details in this thread:
inter-illusion.com/forum/i2-localization...blems-with-rich-text
Please Log in or Create an account to join the conversation.
Time to create page: 0.183 seconds