dmedvinsky / gsimplecal

Simple and lightweight GTK calendar (BSD license)
http://dmedvinsky.github.io/gsimplecal
Other
198 stars 19 forks source link

Configurable first day of week #40

Closed merwok closed 3 years ago

merwok commented 3 years ago

Hello! It would be useful to have an option for first day of week (or determine it automatically from locale, but I don’t know if that’s possible). In France for example Monday is the start of the week.

With Orage being abandoned, gsimplecal is now the only small, GTK-only calendar app for Debian and derived systems.

dglava commented 3 years ago

That's weird, because it's taking into account the first day of the week according to the locale. Try LC_MESSAGES=fr gsimplecal and see if that displays the desired results.

merwok commented 3 years ago

I use locale fr_CA.UTF-8 and don’t have all other variants installed.

Trying with fr, fr_FR or fr_CA gets:

(process:3524217): Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale.

With fr_CA.UTF-8 I see the days translated, but sunday is first.

dmedvinsky commented 3 years ago

@dglava is right, it should work automatically. But locales are kinda complex, there are multiple environment variables to deal with. There's LANGUAGE, a bunch of LC_* and LANG, each with their own priority. And the one of LC_ ones that affects the dates and times is, I think, LC_TIME, not LC_MESSAGES.

First of all, try executing locale and see what it shows in the output, please.

merwok commented 3 years ago

LANG and all LC_ variables are set to fr_CA.UTF-8; LANGUAGE is fr_CA:fr; LC_ALL is empty.

dmedvinsky commented 3 years ago

Well, what does locale -k LC_TIME say, then? first_weekday line is the one we are interested in, I think.

merwok commented 3 years ago
day="dimanche;lundi;mardi;mercredi;jeudi;vendredi;samedi"
first_weekday=1
first_workday=2

so if that is counting from 1, it means the week starts on sunday?!

merwok commented 3 years ago

I have installed the fr_FR.UTF-8 locale and updated my config to use it for LC_TIME. First day of week is now monday. Thanks for the help!

dmedvinsky commented 3 years ago

Yeah, according to man nl_langinfo, DAY_1 is hardcoded to be a Sunday.

merwok commented 3 years ago

Sorry I don’t understand that message! The start of week is not hard-coded (I forgot to mention that explicitly in my previous message, now edited).

dmedvinsky commented 3 years ago

Yeah, sorry for being vague. I mean that if the locale -k LC_TIME says that first weekday is 1, that always means Sunday, regardless of other keys, because DAY_1 is a constant meaning Sunday.