PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

LocalizationTable

Show deprecated

LocalizationTable

Show deprecated

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

    string

    SourceLocaleId

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

    Inherited from Instance: Show Hide

    int

    DataCost

    [ReadOnly] [NotReplicated]
    The cost of saving the instance using data persistence.
    Instance

    Parent

    Determines the hierarchical parent of the `Instance`.
    bool

    RobloxLocked

    If true, the `Instance` and its descendants cannot be indexed or edited by a `Script` or `LocalScript` and will throw an error if it is attempted.
    string

    ClassName

    [ReadOnly] [NotReplicated]
    A read-only string representing the class this `Instance` belongs to.
    string

    Name

    A non-unique identifier of the `Instance`.
    bool

    Archivable

    Determines if an `Instance` can be cloned using `/Instance/Clone` or saved to file.

    Functions

    Array

    GetEntries ( )

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

    Instance

    GetTranslator ( string localeId )

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

    void

    RemoveEntry ( string key , string source , string context )

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

    void

    RemoveEntryValue ( string key , string source , string context , string localeId )

    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

    RemoveTargetLocale ( string localeId )

    Removes all translations from the LocalizationTable with the specified localeId.

    void

    SetEntries ( Variant entries )

    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

    SetEntryContext ( string key , string source , string context , string newContext )

    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

    SetEntryExample ( string key , string source , string context , string example )

    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

    SetEntryKey ( string key , string source , string context , string newKey )

    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

    SetEntrySource ( string key , string source , string context , string newSource )

    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

    SetEntryValue ( string key , string source , string context , string localeId , string text )

    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: Show Hide

    RBXScriptSignal

    GetPropertyChangedSignal ( string property )

    Get an event that fires when a given property of an object changes.
    Instance

    FindFirstChildWhichIsA ( string className , bool recursive )

    Returns the first child of the `Instance` for whom `Instance/IsA` returns true for the given className.
    Array

    GetDescendants ( )

    [CustomLuaState]
    Returns an array containing all of the `Instance`'s descendants.
    bool

    IsAncestorOf ( Instance descendant )

    Returns true if an `Instance` is an ancestor of the given descendant.
    bool

    IsDescendantOf ( Instance ancestor )

    Returns true if an `Instance` is a descendant of the given ancestor.
    Instance

    FindFirstChildOfClass ( string className )

    Returns the first child of the `Instance` whose `Instance/ClassName|ClassName` is equal to the given className.
    Instance

    FindFirstChild ( string name , bool recursive )

    Returns the first child of the `Instance` found with the given name.
    Instance

    FindFirstAncestorWhichIsA ( string className )

    Returns the first ancestor of the `Instance` for whom `Instance/IsA` returns true for the given className.
    Instance

    FindFirstAncestorOfClass ( string className )

    Returns the first ancestor of the `Instance` whose `Instance/ClassName` is equal to the given className.
    Instance

    FindFirstAncestor ( string name )

    Returns the first ancestor of the `Instance` whose `Instance/Name` is equal to the given name.
    bool

    IsA ( string className )

    Returns true if an `Instance`'s class matches or inherits from a given class
    Instance

    WaitForChild ( string childName , double timeOut )

    [CustomLuaState] [CanYield]
    Returns the child of the `Instance` with the given name. If the child does not exist, it will yield the current thread until it does.
    string

    GetFullName ( )

    Returns a string showing the `Instance`'s ancestry.
    string

    GetDebugId ( int scopeLength )

    [NotBrowsable]
    Returns a coded string of the `Instance`s DebugId used internally by Roblox.
    Objects

    GetChildren ( )

    Returns an array containing all of the `Instance`'s children.
    void

    Destroy ( )

    Sets the `Instance/Parent` property to nil, locks the `Instance/Parent` property, disconnects all connections and calls Destroy on all children.
    Instance

    Clone ( )

    Create a deep copy of a Roblox instance and descendants where `Archivable = true`.
    void

    ClearAllChildren ( )

    This function destroys all of an `Instance`'s children.

    Events

    Inherited from Instance: Show Hide

    RBXScriptSignal

    DescendantRemoving ( Instance descendant )

    Fires immediately before a descendant of the `Instance` is removed.
    RBXScriptSignal

    AncestryChanged ( Instance child , Instance parent )

    Fires when the `Instance/Parent` property of the object or one of its ancestors is changed.
    RBXScriptSignal

    ChildAdded ( Instance child )

    Fires when an object is parented to this `Instance`.
    RBXScriptSignal

    ChildRemoved ( Instance child )

    Fires when a child is removed from this `Instance`.
    RBXScriptSignal

    DescendantAdded ( Instance descendant )

    Fires when a descendant is added to the `Instance`.
    RBXScriptSignal

    Changed ( string property )

    Fired immediately after a property of an object changes.