mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-11 05:33:55 -04:00
main: log locale errors (in addition to adding a user notification)
This commit is contained in:
parent
2bc77ebf09
commit
d85feb02ed
1 changed files with 7 additions and 5 deletions
12
main.c
12
main.c
|
|
@ -429,11 +429,6 @@ main(int argc, char *const *argv)
|
||||||
|
|
||||||
bool bad_locale = !locale_is_utf8();
|
bool bad_locale = !locale_is_utf8();
|
||||||
if (bad_locale) {
|
if (bad_locale) {
|
||||||
LOG_ERR("locale '%s' is not UTF-8", locale);
|
|
||||||
|
|
||||||
if (check_config)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
static const char fallback_locales[][12] = {
|
static const char fallback_locales[][12] = {
|
||||||
"C.UTF-8",
|
"C.UTF-8",
|
||||||
"en_US.UTF-8",
|
"en_US.UTF-8",
|
||||||
|
|
@ -448,16 +443,23 @@ main(int argc, char *const *argv)
|
||||||
const char *const fallback_locale = fallback_locales[i];
|
const char *const fallback_locale = fallback_locales[i];
|
||||||
|
|
||||||
if (setlocale(LC_CTYPE, fallback_locale) != NULL) {
|
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_notification_add_fmt(
|
||||||
&user_notifications, USER_NOTIFICATION_WARNING,
|
&user_notifications, USER_NOTIFICATION_WARNING,
|
||||||
"locale '%s' is not UTF-8, using '%s' instead",
|
"locale '%s' is not UTF-8, using '%s' instead",
|
||||||
locale, fallback_locale);
|
locale, fallback_locale);
|
||||||
|
|
||||||
bad_locale = false;
|
bad_locale = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bad_locale) {
|
if (bad_locale) {
|
||||||
|
LOG_ERR("locale '%s' is not UTF-8, "
|
||||||
|
"and failed to enable a fallback locale", locale);
|
||||||
|
|
||||||
user_notification_add_fmt(
|
user_notification_add_fmt(
|
||||||
&user_notifications, USER_NOTIFICATION_ERROR,
|
&user_notifications, USER_NOTIFICATION_ERROR,
|
||||||
"locale '%s' is not UTF-8, "
|
"locale '%s' is not UTF-8, "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue