SpecificLocaleSelector
Selects a fixed locale by its identifier when that locale is available.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Class
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
- Implements: IStartupLocaleSelector
public class SpecificLocaleSelector : IStartupLocaleSelector
Remarks
Use this selector to force a specific locale at startup regardless of the device or command line. Set SpecificLocaleSelector.LocaleId to the LocaleIdentifier of the locale to select. If no available locale matches the identifier, GetStartupLocale returns null and the next selector in LocalizationSettings.StartupSelectors runs.
Selects French when it is one of the available locales.
Examples
using Unity.Localization;namespace Unity.Localization.Samples{ public class SpecificLocaleSelectorExample { public Locale Run() { var selector = new SpecificLocaleSelector { LocaleId = new LocaleIdentifier("fr") }; Locale french = selector.GetStartupLocale(LocalizationSettings.Instance); return french; } }}
Properties
Property | Description |
|---|---|
| LocaleId | The identifier of the locale to select. |