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

LocalizationTable

Show 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

    DevelopmentLanguage

    [Hidden] [NotReplicated] [Deprecated]

    The default IETF tag to use if the ‘‘languageKey’’ parameter is excluded from the LocalizationTable/GetString method.

    Instance

    Root

    [Hidden] [NotReplicated] [Deprecated]

    The object that is being targeted for localization by this table. Localization is applied to it and all of it’s descendants.

    string

    SourceLocaleId

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

    Inherited from Instance: Show Hide

    bool

    Archivable

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

    string

    ClassName

    [ReadOnly] [NotReplicated]

    A read-only string representing the class this Instance belongs to

    int

    DataCost

    [ReadOnly] [NotReplicated] [Deprecated]

    The cost of saving the instance using data persistence.

    string

    Name

    A non-unique identifier of the Instance

    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

    bool

    archivable

    [Hidden] [NotReplicated] [Deprecated]
    string

    className

    [ReadOnly] [NotReplicated] [Deprecated]

    Functions

    string

    GetContents ( )

    [Deprecated]
    Array

    GetEntries ( )

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

    string

    GetString ( string targetLocaleId , string key )

    [Deprecated]

    Returns a translation based on the specified language and key.

    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

    RemoveKey ( string key )

    [Deprecated]

    Deprecated in favor of LocalizationTable/RemoveEntry.

    Calling RemoveKey is the same as making the following call to RemoveEntry:

    LocalizationTable:RemoveEntry(key,"","")
    void

    RemoveTargetLocale ( string localeId )

    Removes all translations from the LocalizationTable with the specified localeId.

    void

    SetContents ( string contents )

    [Deprecated]

    Sets the contents of the LocalizationTable, via the legacy JSON format.

    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

    SetEntry ( string key , string targetLocaleId , string text )

    [Deprecated]
    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

    void

    ClearAllChildren ( )

    This function destroys all of an Instance's children.

    Instance

    Clone ( )

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

    void

    Destroy ( )

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

    Instance

    FindFirstAncestor ( string name )

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

    Instance

    FindFirstAncestorOfClass ( string className )

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

    Instance

    FindFirstAncestorWhichIsA ( string className )

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

    Instance

    FindFirstChild ( string name , bool recursive )

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

    Instance

    FindFirstChildOfClass ( string className )

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

    Instance

    FindFirstChildWhichIsA ( string className , bool recursive )

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

    Objects

    GetChildren ( )

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

    string

    GetDebugId ( int scopeLength )

    [NotBrowsable]

    Returns a coded string of the Instances DebugId used internally by Roblox.

    Array

    GetDescendants ( )

    [CustomLuaState]

    Returns an array containing all of the descendants of the instance

    string

    GetFullName ( )

    Returns a string describing the Instance's ancestry.

    RBXScriptSignal

    GetPropertyChangedSignal ( string property )

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

    bool

    IsA ( string className )

    [CustomLuaState]

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

    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.

    void

    Remove ( )

    [Deprecated]

    Sets the object’s Parent to nil, and does the same for all its descendants.

    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.

    Objects

    children ( )

    [Deprecated]

    Returns an array of the object’s children.

    Instance

    clone ( )

    [Deprecated]
    void

    destroy ( )

    [Deprecated]
    Instance

    findFirstChild ( string name , bool recursive )

    [Deprecated]
    Objects

    getChildren ( )

    [Deprecated]
    bool

    isA ( string className )

    [Deprecated] [CustomLuaState]
    bool

    isDescendantOf ( Instance ancestor )

    [Deprecated]
    void

    remove ( )

    [Deprecated]

    Events

    Inherited from Instance: Show Hide

    RBXScriptSignal

    AncestryChanged ( Instance child , Instance parent )

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

    RBXScriptSignal

    Changed ( string property )

    Fired immediately after a property of an object changes.

    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

    DescendantRemoving ( Instance descendant )

    Fires immediately before a descendant of the Instance is removed.

    RBXScriptSignal

    childAdded ( Instance child )

    [Deprecated]