First time applying language jumbles translations

More
5 years 10 months ago #3028 by shcipwa
I just upgraded to the latest version and have the same issue. We do not use google spreadsheet sync and have set update frequency to never and the problem persists. All translation data is loaded into the prefab at runtime via CSV files, initial load is fine, changing languages mismatches keys and values sometimes even mismatches languages. Need a fix for this asap!

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

More
5 years 10 months ago #3029 by Frank
Hi,
When you start the game, I2 Localization, saves all the languages data into temporal files, then it deletes from memory all the localization, except for the current language.
That way, it saves memory at runtime, when you change languages, it unloads the current language and loads the new language from the file.

In your case, you are modifying the translations after they are already saved to the temporal file. So, when you change languages, the old data is restored. But because you also added/removed terms, then the translations will also look shifted.

In general, when you modify the translation data at runtime, you should either:
1- Save the new data to the file by calling source.SaveLanguages()
var I2LanguagesPrefab = LocalizationManager.Sources[0];
I2LanguagesPrefab.Import_CSV( data );
I2LanguagesPrefab.SaveLanguages(true);

or

2- Disable Unloading of languages by adding the following class to your project
    public partial class I2CustomPersistentStorage : I2BasePersistentStorage
    {
        public virtual bool CanAccessFiles()
        {
             return false;
        }
    }

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
5 years 10 months ago #3030 by shcipwa
Thanks for the quick reply, disabling unloading fixed the issue thanks.

I would suggest some work needs to be done around that unloading from memory feature. Seems like a lot of complication to remove some tiny text arrays from memory.

Either way, thanks for solving the problem quickly :)

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

More
5 years 10 months ago #3031 by Frank

disabling unloading fixed the issue thanks.

Great!

I would suggest some work needs to be done around that unloading from memory feature. Seems like a lot of complication to remove some tiny text arrays from memory.


I'm always looking for ways to improve the plugin, so I will really appreciate if you could elaborate in that you said.

Do you mean, that unloading the languages seems unnecessary memory wise?
Most of the games using I2 localization have 300-1500 terms, some of them with plurals and variants which increases the memory usage. And they have translations for 4-10 languages. So, the memory adds up pretty quickly.
For PC games, that its minuscule compared with all you have available and the OS automatic paging into disk, but for mobile, freeing this memory is really important.

Or do you mean that there are more steps than needed for doing the unloading/loading?
That system had to be kept very generic given that several platforms require different approaches (In some you can write temp files, in others the file access is locked and the PlayerPrefs has to be used instead, others allow saving into the Streaming folder but not the temp cache folder, and others there is no runtime file access at all). That's why there are a few checks to handle all those cases. Plus some developers are using their own storage systems (file access + custom playerPrefs) and the system needs to reroute to those.

Please, if you could elaborate a bit on what part is the complicated or that looks weird to your, please, let me know, and that will help me improve the plugin for future versions.

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
5 years 10 months ago #3032 by shcipwa

Frank wrote: Please, if you could elaborate a bit on what part is the complicated or that looks weird to your, please, let me know, and that will help me improve the plugin for future versions.


What I mean is, that for the benefits of at most 1mb of memory saved in best case scenarios, the feature (which is on by default) adds a lot of technical complexity that can lead to nasty bugs like the ones reported in this thread. I can see how mobile devices combined with a game with lots of localized strings would benefit from this, maybe simply making this feature an opt in setting rather than an opt out by code would make cause less headaches.

Obviously you would know your user base best, just from personal experience all I need from the tool is key value pair lookups at runtime and the ability to auto translate from google. I lost a day to the old autotranslate not working anymore (hence the upgrade), and lost half a day to jumbling of key/value pairs for a feature I don't need.

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

Time to create page: 0.186 seconds
Template by JoomlaShine