I2 Localization allows localizing not only texts, but also Textures, Fonts, Sounds, Prefabs and other assets.

This assets can be located in either a Resource folder, in an AssetBundle or anywhere in the project.


When the asset is inside the Resources folder or an AssetBundle, I2 Localization can load them at runtime using the asset path and name.

However, when it is located in the project (but not in the Resources folder), the plugin has to keep a reference to the asset and use that at runtime. This references are set either in:

Global

In the Assets tab of the LanguageSource. These assets can be used by all Localize components, but part of them are referenced in memory all the time.



Local

In the Reference section of the Localize component. These assets are only loaded when the scene containing the component is loaded.


No matter where the asset is located, the only information that its saved in the Spreadsheets, is the asset name and path.

For example, if term1 is referencing a Mesh_FR inside the folder "Assets/Resources/SubFolder"  and Mesh_US inside "Assets/Test".  

Then Mesh_US is automatically added to the References or Assets section and the translation becomes its name.

However, Mesh_FR is in a Resources folder, so no need to add the reference, but his translation will contain the path as well.


Term: Term1

English="Mesh_US"

French="Subfolder/Mesh_FR".


Loading Assets from AssetBundles


Fonts, Sprites and other Assets can also be located in AssetBundles. Similar to those located in Resource folders, when adding a reference to them, the plugin stores the name and the path including the AssetBundle Name.

However, each application manages AssetBundles differently. Some use the new Unity Bundles Manager, others request and download them using their own WWW calls.

That's why the AssetBundles integration with I2 Localization, instead of forcing one way of another, allows you to register a class that will handle AssetBundle downloading and access. That way I2 Localization can hook into your existing AssetBundles pipeline.


This is very easy, but requires a bit of code. You will need to create a class that inherits from RegisterBundlesManager and implements the methods in IResourceManager_Bundles.

For example:


using UnityEngine;

public class CustomBundlesManager : RegisterBundlesManager

{

  public override Object LoadFromBundle(string path, System.Type assetType )

  {

      // load from a bundle using path and return the object

      return null;

  }

}



Then, implement the LoadFromBundle function to get the object from the given path (e.g. "$bundleName:Sprites/L_FR")

Finally, add that component to any object in your scene. On Enabled, it will register itself and allow I2 Localization use it to access Assets inside the bundles.

Created with the Personal Edition of HelpNDoc: Free EPub producer