fheroes2
fheroes2 copied to clipboard
The Load Game list display file's date in a wrong format
Preliminary checks
- [X] I've checked that there aren't other open issues on the same topic.
- [X] I've checked that this issue is reproducible on the latest snapshot build.
Platform
Windows
Describe the bug
I have set the Polish language. My Windows uses Polish culture. And still I can see wrong format date in the Load Game window:

I suppose, the fheroes2 could use the game language or the user OS culture setting.
Save file
To reproduce - pls use non-English language. And then, open the Game Load window and see the list of the files.
Additional info
No response
As far as I can see, the text is set here:

I suppose, the fheroes2 could use the game language or the user OS culture setting.
I believe using OS settings is out of the question since there are many different systems supported like Switch or PS Vita and they don't necessarily have these systems in place, sort of like how setting the game language according to your OS settings isn't easily implemented from what I've read from previous discussions.
Then maybe sth like: if game language is Polish, then use location "pl_PL"? Blind guess...
Hi @oleg-derevenetz , what do you think about feasibility to use locale (language and proper encoding) to solve issue? Do you see any possible problems?
Hi @ihhub
Do you see any possible problems?
Yes. The problem with the locale is that it is a global state and it affects a lot of things - not just formatting, but also parsing. For example, it affects std::isalpha(), std::isalnum(), std::tolower()/std::toupper(), etc, etc, so the results may unexpectedly differ from the default "C" locale. Since it is a global state, it is quite dangerous to manipulate it in a multithreaded code. Some functions from std allow specifying the locale as a parameter, but std::strftime() does not.