Localization API Update for Upcoming In-Experience Language Switcher

Hi Devs!

We are excited to announce that we’ll be rolling out an update in the next few weeks which enables users to change their language settings while they are in an experience. Players will be able to toggle between supported languages using the in-experience menu.

Any GUI object that has the AutoLocalize property set to True will automatically be translated when a player switches languages in an experience. However, any localization performed by scripting (using Localization APIs) will need to be updated to react properly when a user changes their language.

You will need to detect a change in the LocaleID of the Translator instance returned by GetTranslatorForPlayerAsync. This is done using the GetPropertyChangedSignal event, which can call listeners to update translations as necessary.

local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer

-- If GetTranslatorForPlayerAsync does not error, it will return a Translator for player's current locale
local res, translator = pcall(function()
	return LocalizationService:GetTranslatorForPlayerAsync(player)
end)

-- Function that gets called when change in player's locale ID is detected
local function OnLocaleIdChanged()
	print("Translator has changed to: " .. translator.LocaleId)
	-- You should re-translate any assets translated with Localization APIs to the player's new language here
end

-- Check if GetTranslatorForPlayerAsync succeeded
if res then
	-- If succeeded, translate assets here using translator	
	-- Listen for a change in player's locale ID
	translator:GetPropertyChangedSignal("LocaleId"):Connect(OnLocaleIdChanged)
else
	print('GetTranslatorForPlayerAsync failed: ' .. translator)
end

See Reacting to Users Switching Languages in our documentation for additional implementation details.

Making these code changes will not interrupt any existing functionality, but you will not be able to test the listener function until language switcher emulation becomes available in Studio. We plan to roll emulation out alongside the feature in a few weeks.

Please leave any feedback or questions below!

Thank you.

97 Likes

This topic was automatically opened after 10 minutes.

FINALLY! No need to rejoin the game just to change the language of the game. This is something I’ve been looking forward to since localization first came out. Hopefully we can see some more QOL stuff for the localization portal that desperately needs some love right now.

9 Likes

Will this request be considered?

2 Likes

My Roblox game, UNOfficial has options for variations of languages (such as English (Non-US) and Portuguese (Portugal)). Will there be an option to add custom language options so I can implement this feature in the menu instead of using a custom system?

23 Likes

They mean languages that may not be officially recognised as “real” languages, such as variations of languages (like how basically every English-speaking country uses a different English version to the US)

3 Likes

:tada:
This is a great QoL feature for both players and Translators.
This feature makes Localization QA way easier by being able to see differences between source and target language without changing language and rejoining

3 Likes

I actually made a tool to do this for testing 4 years ago using a workaround I found, but I believe it only worked if you used localization tables instead of the translator portal. Better late than never I guess, and now it is a native feature!

5 Likes

Right now, the feature will only include Roblox-supported languages that you’ve enabled for your experience. But this is a great point and we can definitely look into supporting custom languages in future versions!

18 Likes

Looking forward to the update, it sounds really great.

1 Like

Not bad, I’ll definitely use this on my experiences.

1 Like

FINALLY! I can check faster my translations ingame!

2 Likes

As a player and a developer, I love this.

This will benefit especially multilingual users as they will be able to choose a translation that’s the most accurate (or no translation).

I am still waiting for light mode. I still do not even know if you guys are planning to add it.
While this isn’t an issue with the new Create page, in case of documentation forced dark mode is unacceptable.

2 Likes

Great update, I only have one concern:

From the image on this page it seems like this setting is going to be the top-most setting in the settings menu, if so, this will shift all other (arguably more regularly used) settings such as volume and graphics quality down. This would require more scrolling from me every time I wish to change a setting like volume, which I do every time I visit a Roblox game, which makes my flow as a Roblox player less efficient.

1 Like

One thing to consider that despite it being infrequently used, the language setting is in the unique position where people will sometimes need to find it without being able to read the rest of the text so apps/programs putting that setting in a prime position has additional value.

9 Likes

Great update! Many players in my country hate the machine translation so switching back to English is wonderful for them

1 Like

I agree! Now we do not have to search up Hello In english to Hello in (Other Language Here)

4 Likes