Documentation

Unity Engine

Download Unity

Unity Engine

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:
  1. Select Window > Package Management > Package Manager to open the Package Manager.
  2. Select the Built-in section.
  3. 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

AdaptiveIconsHolds one localized Android adaptive launcher icon per screen density.
AppInfoStores the localized values that describe an Android application in its resources.
AppInfoStores the localized values that describe an Apple application in its property list.
AssetEntryRepresents 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.
AssetProviderAn ordered chain of asset providers used to load localized assets. Providers are tried in order and the first one to resolve an asset wins.
CommandLineLocaleSelectorSelects the locale from a command line argument, such as -language=fr.
CommentStores a free-text author comment that can be attached to any localization target.
DistributedUIDGeneratorThe default key generator. It produces a distributed unique id, Snowflake-style, that combines a timestamp, a machine id, and a per-millisecond sequence.
EntryDataOne row of a snapshot: a key's shared data plus this locale's value, either a string or a serialized entry.
ExcludeEntryFromEditorExportMarks a key or entry so that editor exporters skip it.
ExcludeEntryFromPlayerExportMarks a key or entry so that it is left out of the files generated for a built player.
FileTableProviderAn asset provider that serves a table by reading a data file and reconstructing the table in memory.
IconsHolds one localized Android launcher icon per screen density.
JsonResourceProviderA file table provider that reads tables from JSON, the default player format.
JsonTableReaderThe default table file reader, reading table snapshots from JSON.
LanguageDropdownA dropdown that lets the player pick a language.
LanguageRadioButtonGroupA radio button group that lets the player pick a language.
LocaleRepresents 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.
LocalizationSettingsThe 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.
LocalizeAudioClipEventComponent 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.
LocalizedAudioClipA 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.
LocalizedFontA serializable reference to a localized font asset.
LocalizedFontAssetA serializable reference to a localized font asset for UI Toolkit text.
LocalizedGameObjectA serializable reference to a localized GameObject asset.
LocalizedMaterialA serializable reference to a localized material asset.
LocalizedObjectA serializable reference to a localized asset of any Object-derived type.
LocalizedReferenceThe serializable base for a reference into a localization table, pairing a table collection with an optional locale override.
LocalizedSpriteA serializable reference to a localized sprite asset.
LocalizedStringA serializable reference that resolves and formats a localized text value.
LocalizedStringGroupA localized string list that combines several localized string references.
LocalizedStringListA localized string list stored as one table entry whose value is split on a separator.
LocalizedTableA serializable reference to an entire localization table resolved for a locale.
LocalizedTextureA serializable reference to a localized texture asset.
LocalizeGameObjectEventComponent that resolves a localized prefab and forwards it through a UnityEvent whenever the value or the selected locale changes.
LocalizeSpriteEventComponent that resolves a localized sprite and forwards it through a UnityEvent whenever the value or the selected locale changes.
LocalizeStringEventComponent that resolves a localized string and forwards it through a UnityEvent whenever the value or the selected locale changes.
LocalizeStringListEventComponent that resolves a localized string list and forwards it through a UnityEvent whenever a value or the selected locale changes.
LocalizeTextureEventComponent that resolves a localized texture and forwards it through a UnityEvent whenever the value or the selected locale changes.
LocalVariablesGroupA named collection of Smart String variables owned by a localized string.
MetadataAttributeDeclares where a metadata kind may be attached and how it appears in the editor's "Add Metadata" menu.
MetadataCollectionHolds the metadata items attached to a single localization target.
PlayerPrefLocaleSelectorStores the last selected locale in PlayerPrefs and restores it on startup.
ReferencedAssetProviderAn 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.
ResourceAssetEntryRepresents a localized asset stored as a path into a Resources folder.
ResourceDatabaseResolves localized strings and assets for the active localization settings.
ResourceEntryBaseServes as the base class for the built-in resource entry kinds, holding the stable key id and per-entry metadata.
ResourceFolderProviderAn asset provider that loads assets from Resources folders, treating the address as a Resources path.
ResourceTableA localization table that holds the translated values for one locale in a collection.
ResourceTableDataA flat, serializable snapshot of one per-locale table.
SharedTableDataThe 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.
SpecificLocaleSelectorSelects a fixed locale by its identifier when that locale is available.
StringEntryRepresents a localized string entry that stores a single text value with no variants.
SystemLocaleSelectorDetects the language the device is set to and matches the closest available locale.
VariantSelectorMetadataMakes a key variant-driven by attaching the selector that chooses its current variant.

Structs

Struct

Description

AssetKeyIdentifies 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.
LocaleIdentifierIdentifies a locale by its culture code, for example "en" or "fr-CA".
SelectorDataA serialized variant selector: its type plus the selector's own serialized fields.
TableEntryReferenceA serializable reference to a single table entry, identified either by its key text or by its stable key id.
TableReferenceA serializable reference to a table collection, identified either by its name or by its collection GUID.
VariantDataOne variant value: the selector key it applies to and the string payload.

Enums

Enum

Description

IconDensityIdentifies the screen density an Android launcher icon is drawn for.
LoadingPreferenceSelects whether the localization system resolves values asynchronously or synchronously when it has the choice.
MetadataTypeIdentifies where a kind of metadata may be attached in a localized project.
PlayModeSourceSelects what a file table provider serves in the editor when entering Play Mode.
PreloadBehaviorOptions for preloading the table collections flagged in the Editor.
SharedEntryFlagsPer-key flags stored once on the shared table entry and shared across every locale.

Interfaces

Interface

Description

IAssetEntryRepresents a resource entry whose localized value is an asset that the entry loads and releases itself.
IAssetProviderThe base capability shared by asset providers in the localization system.
IAsyncAssetEntryAn optional capability for an asset entry that loads its asset asynchronously.
IAsyncAssetProviderAn optional capability for an asset provider that loads assets asynchronously.
IFileDataEntryMarks 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.
IKeyGeneratorGenerates the unique ids assigned to table keys.
ILocaleDiscoveryOptional interface an asset provider implements to discover and register additional locales at runtime.
ILocalizedStringListInterface for resolving a localized list of strings.
IMetadataMarks a type as metadata that can be attached to a locale, a table, a shared key, or a per-locale entry.
IPostProcessValueLocaleTransforms resolved localization values before they are handed back to the caller.
IResourceEntryRepresents a single entry in a resource table, identified by a stable key id and carrying per-entry metadata.
IStartupLocaleInitializeOptional hook a startup selector implements to run code once after initialization completes.
IStartupLocalePrepareOptional hook a startup selector implements to load what it needs before the locale is chosen.
IStartupLocaleSelectorSelects the locale to activate when the localization system initializes at startup.
IStringEntryRepresents a resource entry whose localized value is a string.
ISynchronousAssetEntryAn optional capability for an asset entry that can resolve its asset immediately, without an asynchronous load.
ISynchronousAssetProviderAn optional capability for an asset provider that can resolve an asset immediately, without an asynchronous load.
ITableFileReaderReads a table snapshot from a file at runtime, so a file-backed provider can rebuild a table without shipping the authored table asset.
IVariantSelectorPicks which variant key applies right now, for example the current platform, storefront, or gender.

Delegates

Delegate

Description

ListChangeHandlerReceives the localized values whenever a localized string list resolves or changes.