# LocalizationTable

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Subclasses: [CloudLocalizationTable](https://rapi.sleaze.dev/classes/CloudLocalizationTable.md)
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/LocalizationTable/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/LocalizationTable

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

## Properties

### Contents

```luau
LocalizationTable.Contents: string = "[]"
```

- Tags: Hidden, Not scriptable, Capabilities: Basic

### Root

```luau
LocalizationTable.Root: Instance
```

- Tags: Deprecated, Hidden, Not replicated, Capabilities: Basic

**Deprecated:** This item is deprecated. Do not use it for new work.

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

### IsExemptFromUGCAnalytics

```luau
LocalizationTable.IsExemptFromUGCAnalytics: boolean = false
```

- Tags: Hidden, Not scriptable, Capabilities: Basic

### SourceLocaleId

```luau
LocalizationTable.SourceLocaleId: string = "en-us"
```

- Tags: Read capabilities: Basic

The locale of source strings.

### DevelopmentLanguage

```luau
LocalizationTable.DevelopmentLanguage: string = "en-us"
```

- Tags: Deprecated, Hidden, Not replicated, Read capabilities: Basic, Load only
- Use instead: [`LocalizationTable.SourceLocaleId`](https://rapi.sleaze.dev/classes/LocalizationTable.md)

**Deprecated:** This item has been superseded by [`LocalizationTable.SourceLocaleId`](https://rapi.sleaze.dev/classes/LocalizationTable.md) which should be used in all new work.

The default IETF tag to use if the ''languageKey'' parameter is excluded from the [`LocalizationTable:GetString()`](https://rapi.sleaze.dev/classes/LocalizationTable.md) method.

## Methods

### GetEntries

```luau
LocalizationTable:GetEntries(): { any }
```

- Tags: Capabilities: Basic

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

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

### GetTranslator

```luau
LocalizationTable:GetTranslator(localeId: string): Instance
```

- Tags: Capabilities: Basic

Returns a [`Translator`](https://rapi.sleaze.dev/classes/Translator.md) for entries in this LocalizationTable, in the specified locale.

Parameters:

- `localeId`: A Roblox locale identifier (for example, "en-us" or "es-es") specifying the language the returned Translator should target.

Returns: The [`Translator`](https://rapi.sleaze.dev/classes/Translator.md) instance for the specified locale.

### RemoveEntry

```luau
LocalizationTable:RemoveEntry(key: string, source: string, context: string)
```

- Tags: Capabilities: Basic

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

Parameters:

- `key`: The unique key of the entry to remove. If non-empty, identifies the entry by itself.
- `source`: The source text of the entry. Used with context to identify the entry when key is empty.
- `context`: The [`Instance:GetFullName()`](https://rapi.sleaze.dev/classes/Instance.md) path used for disambiguation. Used with source to identify the entry when key is empty.

### RemoveEntryValue

```luau
LocalizationTable:RemoveEntryValue(key: string, source: string, context: string, localeId: string)
```

- Tags: Capabilities: Basic

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.

Parameters:

- `key`: The unique key of the entry. If non-empty, identifies the entry by itself.
- `source`: The source text of the entry. Used with context to identify the entry when key is empty.
- `context`: The [`Instance:GetFullName()`](https://rapi.sleaze.dev/classes/Instance.md) path used for disambiguation. Used with source to identify the entry when key is empty.
- `localeId`: The locale identifier (for example, "fr-fr") whose translation should be removed from the entry.

### RemoveTargetLocale

```luau
LocalizationTable:RemoveTargetLocale(localeId: string)
```

- Tags: Capabilities: Basic

Removes all translations from the LocalizationTable with the specified localeId.

Parameters:

- `localeId`: A Roblox locale identifier (for example, "fr-fr") specifying which language's translations to remove from all entries.

### SetEntries

```luau
LocalizationTable:SetEntries(entries: any)
```

- Tags: Capabilities: Basic

Sets the contents of the LocalizationTable.

Parameters:

- `entries`: An array of dictionaries in the same format returned by [`LocalizationTable:GetEntries()`](https://rapi.sleaze.dev/classes/LocalizationTable.md), each containing Key, Source, Context, Example, and Values fields.

### SetEntryContext

```luau
LocalizationTable:SetEntryContext(key: string, source: string, context: string, newContext: string)
```

- Tags: Capabilities: Basic

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.

Parameters:

- `key`: The unique key of the entry. If non-empty, identifies the entry by itself.
- `source`: The source text of the entry. Used with context to identify the entry when key is empty.
- `context`: The current [`Instance:GetFullName()`](https://rapi.sleaze.dev/classes/Instance.md) path of the entry. Used with source to identify the entry when key is empty.
- `newContext`: The new context string to assign to the entry.

### SetEntryExample

```luau
LocalizationTable:SetEntryExample(key: string, source: string, context: string, example: string)
```

- Tags: Capabilities: Basic

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.

Parameters:

- `key`: The unique key of the entry. If non-empty, identifies the entry by itself.
- `source`: The source text of the entry. Used with context to identify the entry when key is empty.
- `context`: The [`Instance:GetFullName()`](https://rapi.sleaze.dev/classes/Instance.md) path of the entry. Used with source to identify the entry when key is empty.
- `example`: The new example text to assign to the entry, typically a sample of parameterized content in context.

### SetEntryKey

```luau
LocalizationTable:SetEntryKey(key: string, source: string, context: string, newKey: string)
```

- Tags: Capabilities: Basic

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.

Parameters:

- `key`: The current unique key of the entry. If non-empty, identifies the entry by itself.
- `source`: The source text of the entry. Used with context to identify the entry when key is empty.
- `context`: The [`Instance:GetFullName()`](https://rapi.sleaze.dev/classes/Instance.md) path of the entry. Used with source to identify the entry when key is empty.
- `newKey`: The new key string to assign to the entry. Must be unique within the table if non-empty.

### SetEntrySource

```luau
LocalizationTable:SetEntrySource(key: string, source: string, context: string, newSource: string)
```

- Tags: Capabilities: Basic

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.

Parameters:

- `key`: The unique key of the entry. If non-empty, identifies the entry by itself.
- `source`: The current source text of the entry. Used with context to identify the entry when key is empty.
- `context`: The [`Instance:GetFullName()`](https://rapi.sleaze.dev/classes/Instance.md) path of the entry. Used with source to identify the entry when key is empty.
- `newSource`: The new source text to assign to the entry. Used by the automatic text replacement system for matching GUI text at runtime.

### SetEntryValue

```luau
LocalizationTable:SetEntryValue(key: string, source: string, context: string, localeId: string, text: string)
```

- Tags: Capabilities: Basic

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.

Parameters:

- `key`: The unique key of the entry. If non-empty, identifies the entry by itself.
- `source`: The source text of the entry. Used with context to identify the entry when key is empty.
- `context`: The [`Instance:GetFullName()`](https://rapi.sleaze.dev/classes/Instance.md) path of the entry. Used with source to identify the entry when key is empty.
- `localeId`: The Roblox locale identifier (for example, "fr-fr") for the translation to set or remove.
- `text`: The translation text to store. If empty, the translation for the specified locale is removed from the entry.

### SetIsExemptFromUGCAnalytics

```luau
LocalizationTable:SetIsExemptFromUGCAnalytics(value: boolean)
```

- Tags: Roblox script security, Capabilities: Basic

### GetContents

```luau
LocalizationTable:GetContents(): string
```

- Tags: Deprecated, Capabilities: Basic
- Use instead: [`LocalizationTable.GetEntries`](https://rapi.sleaze.dev/classes/LocalizationTable.md)

**Deprecated:** This item has been superseded by [`LocalizationTable:GetEntries()`](https://rapi.sleaze.dev/classes/LocalizationTable.md) which should be used in all new work.

Returns the contents of the [`LocalizationTable`](https://rapi.sleaze.dev/classes/LocalizationTable.md) serialized as a JSON string.

Returns: The table's entries encoded as a JSON-formatted string.

### GetString

```luau
LocalizationTable:GetString(targetLocaleId: string, key: string): string
```

- Tags: Deprecated, Capabilities: Basic
- Use instead: [`LocalizationTable.GetTranslator`](https://rapi.sleaze.dev/classes/LocalizationTable.md)

**Deprecated:** This item has been superseded by [`LocalizationTable:GetTranslator()`](https://rapi.sleaze.dev/classes/LocalizationTable.md) which should be used in all new work.

Returns a translation based on the specified language and key.

Parameters:

- `targetLocaleId`: Specified language.
- `key`: An optional unique key for fast hash lookups in code. If it is non-empty it must be unique in the table.

Returns: Translated string.

### RemoveKey

```luau
LocalizationTable:RemoveKey(key: string)
```

- Tags: Deprecated, Capabilities: Basic
- Use instead: [`LocalizationTable.RemoveEntry`](https://rapi.sleaze.dev/classes/LocalizationTable.md)

**Deprecated:** This item has been superseded by [`LocalizationTable:RemoveEntry()`](https://rapi.sleaze.dev/classes/LocalizationTable.md) which should be used in all new work

Deprecated in favor of [`LocalizationTable:RemoveEntry()`](https://rapi.sleaze.dev/classes/LocalizationTable.md).

Parameters:

- `key`: The unique key of the entry to remove.

### SetContents

```luau
LocalizationTable:SetContents(contents: string)
```

- Tags: Deprecated, Capabilities: Basic
- Use instead: [`LocalizationTable.SetEntries`](https://rapi.sleaze.dev/classes/LocalizationTable.md)

**Deprecated:** This item has been superseded by [`LocalizationTable:SetEntries()`](https://rapi.sleaze.dev/classes/LocalizationTable.md) which should be used in all new work

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

Parameters:

- `contents`: A JSON-formatted string encoding the table's entries, in the same format returned by [`LocalizationTable:GetContents()`](https://rapi.sleaze.dev/classes/LocalizationTable.md).

### SetEntry

```luau
LocalizationTable:SetEntry(key: string, targetLocaleId: string, text: string)
```

- Tags: Deprecated, Capabilities: Basic
- Use instead: [`LocalizationTable.SetEntryValue`](https://rapi.sleaze.dev/classes/LocalizationTable.md)

**Deprecated:** This item has been superseded by [`LocalizationTable:SetEntries()`](https://rapi.sleaze.dev/classes/LocalizationTable.md) which should be used in all new work.

Sets the translation `text` for the `targetLocaleId` locale on the entry identified by `key`, creating the entry if it doesn't exist.

Parameters:

- `key`: The unique key identifying the entry. If no entry with this key exists, a new entry is created.
- `targetLocaleId`: The Roblox locale identifier (for example, "en-us" or "fr-fr") for the translation to set.
- `text`: The translation text to store for the specified locale.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
