Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Handle '+' symbols in localization text

Handle '+' symbols in localization text 1 month 3 days ago #3381

The way the I2Loc Google translation works with parameters is to turn the first parameter into a plus ('+'), second into two plusses ('++') etc. This means that if localization text includes + symbols and parameters the result will be all screwed up.

'+50 +{[PARAM]}' becomes '{[PARAM]}50 {[PARAM]}{[PARAM]}' for instance.

Fundamentally this is being caused by the symbol that I2Loc is using being a fairly common one so easiest way I could see to hack/fix this was to change the character to something less common:
static string GetGoogleNoTranslateTag(int tagNumber)
{
    var tag = new String('↕', tagNumber + 1);
    return tag;
}

ALSO ... why are you adding spaces to the localization text? i.e.
finalText = finalText.Replace(tag1, GetGoogleNoTranslateTag(finalTags.Count)+" ");
Last Edit: 1 month 3 days ago by benroberts.
The administrator has disabled public write access.

Handle '+' symbols in localization text 1 month 3 days ago #3382

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1169
  • Thank you received: 253
  • Karma: 77
Hi,
Unfortunately, Google Translate doesn't handle well having "weird" characters. It ignores them and sometime switches them into the wrong places.
That's why I'm using the + sign, as that sign is respected by most Google Translation languages. Also, the signs need an space after them, otherwise, they get ignored.

Here is an example using the Google Translate website showing how another symbol gets skipped




This is an unfortunate issue, but I haven't found a way to make it work reliably for all languages. So, I selected the option that works for most cases with the less impact. Said that, Google Translations should only be used for testing and for doing a first pass at translation. A human translator should supervise the final translations as Google is not aware of all the context in your game, so the translations even thought correct for some context, may not match your intented purpose.

Sorry about that,
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.

Handle '+' symbols in localization text 1 month 3 days ago #3383

Yeah ... since discovered how frustrating this is :) '↕' treatment seems to be variable by language ... the whole situation seems really broken so I put up a post on the Google translate forums asking for help : productforums.google.com/forum/#!topic/t...lace=forum/translate

> the signs need an space after them, otherwise, they get ignored.

FWIW ... I think maybe they've fixed this, I can't find a situation where the + gets ignored without a space, seems to be fine in your example screenshot as well. They do however add extra spaces for no good reason :)
Last Edit: 1 month 3 days ago by benroberts.
The administrator has disabled public write access.

Handle '+' symbols in localization text 1 month 3 days ago #3384

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1169
  • Thank you received: 253
  • Karma: 77
Yes, its really frustating! Specially in languages like Arabic where also the direction changes.
FWIW ... I think maybe they've fixed this, I can't find a situation where the + gets ignored without a space

Well, the space is mainly for cases where two tags are close toguether "<color><a>frank</a></color>" that should be converted to "+ ++ frank ++ +" instead of "+++frank+++".

However, there are other cases where the lack of spaces makes the + to be skipped.



It is a headache to get all possible situations working correctly, thats why I'm setting a the moment with the one that works in most cases. (Unless you have a math app!! haha)
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.

Handle '+' symbols in localization text 1 month 3 days ago #3385

It's times like this I'm glad the whole Unity plugin thing exists ... kinda dizzying thinking about how many edge cases / idiot Google API issues you must have dealt with already ...

Anyways, I've switched the Google tag method to:
	    static string GetGoogleNoTranslateTag(int tagNumber)
	    {
	        return new string('Q', tagNumber + 5);
	    }

Can't see any reason I'd ever have 5+Q's in a row but do need +'s to work!
The administrator has disabled public write access.

Handle '+' symbols in localization text 1 month 3 days ago #3386

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1169
  • Thank you received: 253
  • Karma: 77
Hey, thats a nice change!
I will try it with all the test cases I have and see it works better for all languages.

If so, will add it to the next release!
Please, let me know if you get any issue with your own translations while using the QQQQQs

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 administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.106 seconds
Template by JoomlaShine