Support => NGUI 3 Support => Topic started by: vallcrist on May 17, 2014, 06:47:23 AM
Title: Localized strings sometimes missing the first characters
Post by: vallcrist on May 17, 2014, 06:47:23 AM
Hello again. :)
On some localized strings like "The game can't connect to the server at this moment. Try again in a few minutes" the first 2~4 charactersdon't show up when transferred into a label, any idea why?
Update : it seems like the problem is related to multi-line texts, every line break is one less character from the beggining
Title: Re: Localized strings sometimes missing the first characters
Post by: ArenMook on May 17, 2014, 06:11:49 PM
How can I reproduce this on my end?
Title: Re: Localized strings sometimes missing the first characters
Post by: Ernest on June 12, 2014, 05:51:38 AM
This happen when you accidentally insert a \n (ctrl + enter) at the end of a cell in your csv file.
Title: Re: Localized strings sometimes missing the first characters
Post by: nbrew on August 27, 2014, 04:59:48 PM
I realize this may be thread > 60 days old but I thought I'd propose a hack for anyone else who stumbles on this issue. As both vallcrist and Ernest indicated, when an actual newline character is present in a localization value the first character of the value will not be present in the game.
Example Localization.txt:
KEY,English,Spanish
name,"Common Name
Latin Name","ES Translation Missing
Latin Name"
anotherKey,"Some Value","ES Translation Missing"
Using "name" in English yields "ommon Name Latin Name".
To remedy this you have two choices: The first is to use the localizations as intended by replacing the newline character with "\n", so that the name line becomes
The other option is to modify NGUI/Scripts/Internal/ByteReader.cs by commenting out line 220:
while(canRead)
{
if(insideQuotes)
{
string s = ReadLine(false);
if(s ==null)returnnull;
s = s.Replace("\\n", "\n");
line +="\n"+ s;
// ++wordStart; // comment out this line
}
I'm not completely sure of what other solutions this might impact but it seems to work for my localizations csv so far.
Hope this helps someone in the future.
Title: Re: Localized strings sometimes missing the first characters
Post by: ArenMook on August 28, 2014, 08:44:40 PM
That line isn't there, and hasn't been there in many months. Please update. :P
Title: Re: Localized strings sometimes missing the first characters
Post by: rain on September 10, 2014, 10:34:13 AM
Sorry to revive this thread, but if I cannot update to the latest version (currently on 3.6.3), then the only thing I need to do to solve this is comment out ByteReader.cs:220?
Title: Re: Localized strings sometimes missing the first characters
Post by: ArenMook on September 11, 2014, 01:37:19 AM
No idea. I can't remember all changes from months back. I can barely remember what I had for breakfast this morning. <_<