Localization of sprites not working for me.

  • r0d12i
  • Topic Author
  • Visitor
  • Visitor
9 years 10 months ago #488 by r0d12i
Hi, i just bought the I2 localization asset.
I followed the quick start guide on the documentation and managed to successfully localize texts. But when it comes to sprites, the following error appears on the console:

ArgumentNullException: Argument cannot be null.
Paramete name: key

I dont know if im missing some special initialization for the sprites or something. First i thought that it was caused for not having the references to the sprites (because they werent on the Resources folder) or because i was using an atlas (multiple sprites in one file).

But after i tried to run the example scene for uGUI and the same error appears, also i suppose that the localized sprites should be changing according to the language selected (but in my case they never do, there is always the US flag).

The version of unity im using is 4.6.2f1 and the version of I2 localize (according to the readme file is 2.3.2 (I just downloaded it today from the asset store).

How can i solve this issue??

Thanks in advance!

Rodrigo.

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

More
9 years 10 months ago #492 by Frank
Hi,
Sorry for the delay, I was out of town yesterday and coudn't test the plugin to see if I can reproduce your issue.
I should be back at the office later today and will look into it.
BTW, Does the example uGUI works for you? There is a localized image and RawImage in that example. Do those work?
Are your sprites set to Single or multiple?

Thanks, and will try giving you a solution ASAP.
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
9 years 10 months ago #493 by Frank
Hi,
I was able to check that issue. The problem was when trying to access an atlas for those sprites/objects that don't have a secondary translation.

You can remove the error by replacing the TryGetTermTranslation function on the Assets\I2\Localization\Scripts\LocalizationManager.cs line 125 by this one:
		public static bool TryGetTermTranslation(string Term, out string Translation)
		{
			Translation = string.Empty;
			if (string.IsNullOrEmpty(Term))
				return false;

			InitializeIfNeeded();

			for (int i=0, imax=Sources.Count; i<imax; ++i)
				if (Sources[i].TryGetTermTranslation (Term, out Translation))
					return true;

			return false;
		}

That will skip localizing if there is no term (its null or empty) so the Localization will continue as expected.
This fix is also now included in 2.4.2

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.

  • r0d12i
  • Topic Author
  • Visitor
  • Visitor
9 years 10 months ago #494 by r0d12i
Replied by r0d12i on topic Localization of sprites not working for me.
OK, thanks. I will try your solution tomorrow. I will let you know if that solves the problem as soon as possible.

Thanks for the reply.

:)

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

  • r0d12i
  • Topic Author
  • Visitor
  • Visitor
9 years 10 months ago - 9 years 10 months ago #496 by r0d12i
Replied by r0d12i on topic Localization of sprites not working for me.
Hi again. Yes those updates to the script solve the main problem.

I managed to localize sprites that are set to single in the import settings.

But how can i do it for sprites that are part of an atlas?
(when using the multiple option in unity importer).

It seems that no matter what sprite I chose for the different languages it only picks the first "cropped" sprite of the atlas.

Thanks :).
Last edit: 9 years 10 months ago by r0d12i.

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

More
9 years 10 months ago #497 by Frank
Hi,
Thanks for reporting this issue! I already made the multiple sprite work, but I still have to update the interface to allow you selecting them. Will post a patch tomorrow.
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.150 seconds
Template by JoomlaShine