docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Locale

    A Locale represents a language. It supports regional variations and can be configured with an optional fallback Locale via metadata.

    Inheritance
    object
    Object
    ScriptableObject
    Locale
    PseudoLocale
    Implements
    ISerializationCallbackReceiver
    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, bool)
    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, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.Localization
    Assembly: Unity.Localization.dll
    Syntax
    public class Locale : ScriptableObject, ISerializationCallbackReceiver

    Properties

    Name Description
    CustomFormatterCode

    The Language code to use when applying any culture specific string formatting, such as date, time, currency. By default, the Identifier Code will be used however this field can be used to override this such as when you are using a custom Locale which has no known formatter.

    Formatter

    The Formatter that will be applied to any Smart Strings for this Locale. By default, the Identifier CultureInfo will be used when CustomFormatterCode is not set.

    Identifier

    The identifier contains the identifying information such as the id and culture Code for this Locale.

    LocaleName

    The name of the Locale. This can be used to customize how the Locale name should be presented to the user, such as in a language selection menu.

    Metadata

    Optional Metadata. It is possible to attach additional data to the Locale providing it implements the IMetadata interface and is serializable.

    SortOrder

    The sort order can be used to override the order of Locales when sorted in a list. If Locales both have the same SortOrder then they will be sorted by name.

    UseCustomFormatter

    When true, CustomFormatterCode will be used for any culture sensitive formatting instead of Identifier.

    Methods

    Name Description
    CompareTo(Locale)

    Compares the Locales properties. First the sort orders are compared, if they are the same then the LocaleName will be considered instead.

    CreateLocale(CultureInfo)

    Create a Locale using a CultureInfo.

    CreateLocale(string)

    Create a new Locale using the culture code.

    CreateLocale(LocaleIdentifier)

    Create a new Locale using the provided LocaleIdentifier.

    CreateLocale(SystemLanguage)

    Create a Locale using the system language enum value.

    Equals(Locale)

    Compares the Locale Identifier properties.

    GetFallback()

    Returns the first fallback locale or null if one does not exist or it could not be found.

    GetFallbacks()

    Returns the fallbacks in order or priority. If the locale does not contain any FallbackLocale metadata then the CultureInfo will be used to find a fallback.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)