Author Topic: support for right to left input  (Read 4786 times)

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
support for right to left input
« on: December 05, 2013, 12:03:00 PM »
does NGUI support right to left input?
i can type hebrew strings but the words flipped. and script to fix this?
« Last Edit: December 05, 2013, 01:25:11 PM by Haim »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: support for right to left input
« Reply #1 on: December 05, 2013, 03:16:31 PM »
No, NGUI doesn't support RTL languages. I don't think even Unity does.

Haim

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: support for right to left input
« Reply #2 on: December 06, 2013, 04:51:15 AM »
yap... i noted that. but i have got a great fix, free and works well for both unity and NGUI (with a bit of tweaks...)

i'm using this to flip the strings:
https://www.assetstore.unity3d.com/#/content/2674

i had to play a bit with your UIinput code... hope you don't mind...but it works like charm!


pdelaossa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: support for right to left input
« Reply #3 on: October 07, 2014, 09:12:34 AM »
I noted that. but i have got a great fix, free and works well for both unity and NGUI (with a bit of tweaks...)

i'm using this to flip the strings:
https://www.assetstore.unity3d.com/#/content/2674

Even using a RTL plugin does not solve this issue. The way UILabel (or the Unity logic underneath it) renders its Text is from left to right, doesn't matter if the string is RTL or not.

What this does cause is that, when there is more than one line, the actual beginning of the sentence is at the bottom right. Thus, the sentence end is on the top-left side. In other words: It is written bottom-to-top.

This is because UILabel begins rendering on the LTR beginning (the first char in the Text string) and goes on rendering rightwise until a new line is needed. Even if right alignment is picked.

As an example, this following sentence:
متعدد الوجوه مع 6 وجوه. حيث الوجوه التي تشكل المكعب هي مربعات. بجانب كونها متعددة الوجوه عادية، فإنه يمكن أيضا أن تصنف على أنها متوازية ، ومتوازية المستطيلات، ومنشور مستقيم مع قاعدة مربعة.

Is rendered as seen in the attached screenshot. Notice that the "6" is at the beginning (right side) of the sentence, but it is rendered at the bottom of the UILabel.

So, what I was getting to with this:
Arenmook, do you think there is a way to fix this without heavily modifying your UILabel?
If there is not, any method I can begin looking at? (I'm guessing in NGUIText)
Even more so, is this even related to UILabel or do I have to look into Unity's library?

Thank you for your attention, and excuse me if re-bumping this old post wasn't the right approach.
« Last Edit: October 07, 2014, 09:24:13 AM by pdelaossa »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: support for right to left input
« Reply #4 on: October 07, 2014, 10:41:05 AM »
Everything related to printing text is in NGUIText.cs. Did you look at the I2 Localization package? I believe it handles all this.

pdelaossa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: support for right to left input
« Reply #5 on: October 08, 2014, 03:01:33 AM »
Thank you for the fast answer! I2 Localization seems to be handling this already, so I won't have to reinvent the wheel.