Incorrect LocaleIds Reported In-Game

When in live servers, I have noticed my LocalizationService.SystemLocaleId and LocalizationService.RobloxLocaleId are both reported as "en-us". This happens on both PC and Android.

Screenshot of the reported locales in the developer console in a live server on desktop.

The issue with SystemLocaleId is specific to live servers only. When in Studio, it is correctly reported as "en-gb". RobloxLocaleId is always reported as "en-us", even in Studio. In Studio, this can only be corrected by setting a custom locale in the Player Emulator widget.

Screenshot of the correctly reported SystemLocaleId (and incorrect RobloxLocaleId) in Studio.

Expected behavior

I would expect my SystemLocaleId to accurately report my system locale in-game. On both my phone and computer this is set to "en-gb".

Screenshot of my region settings on Windows 11.

I would also expect my RobloxLocaleId to be reported as "en-gb" if my Account Location is set to “United Kingdom” and Language is set to “English.”

Screenshot of my Roblox account location and language settings.

Device details

Model Surface Pro 9
Processor 12th Gen Intel(R) Core™ i5-1235U
OS Windows 11 Pro (23H2) (22631.3447)
Roblox App Version 0.621.0.6210527 (7c324a)
Roblox Studio Version 0.621.0.6210527 (64bit)
Model Google Pixel 8 Pro
Processor Google Tensor G3
OS Android 14 (AP1A.240405.002)
Roblox App Version 2.620.463 (30f9c8)
1 Like

I should add that this is important because incorrectly reported locales means using methods such as DateTime::FormatLocalTime in conjunction with the reported RobloxLocaleId or SystemLocaleId result in incorrectly formatted dates and times:

Screenshot of an in-game date and time widget displaying the real world local date and time, but it is incorrectly formatted.

The date and time in the above screenshot were formatted using the following snippet:

-- ClockWidget.client.luau
local now = workspace:GetServerTimeNow()
local localTime = DateTime.fromUnixTimestamp(now + ((offset - 1) * 3600))
Date.Text = localTime:FormatLocalTime("L", LocalizationService.SystemLocaleId)
Time.Text = localTime:FormatLocalTime("LT", LocalizationService.SystemLocaleId)

If SystemLocaleId was reported correctly, the date and time should be formatted correctly as "18/04/2024 | 11:41", as can be seen in Studio:

Screenshot of the same date and time widget running in Studio with correctly formatted values.

My Account Location is set to “United Kingdom” and Language is set to “English.” Please see the above screenshot.

1 Like

Maybe I shouldn’t attempt to assist at 6 AM in the morning. :sweat_smile:

1 Like

Just to be absolutely clear: You’re not running this from a server script, are you?

Nope. It’s a LocalScript inside of PlayerGui. Please see the attached code snippet and screenshots in the first reply.

The only involvement the server has is calculating the Player’s UTC offset, which is unrelated to formatting.

1 Like