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.


[Update] October 14, 2022


[Update] October 28, 2022

111 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.

10 Likes

Will this request be considered?

3 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?

26 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)

4 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!

6 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!

20 Likes

Looking forward to the update, it sounds really great.

2 Likes

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

1 Like

FINALLY! I can check faster my translations ingame!

3 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

It means about what languages matter. For example, British English is the only language used in the United Kingdom, while “International English” is based on the United States variant. In other definitions, these cannot be recognized as more different or custom languages.

Hey everyone,

We’re excited to announce that this is live! Players can now toggle between supported languages within an experience.

Studio emulation for this feature will be released in the next few weeks. This feature will allow you to switch languages while playtesting.

All languages you have added support for in the localization settings page will appear in the dropdown.

If you use any Localization APIs in your experience, remember that you will need to make some code changes in order for the language switcher to react properly.

Let us know if you have any feedback or questions!

Thanks.

6 Likes

When the game is loading in, Will it take some time to change from the Original language it was written in to the Translated Language? or will it seem to the Player that it is just Automatic and does not Switch while loading?