Use standalone Month format when appropriate
Some locales use different strings for the months depending if they are accompanied by a numberic date or not. When we use the month name as a standalone, we should use %OB instead to accomodate for these locales. For more see: https://docs.gtk.org/glib/method.DateTime.format.html Close #1546 Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/705>
This commit is contained in:
committed by
Marge Bot
parent
63879a0d63
commit
b900a65760
@@ -99,11 +99,11 @@ gcal_calendar_navigation_button_set_property (GObject *object,
|
|||||||
gcal_clear_date_time (&self->active_date);
|
gcal_clear_date_time (&self->active_date);
|
||||||
self->active_date = g_date_time_ref (g_value_get_boxed (value));
|
self->active_date = g_date_time_ref (g_value_get_boxed (value));
|
||||||
/*
|
/*
|
||||||
* Translators: %B is the month name and %Y is the year.
|
* Translators: %OB is the month name and %Y is the year.
|
||||||
* More formats can be found on the doc:
|
* More formats can be found on the doc:
|
||||||
* https://docs.gtk.org/glib/method.DateTime.format.html
|
* https://docs.gtk.org/glib/method.DateTime.format.html
|
||||||
*/
|
*/
|
||||||
gtk_menu_button_set_label (self->button, g_date_time_format (self->active_date, _ ("%B %Y")));
|
gtk_menu_button_set_label (self->button, g_date_time_format (self->active_date, _ ("%OB %Y")));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ACTIVE:
|
case PROP_ACTIVE:
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ update_weather (GcalMonthCell *self)
|
|||||||
/* No risk of conflicting with the weather forecast labels in their absence, use the full month name label */
|
/* No risk of conflicting with the weather forecast labels in their absence, use the full month name label */
|
||||||
if (day_of_month == 1)
|
if (day_of_month == 1)
|
||||||
{
|
{
|
||||||
g_autofree gchar *month_name = g_date_time_format (self->date, "%B");
|
g_autofree gchar *month_name = g_date_time_format (self->date, "%OB");
|
||||||
gtk_label_set_text (self->day_label, month_name);
|
gtk_label_set_text (self->day_label, month_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,7 +519,7 @@ gcal_month_cell_set_date (GcalMonthCell *self,
|
|||||||
|
|
||||||
if (day_of_month == 1)
|
if (day_of_month == 1)
|
||||||
{
|
{
|
||||||
g_autofree gchar *month_name = g_date_time_format (date, "%B");
|
g_autofree gchar *month_name = g_date_time_format (date, "%OB");
|
||||||
gtk_label_set_text (self->day_label, month_name);
|
gtk_label_set_text (self->day_label, month_name);
|
||||||
gtk_widget_add_css_class (GTK_WIDGET (self->day_label), "first-day");
|
gtk_widget_add_css_class (GTK_WIDGET (self->day_label), "first-day");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user