Locale
Creates a locale with no culture code.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Constructor
- Namespace: Unity.Localization
- Assembly: UnityEngine.LocalizationRuntimeModule
Locale()
Creates a locale with no culture code.
public Locale()
Remarks
The parameterless constructor exists mainly for serialization. Because Locale.Code is read-only, prefer Locale to create a usable locale. You can still set Locale.FallbackCode and Locale.LocaleName after construction.
Create an empty locale and set its fallback.
Examples
using Unity.Localization;namespace Unity.Localization.Samples{ public class LocaleConstructorEmptyExample { public Locale Run() { var locale = new Locale(); locale.FallbackCode = "en"; return locale; } }}
Locale(string, string)
Creates a locale for a culture code, with an optional display name.
public Locale(string code, string localeName = null)
Parameters
Remarks
The culture code determines the Locale.Identifier and the formatting culture reported by Locale.CultureInfo. When is null, Locale.LocaleName falls back to the culture's native name, then to the code itself.
localeNameCreate a locale for a culture code with an explicit display name.
Examples
using Unity.Localization;namespace Unity.Localization.Samples{ public class LocaleConstructorExample { public Locale Run() => new Locale("de", "Deutsch"); }}