UnityEngine.LocalizationRuntimeModule
The Localization Runtime module provides the runtime foundation for localizing an application: locales, resource tables, and the settings, database, and asset providers that resolve localized content for the active locale.
Read time 8 minutesLast updated 3 hours ago
Definition
- Type: Module
Remarks
Use the Localization Runtime to declare the locales an application supports, store localized strings and assets in resource tables, and resolve the right value for the active locale at runtime through localized references and components.
This module is enabled by default in all new projects. To enable it in an older project, do the following in the Unity Editor:
- Select Window > Package Management > Package Manager to open the Package Manager.
- Select the Built-in section.
- Select the Localization Runtime module and click Enable.
Alternatively, you can add this line to the Packages/manifest.json file to enable the module:
"com.unity.modules.localizationruntime": "1.0.0",Classes
Class | Description |
|---|---|
| AdaptiveIcons | Holds one localized Android adaptive launcher icon per screen density. |
| AppInfo | Stores the localized values that describe an Android application in its resources. |
| AppInfo | Stores the localized values that describe an Apple application in its property list. |
| AssetEntry | Represents a localized asset stored as a direct object reference that ships and loads with the table. |
| AssetEntryBase<TStore> | Serves as the base class for asset entries that own a stored reference and load and release the asset themselves. |
| AssetProvider | An ordered chain of asset providers used to load localized assets. Providers are tried in order and the first one to resolve an asset wins. |
| CommandLineLocaleSelector | Selects the locale from a command line argument, such as -language=fr. |
| Comment | Stores a free-text author comment that can be attached to any localization target. |
| DistributedUIDGenerator | The default key generator. It produces a distributed unique id, Snowflake-style, that combines a timestamp, a machine id, and a per-millisecond sequence. |
| EntryData | One row of a snapshot: a key's shared data plus this locale's value, either a string or a serialized entry. |
| ExcludeEntryFromEditorExport | Marks a key or entry so that editor exporters skip it. |
| ExcludeEntryFromPlayerExport | Marks a key or entry so that it is left out of the files generated for a built player. |
| FileTableProvider | An asset provider that serves a table by reading a data file and reconstructing the table in memory. |
| Icons | Holds one localized Android launcher icon per screen density. |
| JsonResourceProvider | A file table provider that reads tables from JSON, the default player format. |
| JsonTableReader | The default table file reader, reading table snapshots from JSON. |
| LanguageDropdown | A dropdown that lets the player pick a language. |
| LanguageRadioButtonGroup | A radio button group that lets the player pick a language. |
| Locale | Represents a selectable language or region in a localized project. A locale carries a culture code, an optional display name, a formatting culture, and an optional fallback. |
| LocalizationSettings | The runtime settings for localization: the available locales, the selected locale, and the resource database. |
| LocalizeAssetEvent<TObject> | Serves as the base component that resolves a localized asset and forwards it through a UnityEvent whenever the value or the selected locale changes. |
| LocalizeAudioClipEvent | Component that resolves a localized audio clip and forwards it through a UnityEvent whenever the value or the selected locale changes. |
| LocalizedAsset<TObject> | A serializable reference to a localized asset that updates as the selected locale changes. |
| LocalizedAudioClip | A serializable reference to a localized audio clip asset. |
| LocalizedEntry<TEntry> | A serializable reference to a single localization table entry that resolves to a typed entry value. |
| LocalizedFont | A serializable reference to a localized font asset. |
| LocalizedFontAsset | A serializable reference to a localized font asset for UI Toolkit text. |
| LocalizedGameObject | A serializable reference to a localized GameObject asset. |
| LocalizedMaterial | A serializable reference to a localized material asset. |
| LocalizedObject | A serializable reference to a localized asset of any Object-derived type. |
| LocalizedReference | The serializable base for a reference into a localization table, pairing a table collection with an optional locale override. |
| LocalizedSprite | A serializable reference to a localized sprite asset. |
| LocalizedString | A serializable reference that resolves and formats a localized text value. |
| LocalizedStringGroup | A localized string list that combines several localized string references. |
| LocalizedStringList | A localized string list stored as one table entry whose value is split on a separator. |
| LocalizedTable | A serializable reference to an entire localization table resolved for a locale. |
| LocalizedTexture | A serializable reference to a localized texture asset. |
| LocalizeGameObjectEvent | Component that resolves a localized prefab and forwards it through a UnityEvent whenever the value or the selected locale changes. |
| LocalizeSpriteEvent | Component that resolves a localized sprite and forwards it through a UnityEvent whenever the value or the selected locale changes. |
| LocalizeStringEvent | Component that resolves a localized string and forwards it through a UnityEvent whenever the value or the selected locale changes. |
| LocalizeStringListEvent | Component that resolves a localized string list and forwards it through a UnityEvent whenever a value or the selected locale changes. |
| LocalizeTextureEvent | Component that resolves a localized texture and forwards it through a UnityEvent whenever the value or the selected locale changes. |
| LocalVariablesGroup | A named collection of Smart String variables owned by a localized string. |
| MetadataAttribute | Declares where a metadata kind may be attached and how it appears in the editor's "Add Metadata" menu. |
| MetadataCollection | Holds the metadata items attached to a single localization target. |
| PlayerPrefLocaleSelector | Stores the last selected locale in PlayerPrefs and restores it on startup. |
| ReferencedAssetProvider | An asset provider that resolves an address to a directly referenced asset. Use it when assets are assigned by reference rather than loaded from built content, a Resources folder, or Addressables. |
| ResourceAssetEntry | Represents a localized asset stored as a path into a Resources folder. |
| ResourceDatabase | Resolves localized strings and assets for the active localization settings. |
| ResourceEntryBase | Serves as the base class for the built-in resource entry kinds, holding the stable key id and per-entry metadata. |
| ResourceFolderProvider | An asset provider that loads assets from Resources folders, treating the address as a Resources path. |
| ResourceTable | A localization table that holds the translated values for one locale in a collection. |
| ResourceTableData | A flat, serializable snapshot of one per-locale table. |
| SharedTableData | The shared key table for a localization table collection: the set of string keys and their stable ids that every per-locale table in the collection uses. |
| SpecificLocaleSelector | Selects a fixed locale by its identifier when that locale is available. |
| StringEntry | Represents a localized string entry that stores a single text value with no variants. |
| SystemLocaleSelector | Detects the language the device is set to and matches the closest available locale. |
| VariantSelectorMetadata | Makes a key variant-driven by attaching the selector that chooses its current variant. |
Structs
Struct | Description |
|---|---|
| AssetKey | Identifies a single asset to load through an asset provider. The key pairs a provider specific address with an expected asset type, and optionally the name of a sub-asset at that address. |
| LocaleIdentifier | Identifies a locale by its culture code, for example "en" or "fr-CA". |
| SelectorData | A serialized variant selector: its type plus the selector's own serialized fields. |
| TableEntryReference | A serializable reference to a single table entry, identified either by its key text or by its stable key id. |
| TableReference | A serializable reference to a table collection, identified either by its name or by its collection GUID. |
| VariantData | One variant value: the selector key it applies to and the string payload. |
Enums
Enum | Description |
|---|---|
| IconDensity | Identifies the screen density an Android launcher icon is drawn for. |
| LoadingPreference | Selects whether the localization system resolves values asynchronously or synchronously when it has the choice. |
| MetadataType | Identifies where a kind of metadata may be attached in a localized project. |
| PlayModeSource | Selects what a file table provider serves in the editor when entering Play Mode. |
| PreloadBehavior | Options for preloading the table collections flagged in the Editor. |
| SharedEntryFlags | Per-key flags stored once on the shared table entry and shared across every locale. |
Interfaces
Interface | Description |
|---|---|
| IAssetEntry | Represents a resource entry whose localized value is an asset that the entry loads and releases itself. |
| IAssetProvider | The base capability shared by asset providers in the localization system. |
| IAsyncAssetEntry | An optional capability for an asset entry that loads its asset asynchronously. |
| IAsyncAssetProvider | An optional capability for an asset provider that loads assets asynchronously. |
| IFileDataEntry | Marks a resource entry whose stored value is plain data that round-trips through JSON, so a file-backed table provider can export it to a data file and rebuild it at runtime without shipping the authored table asset. |
| IKeyGenerator | Generates the unique ids assigned to table keys. |
| ILocaleDiscovery | Optional interface an asset provider implements to discover and register additional locales at runtime. |
| ILocalizedStringList | Interface for resolving a localized list of strings. |
| IMetadata | Marks a type as metadata that can be attached to a locale, a table, a shared key, or a per-locale entry. |
| IPostProcessValueLocale | Transforms resolved localization values before they are handed back to the caller. |
| IResourceEntry | Represents a single entry in a resource table, identified by a stable key id and carrying per-entry metadata. |
| IStartupLocaleInitialize | Optional hook a startup selector implements to run code once after initialization completes. |
| IStartupLocalePrepare | Optional hook a startup selector implements to load what it needs before the locale is chosen. |
| IStartupLocaleSelector | Selects the locale to activate when the localization system initializes at startup. |
| IStringEntry | Represents a resource entry whose localized value is a string. |
| ISynchronousAssetEntry | An optional capability for an asset entry that can resolve its asset immediately, without an asynchronous load. |
| ISynchronousAssetProvider | An optional capability for an asset provider that can resolve an asset immediately, without an asynchronous load. |
| ITableFileReader | Reads a table snapshot from a file at runtime, so a file-backed provider can rebuild a table without shipping the authored table asset. |
| IVariantSelector | Picks which variant key applies right now, for example the current platform, storefront, or gender. |
Delegates
Delegate | Description |
|---|---|
| ListChangeHandler | Receives the localized values whenever a localized string list resolves or changes. |