API:Class/LocalizationTable

Filtered-inheritance mode: While this class technically inherits all Instance class members, some (if not all) have been hidden because they serve no purpose for this object.

ExplorerImageIndex97.pngLocalizationTable : Object Icon.pngInstance

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

Internally, a LocalizationTable contains a set of entries. Each entry has fields for Key, Source, Context, Example, and a variable number of extra fields for any translations of the source string.

LocalizationTable Entry Fields

You can think of a LocalizationTable like a spreadsheet with a number of columns:

  • Key is an optional unique key for fast hash lookups and avoiding duplicating source strings in code. If it is not empty it must be unique in the table.
  • Source is the (optional) text in the source language as a format string that will be used by the LocalizationService auto-translation system to match GUI text in the game and render the translation instead. The Source field is normally filed by the text scraper tools but can be set manually. For FormatByKey lookups the Source value can be used as a value for the locale SourceLocaleId if the entry does not otherwise have a translation value for the source locale. If Source is empty then the entry will not be used by the auto-translation system.
  • Context is the Instance path name for the object that the text appeared on. Context is used for disambiguation by the auto-translation system to rank Source matches where the same source string might have been used in different parts of the game with different meanings in some languages, requiring different translations. Context is mostly intended for games fully relying on the automatic translation system without any additional changes to the game. There will be more robust methods for disambiguation available soon as well, like nested tables and GuiBase2d.RootLocalizationTable.
  • Example is whatever you want it to be. Typically set by the text scraper tool if it guessed the string was parameterized to show a full example string that appeared in the game.
  • Any translations for the original source text, under the IETF language tag for their locale id.


At least one of Key or Source must be set (not empty) for each entry, otherwise the entry would be inaccessible to any system or API. Additionally Key, Source, and Context as a tuple must be unique in the table (i.e. two entries cannot have the the same Key, Source, and Context).

Format Strings

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

Format strings in the Roblox localization system can have parameters that are numbered like {1}, {2}, etc. or can alternatively be {named} {but} {not} {numbered}. Curly braces in text must be escaped like this {{ or like this }}. Numbered parameters are 1-based, like array tables in Lua.

Parameters are required to be explicitly numbered or named so they can be re-ordered in translations.

If a translation string contains parameters that are not present in the source string or have conflicting format specifiers that entry will not be used to translate any text.

Parameters can have format specifiers like {1:int}, {1:fixed}, {2:shorttime}. They will be used for locale aware number, date, and time formatting and will also be used by the auto-translation system to re-format supported types where specified.

Supported Format Specifiers
Specifier Name Type Description
int Integer number Integer with optional negative sign, no thousand separator. (1234)
fixed Fixed point number Two decimals with decimal indicator, optional negative sign, no thousands separator. (1234.50)
num Numeric number Two decimals with decimal indicator, optional negative sign, thousands separators (1,234.50 or 1 234,50)
HEX Hex number Integer, converted to hex; negative is converted to 64-bit two’s complement (“3FF”)
hex hex number Same as HEX but as lowercase (“3ff”)
datetime Universal, sortable number Convert UTC timestamp as a number to universal sortable user-readable format (“2017-10-10 13:38:10”)
iso8601 ISO date number Convert UTC timestamp as a number to ISO-8601 format UTC time ("2017-10-12T22:02:38Z")
shorttime Hour, minute number Convert to local “hour minute” format (for example “1:45 PM” or “13:45”)
shortdatetime date/time short number Convert UTC timestamp to general date+time pattern with short time, for example “10/10/2017 1:45 PM”
shortdate Date, short number Convert UTC timestamp to short date pattern, for example “10/10/2017” or “2017-10-10”
translate Translate string Run the argument string argument through the translation table before concatenating (in the same Context as the call to Format). Parameters will not be matched recursively, this will only look for a literal Source match.
(nothing) default string Insert string
(nothing) default number int if integral, fixed if not.

Properties

PropertiesmemberhiddenProperties [toggle]

stringSourceLocaleId

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

|RMD member="API:Class/LocalizationTable/SourceLocaleId"|The language that the source material of this LocalizationTable was based on, as a locale-id.|/RMD|
stringDevelopmentLanguage [deprecated] [hidden]

