API:Class/LocalizationTable

Preliminary:This item is under development and is likely to change. Use only for experimental work.
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.

ExplorerImageIndex76.pngLocalizationTable : Object Icon.pngInstance

A LocalizationTable represents a series of static language translations, and is used with the LocalizationService to control text translations in the game.

Properties

Properties [toggle]

stringDevelopmentLanguage

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

|RMD member="API:Class/LocalizationTable/DevelopmentLanguage"|The default IETF tag to use if the languageKey parameter is excluded from the GetString method.|/RMD|
Ref<Instance>Root

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

|RMD member="API:Class/LocalizationTable/Root"|The object that is being targeted for localization by this table. Localization is applied to it and all of it's descendants.|/RMD|
The default IETF tag to use if the languageKey parameter is excluded from the GetString method.
The object that is being targeted for localization by this table. Localization is applied to it and all of it's descendants.

Functions

Functions [toggle]

stringGetContents ( )

No documentation found.

|RMD member="API:Class/LocalizationTable/GetContents"|No documentation found.|/RMD|
arrayGetEntries ( )

No documentation found.

|RMD member="API:Class/LocalizationTable/GetEntries"|No documentation found.|/RMD|
stringGetString ( string languageKey, string expressionKey )

Returns a translation based on the specified language and key.

|RMD member="API:Class/LocalizationTable/GetString"|Returns a translation based on the specified language and key.|/RMD|
voidRemoveKey ( string key )

No documentation found.

|RMD member="API:Class/LocalizationTable/RemoveKey"|No documentation found.|/RMD|
voidSetContents ( string contents )

No documentation found.

|RMD member="API:Class/LocalizationTable/SetContents"|No documentation found.|/RMD|
voidSetEntry ( string key, string locale, string text )

No documentation found.

|RMD member="API:Class/LocalizationTable/SetEntry"|No documentation found.|/RMD|
No documentation found.
No documentation found.
GetString ( string languageKey, string expressionKey )
Returns a translation based on the specified language and key.
No documentation found.
SetContents ( string contents )
No documentation found.
SetEntry ( string key, string locale, string text )
No documentation found.


|RMD member="API:Class/LocalizationTable"|A LocalizationTable represents a series of static language translations, and is used with the LocalizationService to control text translations in the game. |/RMD|


Example

local LocalizationService = game:GetService("LocalizationService")
local HttpService = game:GetService("HttpService")
 
local function createLocalizationTable(contents)
	local localTable = Instance.new("LocalizationTable")
	localTable.DevelopmentLanguage = LocalizationService.SystemLocaleId
	localTable.Contents = HttpService:JSONEncode(contents)
	return localTable
end
 
local helloWorldTable = createLocalizationTable({
	[1] =
	{
		key = "Hello_World"; -- The 'expressionKey' to be used with GetString
		values = 
		{	-- A dictionary of keys corresponding to IETF language tags, and their translations.
			["ru"] = "Привет мир!";			-- Russian
			["fr"] = "Bonjour le monde!";	-- French
			["de"] = "Hallo Welt!";			-- German
			["en-US"] = "Hello world!";		-- English
			["it"] = "Ciao mondo!";			-- Italian
			["pt-BR"] = "Olá Mundo!";		-- Portuguese
			["ja"] = "「こんにちは世界」"; 		-- Japanese
			["es"] = "Hola Mundo!";			-- Spanish
		}
	}
})
 
print(helloWorldTable:GetString("en-US","Hello_World"))