# Localization tables

> Understand table collections, keys, entries, and metadata.

Understand table collections, keys, entries, and metadata.

Tables store translations. Each locale has its own table, and each key has its own entry. A table collection groups the tables for every locale with the shared key registry, so you author everything in one place.

## Collection anatomy

{ /*  Mermaid source kept for the future doc platform; shown as the static image below until mermaid rendering is supported.  */ }

```mermaid
flowchart TD
    coll["ResourceTableCollection<br>(Editor-only asset)"]
    shared["SharedTableData<br>keys, IDs, Smart flags, metadata"]
    t1["ResourceTable (en)<br>entries"]
    t2["ResourceTable (fr)<br>entries"]
    t3["ResourceTable (ja)<br>entries"]

    coll --> shared
    coll --> t1
    coll --> t2
    coll --> t3
    t1 --> shared
    t2 --> shared
    t3 --> shared

    classDef code fill:#F5F5F5,stroke:#BDBDBD,color:#111;
    class coll,shared,t1,t2,t3 code;
    linkStyle default stroke:#2196F3,stroke-width:1.5px;
```


**A table collection groups shared key data with one table per locale.:**
![](/api/media?file=/engine/6000.7/media/images/localization-table-collection.svg)

A table collection groups three underlying types:

* [`SharedTableData`](/engine/6000.7/script-reference/unity/localization/sharedtabledata.md) is the key registry. It contains every key with its stable ID, its Smart flag, and any shared metadata. All locales share it.
* [`ResourceTable`](/engine/6000.7/script-reference/unity/localization/resourcetable.md) holds one locale's entries. The Player loads only the tables it needs.
* `ResourceTableCollection` is the Editor-only asset that ties them together and records which content source serves them.

You can create a collection from the **Assets** menu or from the [Resource Tables window](/engine/6000.7/manual/localization/resource-tables-window-reference.md). Refer to [Create and edit table collections](/engine/6000.7/manual/localization/translations/create-and-edit-table-collections.md) for more information. Unity keeps the sibling assets in sync when you move, rename, or delete the collection.

## Keys and IDs

Every key has a stable numeric ID, assigned by a [`DistributedUIDGenerator`](/engine/6000.7/script-reference/unity/localization/distributeduidgenerator.md) so IDs stay unique across machines. A rename keeps the key's ID, so references and shipped data keep working.

Scripts refer to an entry through a [`TableReference`](/engine/6000.7/script-reference/unity/localization/tablereference.md) and a [`TableEntryReference`](/engine/6000.7/script-reference/unity/localization/tableentryreference.md). A `TableReference` selects the collection by name or globally unique identifier (GUID). A `TableEntryReference` selects the entry by key name or ID. Names read better in code, but GUIDs and IDs survive renames.

## Entry types

A key holds one of the following entry types.

| **Entry type** | **Description**                                                                                          |
| -------------- | -------------------------------------------------------------------------------------------------------- |
| String         | A text value. The most common type, and supports Smart Strings.                                          |
| Asset          | A reference to an asset, one per locale. Common examples are localized textures, audio clips, and fonts. |

Each Asset entry also has a per-locale storage mode (Direct or Resources) that decides whether the asset loads with the table or on demand. Refer to [Localize assets](/engine/6000.7/manual/localization/translations/localize-assets.md).

## Smart Strings

Each key has a **Smart string** toggle in the table editor. A smart entry's value is a [Smart String](/engine/6000.7/manual/scripting/generate-dynamic-text/smart-strings.md) format, evaluated at resolve time with the arguments and variables you pass. The flag lives on the key, so a key uses Smart Strings in every locale or in none. To enable Smart Strings on a key, refer to [Make an entry dynamic](/engine/6000.7/manual/localization/translations/create-and-edit-table-collections.md#make-an-entry-dynamic).

## Variants

You can add variant rows to a key, so one entry holds several values chosen at runtime by a **selector**. A selector inspects the runtime environment, for example the current platform or a value your code supplies, and picks one variant row. A typical use is one value per platform.

Variants are an authoring feature of the Resource Tables window; no public scripting API exposes them. To create variants, refer to [Add variants](/engine/6000.7/manual/localization/translations/create-and-edit-table-collections.md#add-variants).

## Metadata

Entries, keys, tables, and the collection's shared data can carry metadata: serializable objects implementing [`IMetadata`](/engine/6000.7/script-reference/unity/localization/imetadata.md). The built-in types are:

| **Metadata**                     | **Description**                                                                                 |
| -------------------------------- | ----------------------------------------------------------------------------------------------- |
| Comment                          | A note for translators or teammates.                                                            |
| Exclude entry from player export | Unity doesn't write the entry to generated data files; it ships inside the table asset instead. |
| Exclude entry from editor export | Unity leaves the entry out of files exported for translators.                                   |

A variant key is a key with a **Variant Selector** metadata item attached, and the **Add Entry** > **Variant** menu attaches it for you. You don't normally add this metadata manually. Refer to [Variants](#variants).

To define your own, implement `IMetadata` on a serializable class and mark it with [`MetadataAttribute`](/engine/6000.7/script-reference/unity/localization/metadataattribute.md) to control where it can attach.

## Additional resources

* [Create and edit table collections](/engine/6000.7/manual/localization/translations/create-and-edit-table-collections.md)
* [Import and export table collections](/engine/6000.7/manual/localization/translations/import-export-table-collections.md)
* [Resource Tables window reference](/engine/6000.7/manual/localization/resource-tables-window-reference.md)
* [Generate dynamic text with Smart Strings](/engine/6000.7/manual/scripting/generate-dynamic-text/smart-strings.md)
