# LocaleIdentifier

> Identifies a locale by its culture code, for example "en" or "fr-CA".

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule
* **Implements:** [IEquatable\<LocaleIdentifier>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct LocaleIdentifier : IEquatable<LocaleIdentifier>
```

## Remarks

This is the minimal identifier used to scope cached assets per locale. The full locale model (display name, fallbacks, formatting culture) lives on [Locale](/engine/6000.7/script-reference/unity/localization/locale.md). Two identifiers compare equal when their codes match, ignoring case. The default value is the undefined locale, whose [LocaleIdentifier.Code](/engine/6000.7/script-reference/unity/localization/localeidentifier/code.md) is the empty string.

Additional Resources: [Locale](/engine/6000.7/script-reference/unity/localization/locale.md), [ResourceTable](/engine/6000.7/script-reference/unity/localization/resourcetable.md), [SharedTableData](/engine/6000.7/script-reference/unity/localization/sharedtabledata.md)

Create an identifier from a code, then compare it against another case-insensitively.

## Examples

```csharp
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)
        }
    }
}
```

## Constructors

| Constructor                                                                                                    | Description                                |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| [LocaleIdentifier(System.String)](/engine/6000.7/script-reference/unity/localization/localeidentifier/ctor.md) | Creates an identifier from a culture code. |

## Properties

| Property                                                                            | Description                                                             |
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [Code](/engine/6000.7/script-reference/unity/localization/localeidentifier/code.md) | The culture code, or the empty string when the identifier is undefined. |

## Methods

| Method                                                                                            | Description                                           |
| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| [Equals](/engine/6000.7/script-reference/unity/localization/localeidentifier/equals.md)           | Checks whether this identifier equals another object. |
| [GetHashCode](/engine/6000.7/script-reference/unity/localization/localeidentifier/gethashcode.md) | Computes a hash code for this identifier.             |
| [ToString](/engine/6000.7/script-reference/unity/localization/localeidentifier/tostring.md)       | Returns the culture code for this identifier.         |

## Operators

| Operator                                                                                               | Description                                                      |
| ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| [operator ==](/engine/6000.7/script-reference/unity/localization/localeidentifier/op-equality.md)      | Determines whether two identifiers have the same culture code.   |
| [LocaleIdentifier](/engine/6000.7/script-reference/unity/localization/localeidentifier/op-implicit.md) | Converts a culture code string into an identifier.               |
| [operator !=](/engine/6000.7/script-reference/unity/localization/localeidentifier/op-inequality.md)    | Determines whether two identifiers have different culture codes. |
