There are several API functions available, these are the most used ones.

// Get the translation of MyKey into the Current Language

string text1 = I2.Loc.LocalizationManager.GetTranslation("MyKEY");                      // Term in the Default (empty) category

string text2 = I2.Loc.LocalizationManager.GetTranslation("Tutorial/MyKEY");          // Term in the Tutorial category

string text2 = I2.Loc.LocalizationManager.GetTranslation("Tutorial/Tips/MyKEY");   // Nested Categories

Safer way to access the translations

However, given that accessing a term using a string can lead to typos or missing terms that are hard to find without doing lot of QA, the plugin supports another way of accessing the Translations.

By using the Scripts Tool, you can generate a script containing variables that directly accesses the terms. That removes the need to type names yourself and avoids typos. Furthermore, if any term changes or get deleted, Unity will generate a Compile Error that will alert you of the missing term.

// The previous examples could be rewritten in this way for safer access:

string text1 = I2.Loc.ScriptLocalization.MyKEY;                      // MyKey is a generated property

string text2 = I2.Loc.ScriptLocalization.Tutorial.MyKEY;          // MyKey is a property inside the Tutorial structure

string text2 = I2.Loc.ScriptLocalization.Tutorial.Tips.MyKEY;

Notice, that for this to work, you first need to run the Scripts Tool and select which Terms should be baked into the Scripts.

Localized Strings

Another good way of accessing the translations in the script its by using LocalizedString as described here.

Created with the Personal Edition of HelpNDoc: Free EPub and documentation generator