docs.unity.cn
    Show / Hide Table of Contents

    Class SystemLocaleSelector

    Attempts to detect the locale of the device and find a match. The System Locale Selector queries different APIs until it finds a matching locale or a suitable fallback locale. The System Locale Selector queries different APIs until it finds a locale or a suitable fallback locale.

    • iOS - Preferred Language. Unity queries the iOS Preferred Language.
    • Android - Device Language. Unity queries the Android getDefault value.
    • System Culture. Unity uses the CultureInfo.CurrentUICulture value.
    • System Language. Unity uses the SystemLanguage value as its final check.

    Inheritance
    Object
    SystemLocaleSelector
    Namespace: UnityEngine.Localization.Settings
    Syntax
    [Serializable]
    public class SystemLocaleSelector : IStartupLocaleSelector

    Methods

    GetApplicationSystemLanguage()

    Returns Application.systemLanguage.

    Declaration
    protected virtual SystemLanguage GetApplicationSystemLanguage()
    Returns
    Type Description
    SystemLanguage

    GetStartupLocale(ILocalesProvider)

    Uses CultureInfo.CurrentUICulture and Application.systemLanguage to find a matching Locale from the available locales.

    Declaration
    public Locale GetStartupLocale(ILocalesProvider availableLocales)
    Parameters
    Type Name Description
    ILocalesProvider availableLocales
    Returns
    Type Description
    Locale
    Implements
    IStartupLocaleSelector.GetStartupLocale(ILocalesProvider)

    GetSystemCulture()

    Returns CultureInfo.CurrentUICulture.

    Declaration
    protected virtual CultureInfo GetSystemCulture()
    Returns
    Type Description
    CultureInfo
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023