[gnome-control-center/mwleeds/region-update-locale-format: 267/267] region: update the locale format along with the language when it changes




commit 9a89eb28f79ee4f8bbd5c61aa71a293f64fff6e6
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Thu Mar 19 17:00:08 2015 +0000

    region: update the locale format along with the language when it changes
    
    Not doing this will lead to (probably undesired) inconsistencies when
    changing the language, since many locale-dependant strings will still be
    rendered considering the previous language format (e.g. days of the week).
    
    Note 2020-08-26: This patch has been in Endless OS since 2015, proposing
      it upstream. - mwleeds

 panels/region/cc-region-panel.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index 7fe03ee64..3c8f03d34 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -80,6 +80,8 @@ struct _CcRegionPanel {
 
 CC_PANEL_REGISTER (CcRegionPanel, cc_region_panel)
 
+static void update_region (CcRegionPanel *self, const gchar *region);
+
 static void
 cc_region_panel_finalize (GObject *object)
 {
@@ -324,6 +326,9 @@ language_response (CcRegionPanel     *self,
         if (response_id == GTK_RESPONSE_OK) {
                 language = cc_language_chooser_get_language (chooser);
                 update_language (self, language);
+
+                /* Keep format strings consistent with the user's language */
+                update_region (self, NULL);
         }
 
         gtk_widget_destroy (GTK_WIDGET (chooser));
@@ -351,7 +356,10 @@ update_region (CcRegionPanel *self,
         } else {
                 if (g_strcmp0 (region, self->region) == 0)
                         return;
-                g_settings_set_string (self->locale_settings, KEY_REGION, region);
+                if (region == NULL || region[0] == '\0')
+                        g_settings_reset (self->locale_settings, KEY_REGION);
+                else
+                        g_settings_set_string (self->locale_settings, KEY_REGION, region);
                 if (self->login_auto_apply)
                         set_system_region (self, region);
                 maybe_notify (self, LC_TIME, region);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]