[gnome-control-center] common: Display locale @modifiers properly
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] common: Display locale @modifiers properly
- Date: Mon, 21 Sep 2020 13:13:30 +0000 (UTC)
commit 5aee280a29eab749b917b871bb6ef70d7b490451
Author: Gunnar Hjalmarsson <gunnarhj ubuntu com>
Date: Mon Sep 21 13:13:10 2020 +0000
common: Display locale @modifiers properly
Fixes GNOME/gnome-desktop#50
meson.build | 2 +-
panels/common/cc-language-chooser.c | 24 +++++++++++++++++++++---
2 files changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9d9cf9133..6e31acfe1 100644
--- a/meson.build
+++ b/meson.build
@@ -122,7 +122,7 @@ colord_dep = dependency('colord', version: '>= 0.1.34')
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0', version: '>= 2.23.0')
gio_dep = dependency('gio-2.0')
glib_dep = dependency('glib-2.0', version: '>= 2.56.0')
-gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.27.90')
+gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.33.4')
gnome_settings_dep = dependency('gnome-settings-daemon', version: '>= 3.27.90')
goa_dep = dependency('goa-1.0', version: goa_req_version)
gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.37.1')
diff --git a/panels/common/cc-language-chooser.c b/panels/common/cc-language-chooser.c
index 919cb1c6b..684367b22 100644
--- a/panels/common/cc-language-chooser.c
+++ b/panels/common/cc-language-chooser.c
@@ -52,6 +52,23 @@ struct _CcLanguageChooser {
G_DEFINE_TYPE (CcLanguageChooser, cc_language_chooser, GTK_TYPE_DIALOG)
+static gchar *
+get_language_label (const gchar *language_code,
+ const gchar *modifier,
+ const gchar *locale_id)
+{
+ g_autofree gchar *language = NULL;
+
+ language = gnome_get_language_from_code (language_code, locale_id);
+
+ if (modifier == NULL)
+ return g_steal_pointer (&language);
+ else {
+ g_autofree gchar *t_mod = gnome_get_translated_modifier (modifier, locale_id);
+ return g_strdup_printf ("%s — %s", language, t_mod);
+ }
+}
+
static GtkWidget *
language_widget_new (const gchar *locale_id,
gboolean is_extra)
@@ -62,16 +79,17 @@ language_widget_new (const gchar *locale_id,
g_autofree gchar *country = NULL;
g_autofree gchar *language_local = NULL;
g_autofree gchar *country_local = NULL;
+ g_autofree gchar *modifier = NULL;
GtkWidget *row;
GtkWidget *box;
GtkWidget *language_label;
GtkWidget *check;
GtkWidget *country_label;
- gnome_parse_locale (locale_id, &language_code, &country_code, NULL, NULL);
- language = gnome_get_language_from_code (language_code, locale_id);
+ gnome_parse_locale (locale_id, &language_code, &country_code, NULL, &modifier);
+ language = get_language_label (language_code, modifier, locale_id);
country = gnome_get_country_from_code (country_code, locale_id);
- language_local = gnome_get_language_from_code (language_code, NULL);
+ language_local = get_language_label (language_code, modifier, NULL);
country_local = gnome_get_country_from_code (country_code, NULL);
row = gtk_list_box_row_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]