LocalizationService RobloxLocaleId doesn't fire GetPropertyChangedSignal

When a player changes their In Experience Language, Roblox automatically changes the language in the game’s UI (Except for the Roblox settings menu, which remains the same). Both the RobloxLocaleId and SystemLocaleId properties also do not change, and no events get fired (GetPropertyChangedSignal)

This leaves me no way of being able to detect locale change and take action accordingly.

Note: I do not expect Roblox to automatically fetch the new localization table for the language I just need to know when the localeId changes!!


RobloxStudioBeta_rWvlXJVMSz

2 Likes

I don’t know if it not firing is intended behaviour, but from the announcement when the in-game language switcher was implemented, you are supposed to listen to the translator.LocaleId to change

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.

(Source)

Doing it this way will give you your intended result

local localizationService = game:GetService('LocalizationService')
	
local translator: Translator = localizationService:GetTranslatorForPlayerAsync(game:GetService('Players').LocalPlayer) -- wrap this in a pcall for live game use as it can error

local oldLocaleId = translator.LocaleId

print('Loaded game with LocaleId', oldLocaleId)

translator:GetPropertyChangedSignal('LocaleId'):Connect(function()
	print('Locale was changed: old locale', oldLocaleId, '- new locale', translator.LocaleId)
	
	oldLocaleId = translator.LocaleId
end)
2 Likes

Thanks for the report! I filed a ticket in our internal database.

Hello! Thanks for the post. Would it be possible to try out what @7z99 pointed out? The release of the language switcher should have coincided with the ability to listen to changes for the translator’s localeId for this purpose.

Hello @Dev0mar, would it possible to try out the above to see if it accommodates your use case?

Hello! Seeing as there hasn’t been any activity on this thread for some time, I am going to close this as by design.

My recommendation is to try what cody posted above and see if it suits your use case. If you run into any problems feel free to reopen this post or start a new one. Hope things work out!

1 Like