Automatic Google translation skips few letters

More
3 years 4 months ago #1393 by Erikoinen
Hey Frank,

Bought and integrated the plugin yesterday, and it's amazing. Full five stars and a sixth one if I could!

I'm having a problem when using the automatic Google translation. It seems to leave out the first 3 letters of everything it translates.

For example in Finnish "Settings" is "Asetukset", but the translation gives "Tukset" The same goes with all translations. Any idea how to fix this?

Thanks.

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

More
3 years 4 months ago - 3 years 4 months ago #1394 by Erikoinen
Oh and to add to that, it's now also adding the Term name itself.

So for example my "Settings" term is called "Settings/SettingsTopic" and when translated, it gives "Tukset / SettingsTopic" as the actual translation. Could it have something to do with the fact that they are categorized? I believe this didn't happen before I categorized the terms.
Last edit: 3 years 4 months ago by Erikoinen. Reason: Changed term name

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

More
3 years 4 months ago #1395 by Frank
Hi,
Thanks a lot for reporting this issue!
It's totally my fault! I added a faster way to get multiple translations in a single call, but I didn't check the single translations after the final round of optimizations! Sorry about that.

I'm going to release a fix right now.

But you can fix it locally by replacing the ParseTranslationResult function in the Assets\I2\Localization\Scripts\Google\GoogleTranslation.cs line 81-105 by this one:
		public static string ParseTranslationResult( string html, string OriginalText )
		{
			try
			{
				//var iStart = html.IndexOf("<i2>");
				//var Translation = html.Substring(iStart+"<i2>".Length);
				var Translation = html;
				
				if (OriginalText.ToUpper()==OriginalText)
					Translation = Translation.ToUpper();
				else
					if (UppercaseFirst(OriginalText)==OriginalText)
						Translation = UppercaseFirst(Translation);
				else
					if (TitleCase(OriginalText)==OriginalText)
						Translation = TitleCase(Translation);

				return Translation;
			}
			catch (System.Exception ex) 
			{ 
				Debug.LogError(ex.Message); 
				return string.Empty;
			}
		}

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
3 years 4 months ago #1396 by Erikoinen
Holy crap you're fast! Amazing.

Thank you, it worked.

However I was looking for a way to fully translate a language, so I went to Languages and hit "Translate" on one of the languages. It's giving me this error. Did I do this properly?
NullReferenceException: Object reference not set to an instance of an object
I2.Loc.LocalizationEditor.OnLanguageTranslated (System.String Result, System.String Error) (at Assets/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Languages.cs:280)
I2.Loc.LocalizationEditor.CheckForConnection () (at Assets/I2/Localization/Scripts/Editor/Localization/LocalizationEditor_Spreadsheet_Google.cs:473)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplicationBindings.gen.cs:217)

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

More
3 years 4 months ago - 3 years 4 months ago #1397 by Erikoinen
Hmm I spoke too quickly. It worked for one of the translations, but now I have another issue. I'll post a screenshot.



What you see in Swedish was translated by using the Translate button. Obviously it's incorrect. Ideas?

EDIT: This was done with the fix you posted.

EDIT2: I tried translate to Finnish as well (my native tongue) and realized that what it's doing is just translating the full Term, i.e. Ads / AdFailedMessage.
Last edit: 3 years 4 months ago by Erikoinen.

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

More
3 years 4 months ago - 3 years 4 months ago #1398 by Erikoinen
Sorry to confuse you, but this is weird.

Now I tried translating the previous one which worked at first with your fix. Which is Generic/Open, which translated first to "Öppen" in Swedish which I believe is correct.

But now I try the same thing, and it just gives "Generic / Open" as the translation...

EDIT: Could it have broken somehow by me using the Languages > Translate tool?
Last edit: 3 years 4 months ago by Erikoinen.

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

Time to create page: 0.136 seconds
Template by JoomlaShine