How can I autoamtically set in-game language at the launch based on user OS language?

Hi,

I managed to make in-game option to let the player select the language and switch it.

However I cannot figure out a way for my game to automatically detect the OS language and set in-game language based on it at the launch,
unless the user specifically selects the language option.

If possible, I’d like to implement such feature by blueprint rather than C++.

Please let me know if you know how.

Thanks,

300556-

Blueprints has the nodes: GetDefaultLanguage and GetCurrentLanguage which return ISO language identification strings like “en”, “es”, “de”, “fr”, etc.

Also, are you using Unreal’s built-in Localization Dashboard? For me, this would automatically set all Text (not strings) variables to the correct language automatically (once I entered their translations into the Localization Dashboard). The Unreal Dialog assets work the same way.

Thanks for your reply,
Could you elaborate as I’m not sure if I understood what you meant?

I do use Localization Dashboard but the packaged game didn’t detect each user’s PC OS (windows) setting and didn’t set the most appropreate lanugage automatically.

Not sure which part of the Localization Dashboard feature I should utilize.
Also, if I used GetDefaultLanguage node, does it -let’s say if your win pc OS is set as English - return “en”, and if my OS is set as spanish, return “es”?

You can find documentation for any Unreal function by Googling their docs pages. For example according to the docs here: ( UKismetSystemLibrary::GetDefaultLanguage | Unreal Engine 5.2 Documentation ) it states the language strings always starts with

a two-letter ISO 639-1 language code
(eg, “zh”)

(The rest of the string is optional). This other page states that the function gets:

the default language specified by the
OS.

It also mentions, that for some operating systems, you might want to try GetDefaultLocale instead.

What string values are you getting when you try printing them out in your packaged builds?

1 Like

This dont work, the node return the editor default language not the OS