# CommandLineLocaleSelector

> Selects the locale from a command line argument, such as -language=fr.

## Definition

* **Type:** Class
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule
* **Implements:** [IStartupLocaleSelector](/engine/6000.7/script-reference/unity/localization/istartuplocaleselector.md)

```csharp
public class CommandLineLocaleSelector : IStartupLocaleSelector
```

## Remarks

On startup this selector scans the command line for the prefix set by [CommandLineLocaleSelector.CommandLineArgument](/engine/6000.7/script-reference/unity/localization/commandlinelocaleselector/commandlineargument.md) (`-language=` by default) and selects the locale whose [LocaleIdentifier](/engine/6000.7/script-reference/unity/localization/localeidentifier.md) matches the value that follows, for example `-language=fr`. If the argument is absent or no available locale matches, GetStartupLocale returns null and the next selector in [LocalizationSettings.StartupSelectors](/engine/6000.7/script-reference/unity/localization/localizationsettings/startupselectors.md) runs. This selector is part of the default selector chain, ahead of [SystemLocaleSelector](/engine/6000.7/script-reference/unity/localization/systemlocaleselector.md).

Additional Resources: [IStartupLocaleSelector](/engine/6000.7/script-reference/unity/localization/istartuplocaleselector.md), [LocalizationSettings](/engine/6000.7/script-reference/unity/localization/localizationsettings.md)

Reads the locale from the command line when the player starts.

## Examples

```csharp
using Unity.Localization;

namespace Unity.Localization.Samples
{
    public class CommandLineLocaleSelectorExample
    {
        // Launch the player with:  MyGame.exe -language=fr
        public Locale Run()
        {
            var selector = new CommandLineLocaleSelector();
            Locale locale = selector.GetStartupLocale(LocalizationSettings.Instance);
            return locale;
        }
    }
}
```

## Properties

| Property                                                                                                                   | Description                                                 |
| -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| [CommandLineArgument](/engine/6000.7/script-reference/unity/localization/commandlinelocaleselector/commandlineargument.md) | The command line argument prefix used to assign the locale. |
