Class LocalizationSettings | Localization | 0.9.0-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class LocalizationSettings

    The localization settings is the core component to the localization system. It provides the entry point to all player based localization features.

    Inheritance
    Object
    Object
    ScriptableObject
    LocalizationSettings
    Inherited Members
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(String)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.Localization.Settings
    Syntax
    public class LocalizationSettings : ScriptableObject

    Properties

    AssetDatabase

    The asset database is responsible for providing localized assets.

    Declaration
    public static LocalizedAssetDatabase AssetDatabase { get; set; }
    Property Value
    Type Description
    LocalizedAssetDatabase

    AvailableLocales

    Declaration
    public static ILocalesProvider AvailableLocales { get; set; }
    Property Value
    Type Description
    ILocalesProvider

    HasSettings

    Indicates if there is a LocalizationSettings present. If one is not found then it will attempt to find one however unlike Instance it will not create a default, if one can not be found.

    Declaration
    public static bool HasSettings { get; }
    Property Value
    Type Description
    Boolean

    true if has settings; otherwise, false.

    HasStringDatabase

    Does the LocalizationSettings exist and contain a string database?

    Declaration
    public static bool HasStringDatabase { get; }
    Property Value
    Type Description
    Boolean

    true if has string database; otherwise, false.

    InitializationOperation

    The localization system may not be immediately ready. Loading Locales, preloading assets etc. This operation can be used to check when the system is ready. You can yield on this in a coroutine to wait.

    Declaration
    public static AsyncOperationHandle<LocalizationSettings> InitializationOperation { get; }
    Property Value
    Type Description
    AsyncOperationHandle<LocalizationSettings>

    Instance

    Singleton instance for the Localization Settings.

    Declaration
    public static LocalizationSettings Instance { get; set; }
    Property Value
    Type Description
    LocalizationSettings

    SelectedLocale

    The current selected Locale. This is the Locale that will be used by default when localizing assets and strings. If you are calling this before InitializationOperation has been completed then a null value may be returned. See SelectedLocaleAsync for a version that will ensure the Locale is not null(when possible).

    Declaration
    public static Locale SelectedLocale { get; set; }
    Property Value
    Type Description
    Locale

    SelectedLocaleAsync

    The current selected Locale. This is the Locale that will be used by default when localizing assets and strings. If InitializationOperation has not been completed yet then this will wait for the AvailableLocales part to complete first. It will not wait for the entire InitializationOperation but just the part that initializes the Locales.

    Declaration
    public static AsyncOperationHandle<Locale> SelectedLocaleAsync { get; }
    Property Value
    Type Description
    AsyncOperationHandle<Locale>

    StartupLocaleSelectors

    Declaration
    public static List<IStartupLocaleSelector> StartupLocaleSelectors { get; }
    Property Value
    Type Description
    List<IStartupLocaleSelector>

    StringDatabase

    The string database is responsible for providing localized string assets.

    Declaration
    public static LocalizedStringDatabase StringDatabase { get; set; }
    Property Value
    Type Description
    LocalizedStringDatabase

    Methods

    GetAssetDatabase()

    Declaration
    public virtual LocalizedAssetDatabase GetAssetDatabase()
    Returns
    Type Description
    LocalizedAssetDatabase

    GetAvailableLocales()

    Declaration
    public ILocalesProvider GetAvailableLocales()
    Returns
    Type Description
    ILocalesProvider

    \

    GetInitializationOperation()

    Declaration
    public virtual AsyncOperationHandle<LocalizationSettings> GetInitializationOperation()
    Returns
    Type Description
    AsyncOperationHandle<LocalizationSettings>

    GetInstanceDontCreateDefault()

    Returns the singleton of the LocalizationSettings but does not create a default one if no active settings are found.

    Declaration
    public static LocalizationSettings GetInstanceDontCreateDefault()
    Returns
    Type Description
    LocalizationSettings

    GetSelectedLocale()

    Declaration
    public virtual Locale GetSelectedLocale()
    Returns
    Type Description
    Locale

    \

    GetSelectedLocaleAsync()

    Declaration
    public virtual AsyncOperationHandle<Locale> GetSelectedLocaleAsync()
    Returns
    Type Description
    AsyncOperationHandle<Locale>

    GetStartupLocaleSelectors()

    Declaration
    public List<IStartupLocaleSelector> GetStartupLocaleSelectors()
    Returns
    Type Description
    List<IStartupLocaleSelector>

    \

    GetStringDatabase()

    Returns the string database being used to localize all strings.

    Declaration
    public virtual LocalizedStringDatabase GetStringDatabase()
    Returns
    Type Description
    LocalizedStringDatabase

    The string database.

    OnLocaleRemoved(Locale)

    Indicates that the Locale is no longer available. If the locale is the current SelectedLocale then a new one will be found using StartupLocaleSelectors.

    Declaration
    public void OnLocaleRemoved(Locale locale)
    Parameters
    Type Name Description
    Locale locale

    SelectLocale()

    Uses StartupLocaleSelectors to select the most appropriate Locale.

    Declaration
    protected virtual Locale SelectLocale()
    Returns
    Type Description
    Locale

    SetAssetDatabase(LocalizedAssetDatabase)

    Declaration
    public void SetAssetDatabase(LocalizedAssetDatabase database)
    Parameters
    Type Name Description
    LocalizedAssetDatabase database

    SetAvailableLocales(ILocalesProvider)

    Declaration
    public void SetAvailableLocales(ILocalesProvider available)
    Parameters
    Type Name Description
    ILocalesProvider available

    SetSelectedLocale(Locale)

    Declaration
    public void SetSelectedLocale(Locale locale)
    Parameters
    Type Name Description
    Locale locale

    SetStringDatabase(LocalizedStringDatabase)

    Sets the string database to be used for localizing all strings.

    Declaration
    public void SetStringDatabase(LocalizedStringDatabase database)
    Parameters
    Type Name Description
    LocalizedStringDatabase database

    Events

    OnSelectedLocaleChanged

    Called when the SelectedLocale is changed. This will be called after InitializationOperation is completed so any preloading operations will be finished.

    Declaration
    public event Action<Locale> OnSelectedLocaleChanged
    Event Type
    Type Description
    Action<Locale>

    SelectedLocaleChanged

    Event that is sent when the SelectedLocale is changed.

    Declaration
    public static event Action<Locale> SelectedLocaleChanged
    Event Type
    Type Description
    Action<Locale>
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023