"LocalizationService.RobloxLocaleId" returning English?

No need for help, managed to solve it myself, haha!

So I added multi-language support on my latest game, and out of nowhere, every time I try checking what language the local player is on, it always ends up returning English. (Or in that case, ‘en-us’)

This function is running on client:

function CheckLanguage()
	local Success, Data = pcall(function()
		if LocalizationService.RobloxLocaleId == 'es-es' then
			return 'Spanish'
		elseif LocalizationService.RobloxLocaleId == 'de-de' then
			return 'German'
		elseif LocalizationService.RobloxLocaleId == 'nl-nl' then
			return 'Dutch'
		elseif LocalizationService.RobloxLocaleId == 'ru-ru' then
			return 'Russian'
		elseif LocalizationService.RobloxLocaleId == 'pt-br' then
			return 'Portugese'
		else
			return 'English'
		end
	end)
	if Success then
        print(Data)
		return Data
	end
end

I tested this by setting my language to “Russian”, and joining the game.

Any help is needed, and will be grateful! :sweat_smile: :+1:

1 Like

try to add print(LocalizationService.RobloxLocaleId) and see what it outputs

yo, sorry for reviving this thread. Im having the same issue, do you remember how you fixed it? much appreciated

1 Like

No worries lol. It’s been a while so I don’t recall exactly how I came to this solution, but I just moved the statements around until it worked:

function CheckLanguage()
	local Success, Data = pcall(function()
		if LocalizationService.RobloxLocaleId == 'es-es' then
			return 'Spanish'
		elseif LocalizationService.RobloxLocaleId == 'de-de' then
			return 'German'
		elseif LocalizationService.RobloxLocaleId == 'nl-nl' then
			return 'Dutch'
		elseif LocalizationService.RobloxLocaleId == 'ru-ru' then
			return 'Russian'
		elseif LocalizationService.RobloxLocaleId == 'pt-br' then
			return 'Portugese'
		end
	end)
	if Success then
		return Data
	else
		return 'English'
	end
end

print(CheckLanguage());