docs.unity3d.com
    Show / Hide Table of Contents

    Class LocalesProvider

    Responsible for providing the list of locales that are currently available to this application.

    Inheritance
    Object
    LocalesProvider
    Namespace: UnityEngine.Localization.Settings
    Syntax
    public class LocalesProvider : object, ILocalesProvider, IPreloadRequired, IReset

    Properties

    Locales

    The list of all supported locales.

    Declaration
    public List<Locale> Locales { get; }
    Property Value
    Type Description
    List<Locale>
    Implements
    ILocalesProvider.Locales

    PreloadOperation

    The Locales loading operation. When set to isDone then all locales have been loaded. Can be Null if the operation has not started yet.

    Declaration
    public AsyncOperationHandle PreloadOperation { get; }
    Property Value
    Type Description
    AsyncOperationHandle
    Implements
    IPreloadRequired.PreloadOperation

    Methods

    AddLocale(Locale)

    Add a Locale to allow support for a specific language.

    Declaration
    public void AddLocale(Locale locale)
    Parameters
    Type Name Description
    Locale locale
    Implements
    ILocalesProvider.AddLocale(Locale)

    GetLocale(String)

    Attempt to retrieve a Locale using a Code.

    Declaration
    public Locale GetLocale(string code)
    Parameters
    Type Name Description
    String code

    If no Locale can be found then null is returned.

    Returns
    Type Description
    Locale

    GetLocale(SystemLanguage)

    Attempt to retrieve a Locale using a .

    Declaration
    public Locale GetLocale(SystemLanguage systemLanguage)
    Parameters
    Type Name Description
    SystemLanguage systemLanguage
    Returns
    Type Description
    Locale

    If no Locale can be found then null is returned.

    GetLocale(LocaleIdentifier)

    Attempt to retrieve a Locale using the identifier.

    Declaration
    public Locale GetLocale(LocaleIdentifier id)
    Parameters
    Type Name Description
    LocaleIdentifier id

    LocaleIdentifier to find.

    Returns
    Type Description
    Locale

    If no Locale can be found then null is returned.

    Implements
    ILocalesProvider.GetLocale(LocaleIdentifier)

    RemoveLocale(Locale)

    Removes support for a specific Locale.

    Declaration
    public bool RemoveLocale(Locale locale)
    Parameters
    Type Name Description
    Locale locale

    The locale that should be removed if possible.

    Returns
    Type Description
    Boolean

    true if the locale was removed or false if the locale did not exist.

    Implements
    ILocalesProvider.RemoveLocale(Locale)

    ResetState()

    Resets the state of the provider by removing all the Locales and clearing the preload operation.

    Declaration
    public void ResetState()
    Implements
    IReset.ResetState()
    In This Article
    • Properties
      • Locales
      • PreloadOperation
    • Methods
      • AddLocale(Locale)
      • GetLocale(String)
      • GetLocale(SystemLanguage)
      • GetLocale(LocaleIdentifier)
      • RemoveLocale(Locale)
      • ResetState()
    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