Welcome, Guest
Username: Password: Remember me

TOPIC: Problems with arabic (RTL) language and NGUI

Problems with arabic (RTL) language and NGUI 6 months 1 week ago #2224

  • Cyndor
  • Cyndor's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
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?
The administrator has disabled public write access.

Problems with arabic (RTL) language and NGUI 6 months 1 week ago #2225

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 897
  • Thank you received: 193
  • Karma: 57
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
The administrator has disabled public write access.

Problems with arabic (RTL) language and NGUI 6 months 5 days ago #2230

  • Cyndor
  • Cyndor's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
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.
The administrator has disabled public write access.

Problems with arabic (RTL) language and NGUI 2 months 1 week ago #2444

  • vallcrist
  • vallcrist's Avatar
  • Offline
  • New Member
  • Posts: 7
  • Karma: 0
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: 2 months 1 week ago by vallcrist.
The administrator has disabled public write access.

Problems with arabic (RTL) language and NGUI 2 months 3 days ago #2453

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 897
  • Thank you received: 193
  • Karma: 57
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
The administrator has disabled public write access.
Time to create page: 0.260 seconds
Colors