Skip to content

Getting Started

H. Ibrahim Penekli edited this page Feb 2, 2018 · 10 revisions

1. Adding the Localization package in your project

Open or create your project in Unity.

Then import the Asset Localization package from the Asset Store window in Unity editor. You can find detailed explanation here.

2. Creating localization settings

Localization settings is created automatically when package is imported. Also you can manually create via

Project Window -> GameToolkit -> Localization -> Localization Settings.

Settings file must be kept under any Resources folder. You can read detailed explanation about Resources.

3. Localization settings

  • You can add languages that must be available in you game as many as you want via

    Add (+) -> Language

    Add language
  • Also you can add used languages in your assets via

    Add (+) -> Add used languages

    Add used languages
  • If you want to use Quick Translate option, you should set Google Authentication File claimed from Google Cloud. For more information look at Quick Translate Configuration page.

4. Scripting reference

Localization Settings

// To get localization settings:
LocalizationSettings localizationSettings = LocalizationSettings.Instance;

// You can get available languages as:
List<SystemLanguage> availableLanguages = localizationSettings.AvailableLanguages;

// To access Google auth file:
TextAsset authFile = localizationSettings.GoogleAuthenticationFile;

Localization Manager

// You can get current language:
SystemLanguage currentLanguage = Localization.Instance.CurrentLanguage;

// or you can set current language:
Localization.Instance.CurrentLanguage = SystemLanguage.English;

// or set by system language:
Localization.Instance.SetSystemLanguage();

// or set by default language defined in LocalizationSettings (first item is the default language):
Localization.Instance.SetDefaultLanguage();

// Register application locale changed event:
Localization.Instance.LocaleChanged += (object sender, LocaleChangedEventArgs e) => 
{
    Debug.Log("Application locale has changed from " + e.PreviousLanguage + " to " + e.CurrentLanguage);
};
Clone this wiki locally