Handle '+' symbols in localization text
- benroberts
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
6 years 3 days ago - 6 years 3 days ago #3381
by benroberts
Handle '+' symbols in localization text was created by benroberts
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:
ALSO ... why are you adding spaces to the localization text? i.e.
'+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: 6 years 3 days ago by benroberts.
Please Log in or Create an account to join the conversation.
6 years 3 days ago #3382
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Handle '+' symbols in localization text
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
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
Please Log in or Create an account to join the conversation.
- benroberts
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
6 years 3 days ago - 6 years 3 days ago #3383
by benroberts
Replied by benroberts on topic Handle '+' symbols in localization text
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
> 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: 6 years 3 days ago by benroberts.
Please Log in or Create an account to join the conversation.
6 years 3 days ago #3384
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Handle '+' symbols in localization text
Yes, its really frustating! Specially in languages like Arabic where also the direction changes.
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)
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
Please Log in or Create an account to join the conversation.
- benroberts
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
6 years 3 days ago #3385
by benroberts
Replied by benroberts on topic Handle '+' symbols in localization text
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:
Can't see any reason I'd ever have 5+Q's in a row but do need +'s to work!
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!
Please Log in or Create an account to join the conversation.
6 years 3 days ago #3386
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Handle '+' symbols in localization text
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
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
Please Log in or Create an account to join the conversation.
Time to create page: 0.367 seconds