Service · inherits Instance
LocalizationService
Handles automated translation.
About LocalizationService
LocalizationService is the service responsible for handling automated translation.
It is used as a storage for LocalizationTable objects used by
automatic text replacement.
LocalizationService will only use its child LocalizationTables for automatic
text replacement unless GuiBase2d.RootLocalizationTable is specified
on a GUI object or its ancestors.
Properties 2
RobloxLocaleId
: stringReadOnlyNotReplicatedThe locale ID used for localizing core and internal features.This property shows the locale ID used for the localization of core and internal features such as
CoreGui. Returns a string with the two letter code (for example,en-us) for the locale.SystemLocaleId
: stringReadOnlyNotReplicatedThe locale ID that the local player has set for their operating system.This property shows the locale ID that the local player has set for their operating system.
This will return a string with the two letter code (for example, "en-us") for the locale.
See also
Player.LocaleId, the locale ID that a user has set for their Roblox account which is used for localizing in-experience content. This will be a different value when that player's account locale isn't supported for localizing Roblox UI content.
Methods 5
GetCorescriptLocalizations
() → InstancesReturns a list ofLocalizationTableobjects used for localizing core scripts.GetCountryRegionForPlayerAsync
(player: Instance) → stringYieldsReturns country/region code string according to player's client IP geolocation.Returns a country/region code string according to player's client IP geolocation. The supported country/region codes are as follows:
See also:
PolicyService.GetPolicyInfoForPlayerAsync, returns policy information about a player which is based on geolocation, age group and platform
GetTableEntries
(instance: Instance = nil) → ArrayGets all entries used for automated localization.Returns an
Array, where each element of the returnedArrayis itself anArrayof entries in the same format as described inLocalizationTable.GetEntries. The order of the elements in the returnedArrayis the same order that theLocalizationTableswill be searched through to attempt automated localization for the providedInstance. The entry elements within a particularLocalizationTableare returned in an unspecified order.This function returns entries regardless of whether the object is a
GuiBase2dwithGuiBase2d.AutoLocalizeenabled. An object that is aGuiBase2dwill not actually be automatically localized unlessGuiBase2d.AutoLocalizeis enabled.The ordering of the tables is as follows:
- First, it looks for the earliest
GuiBase2dancestor of the object (including the provided object) that has aGuiBase2d.RootLocalizationTable. Tables then append in the same order as described inGuiBase2d.RootLocalizationTableby going up through theLocalizationTableancestors of thatGuiBase2d.RootLocalizationTable. If no suchGuiBase2d.RootLocalizationTableis found, no tables append in this step. Ifinstanceisnil, no tables append in this step. - Next, tables from the
LocalizationTablehierarchy underLocalizationServiceappend. For each childLocalizationTableofLocalizationService, it appends tables going up from the lowest descendantLocalizationTableof the tables parented to the service, all the way up to the children of the service. If there are no children ofLocalizationServicethat areLocalizationTables, then no tables append in this step. - Finally, the cloud
LocalizationTableappends to the array. If there is no cloudLocalizationTable, or the cloudLocalizationTablehas not yet loaded, then no table appends in this step.
This function does not yield. It will not wait until the cloud
LocalizationTablehas loaded.- First, it looks for the earliest
GetTranslatorForLocaleAsync
(locale: string) → InstanceYieldsYields until the cloudLocalizationTablefor the argument locale has been loaded - if available. Returns aTranslatorinstance to be used for translations for the provided locale.This function takes a locale code as an argument and yields until the cloud
LocalizationTablefor that locale has been loaded, if available. It then returns aTranslatorobject which can be used to perform translations for that locale if any are available. The entries used for localization are the entries provided by theLocalizationTablehierarchy underLocalizationServiceas well as the cloud table (if available). This will be the same set of entries returned byClass.LocalizationService:GetTableEntries(nil).This function can error and thus should be wrapped in a
pcall().See also:
LocalizationService.GetTranslatorForPlayergets the translator corresponding to the locale of the provided player. This function is deprecated and should not be used in new work.LocalizationService.GetTranslatorForPlayerAsyncyields until the cloudLocalizationTablefor the locale of the provided player has loaded and then gets the translator corresponding to the locale of the provided player.
GetTranslatorForPlayerAsync
(player: Instance) → InstanceYieldsYields until the cloudLocalizationTablefor the player's locale has been loaded - if available. Returns aTranslatorinstance to be used for translations for the provided locale.This function takes a player as an argument and yields until the cloud
LocalizationTablefor that player's locale has been loaded, if available. It then returns aTranslatorobject which can be used to perform translations for that locale if any are available. The entries used for localization are the entries provided by theLocalizationTablehierarchy underLocalizationServiceas well as the cloud table (if available). This will be the same set of entries returned byClass.LocalizationService:GetTableEntries(nil).This function can error and thus should be wrapped in a
pcall().See also:
LocalizationService.GetTranslatorForPlayer, same functionality as this function except that it does not yield and does not wait until the cloudLocalizationTablefor the player's locale has been loaded. This function is deprecated and should not be used in new work.LocalizationService.GetTranslatorForLocaleAsync, returns a Translator to be used for translations using the provided locale.
LocalizationService also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.