I’ve a problem when trying to retrieve the current langage on which the game runs. When I call CurrentCulture.CurrentUICulture, Unity always gives me back “en-us”. However, my Windows is not English but French, and if I run the very same code on a new separate project from Unity, it returns me “fr-FR”, which is right. I really need to retrieve the current language because I’m localizating my game and I need to adapt the display of the date and time to the local standard where the player is living.
This is the code I’ve put in the separate project:
What platform are you on? If you’re on Universal Windows Platform for Windows 10 I use this to get the current languageWindows.System.UserProfile.GlobalizationPreferences.Languages[0]
It may be that your code or Unity sets this property somewhere. Have you tried using CultureInfo.InstalledUICulture instead? That should return the cultureinfo installed with the Os.
The two codes are the same. I’ve already tried to use InstalledUICulture too, and it show the same result. I’m not the only one having this issue, as I’ve put a link to a question from someone else that also have this issue. Maybe Unity runs on it own version of the .net, that would explain why it always return “en-US”.
Some people don’t use Google, and I used the search toolbar at the top of the forum, and I didn’t found something usefull.
If I knew before that those functions were broken, I would have checked the Script References before.
Anyway, thanks for your answers.
SystemLanguage doesn’t fit very well for what I’m doing, because I’d like to adapt the display of the date and time to the locale standard where the player live. So I’ll have to lock everybody with the English way of writing the date/time, unless there is another way to retrieve the player’s OS language.