Skip to content

Fix locale lookup in is_workday()

Michael Catanzaro requested to merge mcatanzaro/#424 into master

Trying to use environment variables to guess the locale was a good attempt, but this is tricky because they have to be looked up in a certain order: first LC_ALL, then fallback to LC_TIME, and finally LANG, which was missed here. This caused a huge warning spam on the year view when only LANG is set, and usually only LANG should be set since the other environment variables are usually used for temporary overrides. Instead, query the locale using setlocale().

Also, don't assert if the locale is shorter than expected (missing territory code) since there is at least one valid locale that does not have any territory codes (Esperanto).

Merge request reports