region: Set LC_ specific variables, not LC_ALL

This commit is contained in:
Rodrigo Moya 2011-07-07 18:20:56 +02:00
parent 51641785d7
commit 46c1dfe664
2 changed files with 23 additions and 3 deletions

View file

@ -50,10 +50,10 @@ selection_changed_cb (GtkComboBox *combo, gpointer user_data)
GtkBuilder *builder = GTK_BUILDER (user_data);
active_id = gtk_combo_box_get_active_id (combo);
if (!active_id)
if (!active_id || !active_id[0])
return;
locale = setlocale (LC_ALL, active_id);
locale = setlocale (LC_TIME, active_id);
dt = g_date_time_new_now_local ();
@ -67,18 +67,26 @@ selection_changed_cb (GtkComboBox *combo, gpointer user_data)
display_date (GTK_LABEL (gtk_builder_get_object (builder, "full_time_format")), dt, "%r %Z");
display_date (GTK_LABEL (gtk_builder_get_object (builder, "short_time_format")), dt, "%X");
setlocale (LC_TIME, locale);
/* Display numbers */
locale = setlocale (LC_NUMERIC, active_id);
s = g_strdup_printf ("%'.2f", 123456789.00);
gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "numbers_format")), s);
g_free (s);
setlocale (LC_NUMERIC, locale);
/* Display currency and measurement */
locale = setlocale (LC_MONETARY, active_id);
num_info = localeconv ();
if (num_info != NULL) {
gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "currency_format")), num_info->currency_symbol);
}
setlocale (LC_ALL, locale);
setlocale (LC_MONETARY, locale);
}
void

View file

@ -916,6 +916,7 @@ default settings</property>
<packing>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -929,6 +930,7 @@ default settings</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -943,6 +945,7 @@ default settings</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -958,6 +961,7 @@ default settings</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -972,6 +976,7 @@ default settings</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -987,6 +992,7 @@ default settings</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
</object>
@ -1039,6 +1045,7 @@ default settings</property>
<packing>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -1052,6 +1059,7 @@ default settings</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -1066,6 +1074,7 @@ default settings</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -1081,6 +1090,7 @@ default settings</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -1095,6 +1105,7 @@ default settings</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
@ -1110,6 +1121,7 @@ default settings</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
</object>