RTL Languages paragraphs start at lower right

More
3 years 9 months ago #969 by Frank

AlbertoA wrote: Hello Frank!

Sorry to resurrect an old thread but I've also run into this issue of RTL text wrapping making the text read bottom to top.. The last reply to this thread was over 7 months ago, is there any update to this issue? Using UnityGUI. Thanks for making the best localization plugin on the asset store :)


Hi,
I started working a new RTL replacement that behave better on more languages, but I was overwhelmed by other features and changes. I have to continue with the RTL code as soon as I get past this next releases.

The major issue with RTL at the moment, is that once I set the text in a label, the renderer (Unity UI, NGUI, TextMesh Pro, etc) is the one that splits the lines according to its settings (word wrap, etc) and dimensions.
Even worst, that process happens every time the label is resized (not just when setting the text).
As a workaround I made a script that monitors that change and once the renderer (only Unity UI and NGUI at the moment) splits the lines, I take it and apply a RTL fix per line.

I will double check the status of that script and try adding it to 2.7.0.

The above seems to work but I want to flag it in case that is something the plugin can handle automatically for RTL languages, which would be better.


Nice workaround, I will add it to 2.7.0.
Also, will make it so that the pivot only gets set to RightAlignment if it was originally LeftAlignment.
If it was something else (like Center or Left) then it probably wont look right with the reversed direction.

Thanks,
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 following user(s) said Thank You: Livealot, Nick_Field

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

More
3 years 7 months ago #1082 by attilam
+1 for this feature, even a workaround :) I use TextMesh Pro, I could try to port it from the other solutions.

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

More
3 years 7 months ago - 3 years 7 months ago #1118 by Frank
Hi Guys,
I just added a workaround to 2.6.1 for correct multiline wrapping with changing alignment.

As you can see in the screenshot, the correct version, starts on the upper right and aligns to the right.



This is a workaround until I get an stable method of querying where the different plugins (uGUI, NGUI, TMPro, etc) are going to split the lines.
I can inject my code in NGUI and TMPro, but it can get messy if they do big updates to their plugins.

In the meantime, this method works great for most cases.
The Localize inspector now has two more options, one specifying the maximum number of characters that can fit in the label. I2L splits the text into lines with that length and applies RTL fix for each individual line.



The other option is a checkbox for adjusting the Alignment if the language is Right-To-Left.
It will make the text align to the Right when the language is RTL and to the Left if its not RTL. (Vertical alignment is maintained)


Version 2.6.1 beta 1 is already in the beta repository so it can be downloaded right away!! I will be sending it to the AssetStore in a few days, but it will take at least a week for Unity to approve it.

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
Attachments:
Last edit: 3 years 7 months ago by Frank.
The following user(s) said Thank You: attilam, Nick_Field

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

More
2 years 7 months ago - 2 years 7 months ago #1837 by vash
Hello.

I am still experiencing this issue in I2Loc 2.6.5.a2 alongside NGUI. Any suggestions of how I could resolve this?

EDIT

The text localized through ScriptLocalization.Get look different that the ones on which I attach the Localize.cs as component. The first look disjointed. Any solution to this? This is how I get it: First line is in the scene and the second one in the script. The first one is correct and it is the one from the Docs.



Also I saw the Max line lenght option. How can I easily adapt this to all lables in my scene? I saw that if I insert a value bigger than the length of the UILabel, the lines are still in a wrong order. Setting the max line length to a value smaller than the capacity of the label fixes them, but I have to go through a lot of UILabels in my scene which can be a bit of a nuisance.

Thank you
Last edit: 2 years 7 months ago by vash.

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

More
2 years 7 months ago - 2 years 7 months ago #1843 by Frank
Hi,

The text localized through ScriptLocalization.Get look different that the ones on which I attach the Localize.cs as component. The first look disjointed. Any solution to this? This is how I get it: First line is in the scene and the second one in the script. The first one is correct and it is the one from the Docs.


Besides doing the translation, I2 Localization applies a post-process, so that the texts get rendered correctly.
In that version of the plugin (2.6.5) If you call ScriptLocalization.Get(term), the text got translated, but the postProcessing didn't get applied.
You have to call ScriptLocalization.Get(term, true) or even better ( ScriptLocalization.Get(term, LocalizationManager.IsRight2Left) ).

That was fixed a couple versions ago, and now in the latest one (2.6.8), when you call ScriptLocalization.Get(term) the post-processing is applied if the language is RTL.

If you upgrade to the latest version, that will work for you (or your can add the second parameter as LocalizationManager.IsRight2Left)

Also I saw the Max line lenght option. How can I easily adapt this to all lables in my scene? I saw that if I insert a value bigger than the length of the UILabel, the lines are still in a wrong order. Setting the max line length to a value smaller than the capacity of the label fixes them, but I have to go through a lot of UILabels in my scene which can be a bit of a nuisance.


Max Line Length is a property that should be modified per label, given that different labels will have different width and so a common length will not make sense.

An easy fix, is to multi-select at the same time all labels that are displaying wrong (just type UILabel in the hierarchy view and select them all) and write the length that works for you.


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
Last edit: 2 years 7 months ago by Frank.

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

More
2 years 7 months ago #1845 by vash
Hello

Thank you for your help.
I upgraded and it now works.

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

Time to create page: 0.706 seconds
Template by JoomlaShine