-
Notifications
You must be signed in to change notification settings - Fork 19
Getting Started
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.
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.
-
You can add languages that must be available in you game as many as you want via
Add (+) -> Language
-
Also you can add used languages in your assets via
Add (+) -> 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.
// 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;
// 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);
};