[epiphany/mcatanzaro/locale-crash: 3/3] prefs-dialog: Don't crash when locale has no language name
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/locale-crash: 3/3] prefs-dialog: Don't crash when locale has no language name
- Date: Thu, 7 Mar 2019 03:46:58 +0000 (UTC)
commit 41cb66c7e1b6523533d5685a44a07e15778cec52
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Wed Mar 6 21:14:55 2019 -0600
prefs-dialog: Don't crash when locale has no language name
It's expected that sometimes we might not be able to retrieve a language
name from a given locale. In that case, we could either ignore the
locale, or just give up on displaying a name for it.
We could, if we really wanted to, try harder, assume it's a language
code, and look up the right name for the language code. This is what we
used to do in Epiphany 3.30. But then we have to display such languages
in the current locale, instead of translated like all other languages in
the list, which would look wrong and awkward. We'd also need to make
undesirable modifications to the gnome-desktop code. Since modern
Epiphany doesn't allow creating such locales, and this only affects
users who used the language dialog in older versions of Epiphany
-- probably a very small minority of users -- there's probably no need
to bother with this.
src/prefs-dialog.c | 2 ++
1 file changed, 2 insertions(+)
---
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 9ef2e5515..bd36daccb 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -1600,6 +1600,8 @@ create_language_section (PrefsDialog *dialog)
g_autofree char *normalized_locale = normalize_locale (code);
if (normalized_locale != NULL) {
g_autofree char *language_name = language_for_locale (normalized_locale);
+ if (language_name == NULL)
+ language_name = g_strdup (normalized_locale);
language_editor_add (dialog, normalized_locale, language_name);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]