Google Sync Does not work at all

9 years 7 months ago #320 by Frank
The system was initially designed to work with the languages name as the primary identifier as that was the only identifier available when on version 1 the plugin was just a wrapper for the NGUI localization system.

Later on, as the plugin become a localization system by itself, I introduced Language Codes to easier the language selection tweaking the localization data. But the system remained using the Language Name to change and handle the language selection as normally the language was selected from a dropdown box by the player.

Nonetheless, I like the idea of giving more power to the Language Code as its more reliable (less likely to have typos).
I will be adding more functions to handling codes and also initializing everything when only the code is requested.

For the moment, you could add this two functions that mirror the Language lookup but use the code instead of the LanguageName:

		public static string GetLanguageFromCode( string Code )
			for (int i=0, imax=Sources.Count; i<imax; ++i)
				int Idx = Sources[i].GetLanguageIndexFromCode(Code);
				if (Idx>=0)
					return Sources[i].mLanguages[Idx].Code;
			return string.Empty;

		public int GetLanguageIndexFromCode( string Code )
			for (int i=0, imax=mLanguages.Count; i<imax; ++i)
				if (string.Compare(mLanguages[i].Code, Code, System.StringComparison.OrdinalIgnoreCase)==0)
					return i;
			return -1;

I added those to version 2.3.1 as well. I should be releasing it along with all the other changes and bug fixes in the next days.

Thanks a lot, and please send me any other suggestion you find as that will help me improve the plugin for all use cases!

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.

9 years 7 months ago #323 by Stehlik
Thank you sir!

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

Time to create page: 0.123 seconds
Template by JoomlaShine