Manual Localization? (Manual Language Selection)

Hello! Thank you for taking your time to read my post.

What I’m trying to accomplish is manual localization. I was wondering can you retrieve the translations from a Localization Table or would I need to go about it differently?

An example can see in Roblox Deathrun:

Thanks,
Bylocks

4 Likes

The LocalizationTable object has a method called GetTranslator that you can pass a locale ID into, and a Translator object will be returned:

local Translator = Table:GetTranslator("en-us")

For using :GetTranslator() I did this, it isn’t working because the Context is a string value and needs to be an Instance.

local Translator = game:GetService("LocalizationService").GeneratedLocalizationTable:GetTranslator("es-es")

for i,v in pairs(game:GetService("LocalizationService").GeneratedLocalizationTable:GetEntries()) do
	Translator:Translate(v["Context"], v["Source"])
end

What you would do is loop over TextLabels, TextButtons, etc and then feed that object as the Context, not the stringified version of the context that is present in the localization table. You’d put the result of the :Translate call in the Text field of those objects.

Oh shoot I forgot isn’t translate not enabled yet?

Correct but even so your code would not be doing anything to begin with. You don’t do anything with the return value of Translate, all you are doing is looping over your localization table.

Yea I figured this out at 1 am this morning after the post. I’ve decided to use FormatByKey instead.