Version: Unity 6.7 Beta (6000.7)
Language : English
How localization works
Translations

Locales

Understand how locales, fallbacks, and startup locale selection work.

A Locale represents a language and optional region, such as en or fr-CA. Unity stores locales inside the Localization settings asset, not as separate assets. Each locale has a culture code, a display name, the .NET culture that formats numbers and dates, an optional fallback code, and an enabled flag.

A LocaleIdentifier wraps the culture code and is how scripts refer to a locale. Code comparison ignores case.

Fallbacks

When an entry has no value for the selected locale, the lookup retries with the locale’s fallback locale. For example, fr-CA can fall back to fr, so only the values that differ from French need a Canadian French translation.

You set each locale’s fallback in the Localization settings. A locale discovered from data files at runtime falls back to the project locale, so untranslated keys show your authoring language instead of nothing.

Disabled locales

You can disable a locale in the Localization settings. A disabled locale keeps its translations, but Unity doesn’t present it to users. Startup selection skips a disabled locale, and the built-in language selection controls hide it.

Note: A disabled locale’s tables still ship with the build when they’re stored under a Resources folder. Refer to Content sources.

Startup locale selection

When localization initializes, the startup selectors run in list order, and localization uses the first selector that returns an enabled locale. If none does, localization uses the project locale. The following table describes the built-in selectors.

Selector Description
Command Line Locale Selector Reads a locale code from a command-line argument, for example -language=fr.
System Locale Selector Matches the device’s language and region settings.
Player Pref Locale Selector Restores the locale saved in PlayerPrefs, and saves later changes to it.
Specific Locale Selector Always returns one configured locale.

Order the list from most to least specific. A typical setup is Player Pref Locale Selector first, so the user’s explicit choice takes priority, then System Locale Selector for first launch.

To write your own selector, implement IStartupLocaleSelector. Refer to Create a custom startup locale selector.

Extension points

The following interfaces let you extend how locales are discovered and processed:

  • ILocaleDiscovery: A content source that implements this interface can add locales it finds in its content during initialization, before startup selection runs. The data-file source uses this hook to pick up new language files in a build. Refer to Add a language to a built Player.
  • IPostProcessValueLocale: A locale that implements this interface transforms every value after formatting. Use it for pseudo-localization, for example to stretch text or swap characters and test layout.

Additional resources

How localization works
Translations