Problems with arabic (RTL) language and NGUI

More
7 years 7 months ago #2224 by Cyndor
I'm having some trouble with adding arabic to our app. I'm using NGUI for the labels. Whenever the text is too large to fit on one line it will start to do line wrapping as it suppose to. However it seems that it breaks the line in a wrong way.




And here is a screenshot of what it should look like:




The language is set to "ar" and the box "Adjust Alignment" is checked. I know I2 is able to handle this (judging from the screenshots I saw about arabic in the NGUI topic). So is there anything I can do to make it work correctly?
Attachments:

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

More
7 years 7 months ago #2225 by Frank
Hi,
I2 Localization can't do AUTOMATIC wrapping in NGUI (the one that happens as soon as the line is too large to fit the text area) as that requires modifying the NGUI code driving the wrapping.
To do the correct wrapping in NGUI, the plugin uses instead a maximum character length to split the lines before they get to NGUI. That is set by changing the "Max Line Length" in the Right-To-Left section of the Localize component.


You should set that to the number of characters that fit inside the label width, and I2 Localization will start splitting the lines correctly.
I know this is a bit inconvenient, but the alternative was to patch NGUI everytime they release an update and keep track of which NGUI patch should be applied based on their version. That can quickly become an issue, so this method was used instead.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

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

More
7 years 7 months ago #2230 by Cyndor
That does help, thanks. The problem I'm having now is that I have to set "Max Line Length" for every existing label in the app. And there are a lot of them :).
So I think I'm going to try and figure out a way to patch NGUI and make it do what I want.

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

More
7 years 3 months ago - 7 years 3 months ago #2444 by vallcrist
Sorry for necroing this up, but this is relevant to an issue I'm having as well.

I get this exact same behavior on uGUI! What should I do to fix it there?

EDIT: I'm actually using TMPro, not the native uGUI Text object, sorry for the confusion
Last edit: 7 years 3 months ago by vallcrist.

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

More
7 years 3 months ago #2453 by Frank
Hi,

I get this exact same behavior on uGUI! What should I do to fix it there?


By the same behavior, are you referring to having to add the length to lots of Localize components?

Unfortunately, I have no way around this :-( For NGUI I could have written a patch, but then future versions of NGUI could break if they modify the lines around the patch. But for TextMeshPro (more now that it no longer ships with the source code), can't patch it, and TMP doesn't provide a callback to allow this.

Anyway, its always a good idea to test the translations as you type them. With I2L is quite simple, click each of the languages in the Localize component, and the label will update to show the translation. That way you can easily test what length is better for that label.

I which I could have a better answer for this, but I don't see a way to make this automatic.

Said that, If I remember correctly, TMP was working on making Arabic text render correctly by default. So, depending on the version you are using, it maybe a good idea to select "Ignore RTL Languages" and let TMP do the line breaks automatically.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

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

Time to create page: 0.232 seconds
Template by JoomlaShine