Using line break in RTL languages rendered the lines backwards

More
11 months 5 days ago #4174 by Shirly7
Hi,

I'm using TextMeshPro objects for my texts. I've added a term with translation that has line breaks.
The Hebrew (RTL language) translations is as follows:
אני שורה 1
אני שורה 2
אני שורה 3

But, it renders the lines in the wrong order (last to first) - see attached image:


Regular Text object (not TextMeshPro) seems to work fine.

Are you aware of this issue? or am I doing something wrong?

Thanks,
Shirly
Attachments:

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

More
10 months 4 weeks ago #4176 by Lavi
Hi,

I have found the problem, when you reverse the final text to RTL you don't consider '\n'.

I changed ReverseText() to this and it seems to be working.

public static string ReverseLine(string line)
{
var len = line.Length;
var output = new char[len];
for (var i = 0; i < len; i++)
{
output[(len - 1) - i] = line;
}
return new string(output);
}

public static string ReverseText(string source)
{
var len = source.Length;
var outputString = "";
string[] stringSeparators = new string[] { Environment.NewLine };
string[] strSplit = source.Split(stringSeparators, StringSplitOptions.None);
foreach (var line in strSplit)
{
outputString += ReverseLine(line) + Environment.NewLine;
}
return outputString.Remove(len);
}

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

More
1 month 1 day ago #4403 by flors
Hello,

I have the same problem with arabic. Try to use your code but it has an error: Cannot implicitly convert type 'string' to 'char'

in ReverseText() function, in line:

output[(len - 1) - i] = line;

Does it work in your project)

Thank you!

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

More
1 month 1 day ago #4404 by Frank
Hi,
Please update to the latest version of I2 Localization.
That line in the latest version is
output[len - 1 - i] = source[i];
which is valid and solves the issue.

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
4 weeks 23 hours ago - 4 weeks 23 hours ago #4411 by flors
Hi,

thank you for your help! I have the last version, but had to use the code from above to solve the issue.

Now I have another problem, when adding english words to the text, commas and dots are put to the right instead to the left (see screenshoot attached). In the screenshot the coma should be after the world "Muxima" (not before "Experience").


Edit: Happening the same with english words with other charachters, not only comma and dots (" , [ ], ..). If i add spaces between that characters it works! Any solution without modifying the text?
Attachments:
Last edit: 4 weeks 23 hours ago by flors.

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

Time to create page: 0.191 seconds
Template by JoomlaShine