We use cookies on this site to enhance your user experience

LocalizationTable

LocalizationTable

A LocalizationTable is a database of translations. It contains source strings and translations for various languages. It is used with Translator and the LocalizationService auto-translator system to control text translations in the game.

LocalizationTables are designed to be treated as resources, like a texture or a script. They are not optimized to be modified at runtime. Changing a the contents of a table will cause the entire contents of the table to be replicated to all players.

LocalizationTable Entries

Each LocalizationTable contains a set of entries. Each entry contains the translations of the text, along with some special fields:

  • Key is an optional unique key for fast hash lookups in code. If it is non-empty it must be unique in the table.
  • Source is the orignal text in the source language that will be used by the LocalizationService automatic text replacement system to match GUI text and render a translation instead. The Source field can be filled by the text capture tools, or can be set manually. For key-based lookups the Source value can be used as a translation for LocalizationTable/SourceLocaleId if the entry doesn’t have a translation for that locale. If Source is empty then the entry will not be used by the automatic replacement system.
  • Context is the full Instance name for the object that the text appeared on. Context is used for disambiguation by the automatic text replacement system. When multiple matches for the Source are found, the system will pick the best match by matching backwards from the end of the Context string. There are other more robust ways to handle disambiguation available as well, like using multiple tables with GuiBase2d/RootLocalizationTable.
  • Example is whatever you want it to be. If the text capture tool guessed some parameters for a string the Example field will contain an example of them used in context.


  • All of these fields are optional, but at least either Key or Source must be non-empty. No two entries can have the same Key, Source, and Context.

    The Source field and all translation strings must be valid LocalizationService format strings.


    Properties

    Name Type Description
    string

    The language that the source material of this LocalizationTable was based on, as a locale-id.

    Inherited from Instance

    Archivable ClassName DataCost Name Parent RobloxLocked

    Functions

    Name Type Description
    Array

    Returns an array of dictionaries, where each dictionary represents an entry of localization data.

    Instance

    Returns a Translator for keys in this LocalizationTable, in the specified language.

    void

    Removes an entry from the LocalizationTable, using the specified key, source, and context to narrow down the specific entry to be removed.

    void

    Removes a single language translation from the LocalizationTable, using the provided key, source, context, and localeId to narrow down the specific entry to be removed.

    void

    Removes all translations from the LocalizationTable with the specified localeId.

    void

    Sets the contents of the LocalizationTable.

    The entries parameter should be an array of dictionaries in the same format as the one returned from the `LocalizationTable/GetEntries` function.

    void

    Sets the Context field of a LocalizationTable entry to newContext, using the specified key, source, and context to narrow down the entry that will have this change applied.

    void

    Sets the Example field of a LocalizationTable entry to example, using the specified key, source, and context to narrow down the entry that will have this change applied.

    void

    Sets the Key field of a LocalizationTable entry to newKey, using the specified key, source, and context to narrow down the entry that will have this change applied.

    void

    Sets the Source field of a LocalizationTable entry to newSource, using the specified key, source, and context to narrow down the entry that will have this change applied.

    void

    Sets the text of the specified localeId in a LocalizationTable entry, using the specified key, source, and context to narrow down the entry that will have this change applied.

    Inherited from Instance

    ClearAllChildren Clone Destroy FindFirstAncestor FindFirstAncestorOfClass FindFirstAncestorWhichIsA FindFirstChild FindFirstChildOfClass FindFirstChildWhichIsA GetChildren GetDebugId GetDescendants GetFullName GetPropertyChangedSignal IsA IsAncestorOf IsDescendantOf WaitForChild