Deprecated. Do not use.

|RMD member="API:Class/LocalizationTable/DevelopmentLanguage"|Deprecated. Do not use.|/RMD|
RefRoot [deprecated] [hidden]

Deprecated. Do not use.

|RMD member="API:Class/LocalizationTable/Root"|Deprecated. Do not use.|/RMD|
The language that the source material of this LocalizationTable was based on, as a locale-id.
DevelopmentLanguage [deprecated] [hidden]
Deprecated. Do not use.
Root [deprecated] [hidden]
Deprecated. Do not use.
Inherited from Object Icon.pngInstance:
stringName

A non-unique identifier for the object.

|RMD member="API:Class/Instance/Name"|A non-unique identifier for the object.|/RMD|
Ref<Instance>Parent

The hierarchical parent of the object.

|RMD member="API:Class/Instance/Parent"|The hierarchical parent of the object.|/RMD|
A non-unique identifier for the object.
The hierarchical parent of the object.

Functions

FunctionsmemberhiddenFunctions [toggle]

array<dictionary>GetEntries ( )

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

|RMD member="API:Class/LocalizationTable/GetEntries"|Returns an array of dictionaries, where each dictionary represents an entry of localization data.|/RMD|
TranslatorGetTranslator ( string localeId )

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

|RMD member="API:Class/LocalizationTable/GetTranslator"|Returns a Translator for keys in this LocalizationTable, in the specified language.|/RMD|
voidRemoveEntry ( 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.

|RMD member="API:Class/LocalizationTable/RemoveEntry"|Removes an entry from the LocalizationTable, using the specified key, source, and context to narrow down the specific entry to be removed.|/RMD|
voidRemoveEntryValue ( 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.

|RMD member="API:Class/LocalizationTable/RemoveEntryValue"|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.|/RMD|
voidRemoveTargetLocale ( string localeId )

Removes all translations from the LocalizationTable with the specified localeId.

|RMD member="API:Class/LocalizationTable/RemoveTargetLocale"|Removes all translations from the LocalizationTable with the specified localeId.|/RMD|
voidSetEntries ( array<dictionary> 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 GetEntries function.

|RMD member="API:Class/LocalizationTable/SetEntries"|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 GetEntries function.|/RMD|

voidSetEntryContext ( 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.

|RMD member="API:Class/LocalizationTable/SetEntryContext"|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.|/RMD|
voidSetEntryExample ( 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.

|RMD member="API:Class/LocalizationTable/SetEntryExample"|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.|/RMD|
voidSetEntryKey ( 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.

|RMD member="API:Class/LocalizationTable/SetEntryKey"|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.|/RMD|
voidSetEntrySource ( 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.

|RMD member="API:Class/LocalizationTable/SetEntrySource"|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.|/RMD|
voidSetEntryValue ( 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.

|RMD member="API:Class/LocalizationTable/SetEntryValue"|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.|/RMD|
stringGetContents ( ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/LocalizationTable/GetContents"|Deprecated. Do not use.|/RMD|
stringGetString ( string targetLocaleId, string key ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/LocalizationTable/GetString"|Deprecated. Do not use.|/RMD|
voidRemoveKey ( string key ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/LocalizationTable/RemoveKey"|Deprecated. Do not use.|/RMD|
voidSetContents ( string contents ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/LocalizationTable/SetContents"|Deprecated. Do not use.|/RMD|
voidSetEntry ( string key, string targetLocaleId, string text ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/LocalizationTable/SetEntry"|Deprecated. Do not use.|/RMD|
Returns an array of dictionaries, where each dictionary represents an entry of localization data.
GetTranslator ( string localeId )
Returns a Translator for keys in this LocalizationTable, in the specified language.
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.
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.
Removes all translations from the LocalizationTable with the specified localeId.
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 GetEntries function.
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.
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.
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.
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.
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.
GetContents ( ) [deprecated]
Deprecated. Do not use.
GetString ( string targetLocaleId, string key ) [deprecated]
Deprecated. Do not use.
RemoveKey ( string key ) [deprecated]
Deprecated. Do not use.
SetContents ( string contents ) [deprecated]
Deprecated. Do not use.
SetEntry ( string key, string targetLocaleId, string text ) [deprecated]
Deprecated. Do not use.


|RMD member="API:Class/LocalizationTable"|A LocalizationTable is a database of translations. It contains source strings and translations for various languages. It is used with Translators and the LocalizationService auto-translator system to control text translations in the game. Internally, a LocalizationTable contains a set of entries. Each entry has fields for Key, Source, Context, Example, and a variable number of extra fields for any translations of the source string. == LocalizationTable Entry Fields == You can think of a LocalizationTable like a spreadsheet with a number of columns: * Key is an optional unique key for fast hash lookups and avoiding duplicating source strings in code. If it is not empty it must be unique in the table. * Source is the (optional) text in the source language as a format string that will be used by the LocalizationService auto-translation system to match GUI text in the game and render the translation instead. The Source field is normally filed by the text scraper tools but can be set manually. For FormatByKey lookups the Source value can be used as a value for the locale SourceLocaleId if the entry does not otherwise have a translation value for the source locale. If Source is empty then the entry will not be used by the auto-translation system. * Context is the Instance path name for the object that the text appeared on. Context is used for disambiguation by the auto-translation system to rank Source matches where the same source string might have been used in different parts of the game with different meanings in some languages, requiring different translations. Context is mostly intended for games fully relying on the automatic translation system without any additional changes to the game. There will be more robust methods for disambiguation available soon as well, like nested tables and GuiBase2d.RootLocalizationTable. * Example is whatever you want it to be. Typically set by the text scraper tool if it guessed the string was parameterized to show a full example string that appeared in the game. * Any translations for the original source text, under the IETF language tag for their locale id.
At least one of Key or Source must be set (not empty) for each entry, otherwise the entry would be inaccessible to any system or API. Additionally Key, Source, and Context as a tuple must be unique in the table (i.e. two entries cannot have the the same Key, Source, and Context). == Format Strings == The Source field and all translation strings must be valid format strings. Format strings in the Roblox localization system can have parameters that are numbered like {1}, {2}, etc. or can alternatively be {named} {but} {not} {numbered}. Curly braces in text must be escaped like this {{ or like this }}. Numbered parameters are 1-based, like array tables in Lua. Parameters are required to be explicitly numbered or named so they can be re-ordered in translations. If a translation string contains parameters that are not present in the source string or have conflicting format specifiers that entry will not be used to translate any text. Parameters can have format specifiers like {1:int}, {1:fixed}, {2:shorttime}. They will be used for locale aware number, date, and time formatting and will also be used by the auto-translation system to re-format supported types where specified.
Supported Format Specifiers
Specifier Name Type Description
int Integer number Integer with optional negative sign, no thousand separator. (1234)
fixed Fixed point number Two decimals with decimal indicator, optional negative sign, no thousands separator. (1234.50)
num Numeric number Two decimals with decimal indicator, optional negative sign, thousands separators (1,234.50 or 1 234,50)
HEX Hex number Integer, converted to hex; negative is converted to 64-bit two’s complement (“3FF”)
hex hex number Same as HEX but as lowercase (“3ff”)
datetime Universal, sortable number Convert UTC timestamp as a number to universal sortable user-readable format (“2017-10-10 13:38:10”)
iso8601 ISO date number Convert UTC timestamp as a number to ISO-8601 format UTC time ("2017-10-12T22:02:38Z")
shorttime Hour, minute number Convert to local “hour minute” format (for example “1:45 PM” or “13:45”)
shortdatetime date/time short number Convert UTC timestamp to general date+time pattern with short time, for example “10/10/2017 1:45 PM”
shortdate Date, short number Convert UTC timestamp to short date pattern, for example “10/10/2017” or “2017-10-10”
translate Translate string Run the argument string argument through the translation table before concatenating (in the same Context as the call to Format). Parameters will not be matched recursively, this will only look for a literal Source match.
(nothing) default string Insert string
(nothing) default number int if integral, fixed if not.
|/RMD|