Identifies a locale by its culture code, for example "en" or "fr-CA".
This is the minimal identifier used to scope cached assets per locale. The full locale model (display name, fallbacks,
formatting culture) lives on Locale. Two identifiers compare equal when their codes match, ignoring case.
The default value is the undefined locale, whose LocaleIdentifier.Code is the empty string.
Additional resources: Locale, ResourceTable, SharedTableData
<para>Create an identifier from a code, then compare it against another case-insensitively.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class LocaleIdentifierOverviewExample { public void Run() { LocaleIdentifier identifier = "en"; // implicit conversion from string
Debug.Log(identifier.Code); // en Debug.Log(identifier == new LocaleIdentifier("EN")); // True (case-insensitive) } } }
| Property | Description |
|---|---|
| Code | The culture code, or the empty string when the identifier is undefined. |
| Constructor | Description |
|---|---|
| LocaleIdentifier | Creates an identifier from a culture code. |
| Method | Description |
|---|---|
| Equals | Checks whether this identifier has the same culture code as another. |
| GetHashCode | Computes a hash code for this identifier. |
| ToString | Returns the culture code for this identifier. |
| Operator | Description |
|---|---|
| LocaleIdentifier | Converts a culture code string into an identifier. |
| operator != | Determines whether two identifiers have different culture codes. |
| operator == | Determines whether two identifiers have the same culture code. |