Skip to content

LocalizationTable

Not yet Class Scripting & Networking

A LocalizationTable is a database of translations. It contains source strings and translations for various languages.

Not implemented yet

The localization backend is not implemented.

0 Nova members · 24 modern Roblox members not implemented yet

Description

A LocalizationTable is a database of translations. It contains source strings and translations for various languages. It is used with the Translator and 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 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 original 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.

See Translating Dynamic Content for more information.

Inheritance

Object → Instance → LocalizationTable

Known subclasses: CloudLocalizationTable

Properties

Member Signature Summary
Contents Contents: string —
DevelopmentLanguage DevelopmentLanguage: string The default IETF tag to use if the ''languageKey'' parameter is excluded from the LocalizationTable.GetString() method.
IsExemptFromUGCAnalytics IsExemptFromUGCAnalytics: bool —
Root Root: Instance The object that is being targeted for localization by this table. Localization is applied to it and all of it's descendants.
SourceLocaleId SourceLocaleId: string The locale of source strings.

Methods

Member Signature Summary
GetContents LocalizationTable:GetContents(): string Returns the contents of the LocalizationTable serialized as a JSON string.
GetEntries LocalizationTable:GetEntries(): Array Returns an array of dictionaries, where each dictionary represents an entry of localization data.
GetString LocalizationTable:GetString(targetLocaleId: string, key: string): string Returns a translation based on the specified language and key.
GetTranslator LocalizationTable:GetTranslator(localeId: string): Instance Returns a Translator for entries in this LocalizationTable, in the specified locale.
RemoveEntry LocalizationTable:RemoveEntry(key: string, source: string, context: string): null Removes an entry from the LocalizationTable, using the specified key, source, and context to narrow down the specific entry to be removed.
RemoveEntryValue LocalizationTable:RemoveEntryValue(key: string, source: string, context: string, localeId: string): null Removes a single language translation from the LocalizationTable, using the provided key, source, context, and localeId to narrow down the specific entry to be r…
RemoveKey LocalizationTable:RemoveKey(key: string): null Deprecated in favor of LocalizationTable.RemoveEntry().
RemoveTargetLocale LocalizationTable:RemoveTargetLocale(localeId: string): null Removes all translations from the LocalizationTable with the specified localeId.
SetContents LocalizationTable:SetContents(contents: string): null Sets the contents of the LocalizationTable, via the legacy JSON format.
SetEntries LocalizationTable:SetEntries(entries: Variant): null Sets the contents of the LocalizationTable.
SetEntry LocalizationTable:SetEntry(key: string, targetLocaleId: string, text: string): null Sets the translation text for the targetLocaleId locale on the entry identified by key, creating the entry if it doesn't exist.
SetEntryContext LocalizationTable:SetEntryContext(key: string, source: string, context: string, newContext: string): null 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…
SetEntryExample LocalizationTable:SetEntryExample(key: string, source: string, context: string, example: string): null 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 cha…
SetEntryKey LocalizationTable:SetEntryKey(key: string, source: string, context: string, newKey: string): null 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 a…
SetEntrySource LocalizationTable:SetEntrySource(key: string, source: string, context: string, newSource: string): null 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 ch…
SetEntryValue LocalizationTable:SetEntryValue(key: string, source: string, context: string, localeId: string, text: string): null 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 cha…
SetIsExemptFromUGCAnalytics LocalizationTable:SetIsExemptFromUGCAnalytics(value: bool): null —

Roblox reference: LocalizationTable

Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.