Class Locale
A Locale represents a language. It supports regional variations and can be configured with an optional fallback Locale via metadata.
Implements
Inherited Members
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. |