aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-01-12 17:59:15 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-01-13 10:47:43 +0000
commitd85feb02ed5d16fe55c7573bb4006b414b97d188 (patch)
tree1041e0eb1b9f670b74ace46512418d6682f43f77
parentmain: display warning only, when we succeed in enabling a fallback locale (diff)
main: log locale errors (in addition to adding a user notification)
-rw-r--r--main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/main.c b/main.c
index eb7a5c83..7d57c641 100644
--- a/main.c
+++ b/main.c
@@ -429,11 +429,6 @@ main(int argc, char *const *argv)
bool bad_locale = !locale_is_utf8();
if (bad_locale) {
- LOG_ERR("locale '%s' is not UTF-8", locale);
-
- if (check_config)
- return ret;
-
static const char fallback_locales[][12] = {
"C.UTF-8",
"en_US.UTF-8",
@@ -448,16 +443,23 @@ main(int argc, char *const *argv)
const char *const fallback_locale = fallback_locales[i];
if (setlocale(LC_CTYPE, fallback_locale) != NULL) {
+ LOG_WARN("locale '%s' is not UTF-8, using '%s' instead",
+ locale, fallback_locale);
+
user_notification_add_fmt(
&user_notifications, USER_NOTIFICATION_WARNING,
"locale '%s' is not UTF-8, using '%s' instead",
locale, fallback_locale);
+
bad_locale = false;
break;
}
}
if (bad_locale) {
+ LOG_ERR("locale '%s' is not UTF-8, "
+ "and failed to enable a fallback locale", locale);
+
user_notification_add_fmt(
&user_notifications, USER_NOTIFICATION_ERROR,
"locale '%s' is not UTF-8, "