The NGUI localization data in my software program can "live" in the global I2Languages.prefab.
But my software program has a separate library of application text that is localized into 21 languages. This data has a total of about 282,000 characters of text including all localization. To include this in Resources seems to be a poor use of memory. My software program only needs 125 characters at a time. The best approach would be to load these and then unload them before another set is loaded. I mean that the program is only using 125 characters at a time, so it would be wildly inefficient for me to allocate all 282,000 characters into memory when only 125 are needed at any given moment.
My question is how can I load and unload the translated strings with I2 Localization (rather than dump it all into memory)? Is there an API for this? Because the data (282,000 characters) is not defined by scenes. The data is controlled by a game manager script (coroutine) that persists through all scenes and is never destroyed. So it is not possible for me to add it to certain scenes. I need to load and unload only 125 characters at a time, and pull the localized version when this happens, without relying on scenes to accomplish the loading and unloading. This seems like a common scenario actually, since more complex games and apps will not be managed by scenes, but will be managed by persistent manager scripts and coroutines.
A secondary question is how would you suggest metadata be store so it can best be used with I2 Localization? In my program's situation, I have 168 audio files, and the name of the file is used as a key for the "spreadsheet" or data storage, and in a spreadsheet for each of the 168 keys there are four fields (strings like "song name" "song composer" "year composed" and "era") and then 21 languages. I had wanted to use scriptable objects for efficiency to store it all, and to load and unload it using the key, and use I2 to manage it all. Or will I2 take care of the storage (like baking the localization into scripts) and all I have to do is put it into a Google spreadsheet? I'm confused about how the data will be stored if it is not actually attached to anything (I mean that the metadata is information about the audio file and it is connected because the key is the same as the audio file name). Where do I put the info? Just into the Google spreadsheet? And then how would I load and unload it for each set of four fields?
I hope I've explained it well enough. Can you steer me towards the best solution? I'm sure you've thought in detail about memory in large projects. If strings are not controlled by scenes (as in this case), then a large project needs to load and unload the data, per term and per language, using an API. As Unity grows and companies have bigger projects to localize (including AA and AAA projects) they will want to use I2 Localization, and this will be an issue. I was hoping that you had already built in a solution for this scenario.
Even when you set all your translations in the I2Languages.prefab in the Resources folder, the memory used by all of them is not loaded while playing.
For simplicity, the plugin allows you to keep all your translations in the same prefab, that way you can see for each terms all its translations and avoid missing terms for some languages.
However, as soon as you start playing, the plugin saves each individual language into temporal files, and unloads the memory they use. Only keeping loaded the one you have active. Then, as you select different languages, the plugin loads the new one and unload the previous language.
That way you only have in memory what you are using.
If you have v2.8.6, you can see that behavior in the editor as well. If you click Play, you will see that all your translations in the I2Languages.prefab get deleted and as you change languages they are loaded back.
In 2.8.7, the editor no longer no longer does that by default (to avoid confusion and allow editing in play mode). There is a new option in the Languages tab, that allows controlling when the automatic unloading happens (NEVER, OnlyInDevice, InDeviceAndEditor).
The other way to control memory in I2 Localization is by having multiple language sources.
By default, you set all your terms in the I2Langauges.prefab which is accessible in All Scenes. That's called a Global Source.
But if there are several terms that are only used in specific scenes, then you can create GameObjects with LanguageSource components that hold those terms. Then, that memory is only used when those Objects are loaded.
That is used in the example scenes. Each example scene has its own LanguageSource which is Local to that scene.
Hope that helps,
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!