mortie / swaylock-effects

Swaylock, with fancy effects
MIT License
708 stars 45 forks source link

Locale settings #14

Closed kosciCZ closed 4 years ago

kosciCZ commented 4 years ago

Hello, I am using the packaged version in Fedora 31, and I find it ignoring my locale settings. This is in my config:

clock
timestr=%R
datestr=%A %e. %B %Y

And this is the ouput of the locale command:

LANG=cs_CZ.UTF-8
LC_CTYPE="cs_CZ.UTF-8"
LC_NUMERIC="cs_CZ.UTF-8"
LC_TIME="cs_CZ.UTF-8"
LC_COLLATE="cs_CZ.UTF-8"
LC_MONETARY="cs_CZ.UTF-8"
LC_MESSAGES="cs_CZ.UTF-8"
LC_PAPER="cs_CZ.UTF-8"
LC_NAME="cs_CZ.UTF-8"
LC_ADDRESS="cs_CZ.UTF-8"
LC_TELEPHONE="cs_CZ.UTF-8"
LC_MEASUREMENT="cs_CZ.UTF-8"
LC_IDENTIFICATION="cs_CZ.UTF-8"
LC_ALL=

What I get is "Tuesday 31. March 2020" and I expect "Úterý 31. Březen 2020" per my locale. Interestingly, the time is in the correct timezone. Other applications (likew waybar) use the correct locale. Any idea what can cause this behaviour? Any help would be much appreciated.

mortie commented 4 years ago

Swaylock-effects uses strftime to format date/time strings, and that uses the process' current locale. However, the process' locale has to be set with setlocale, otherwise it will default to the "C" locale.

I pushed a commit which should fix it: https://github.com/mortie/swaylock-effects/commit/152c6381785b30026c0afd1ad58f683a897ebaf8

kosciCZ commented 4 years ago

Thank you so much for such a quick response with a fix!