utils: Use nominative/genitive month names correctly

These changes are needed since the standalone (nominative) vs. full date
format (genitive) month names support has been introduced in Linux with
glibc 2.27.  They are also supported in *BSD systems.

See also:
https://bugzilla.gnome.org/show_bug.cgi?id=749206
https://sourceware.org/bugzilla/show_bug.cgi?id=10871

https://gitlab.gnome.org/GNOME/gnome-calendar/issues/125
This commit is contained in:
Rafal Luzynski
2018-03-05 15:57:03 -03:00
committed by Georges Basile Stavracas Neto
parent e7e693765b
commit e6483e96e2
3 changed files with 54 additions and 18 deletions
+3 -18
View File
@@ -224,20 +224,6 @@ calendar_get_weekday_name (gint i)
return text;
}
/* 0 = january */
static gchar *
calendar_get_month_name (gint i)
{
GDateTime *date;
gchar *text;
date = g_date_time_new_local (2015, i + 1, 1, 1, 1, 1);
text = g_date_time_format (date, "%B");
g_date_time_unref (date);
return text;
}
static void
calendar_init_weekday_display (GcalDateChooser *self)
{
@@ -257,7 +243,7 @@ format_month (GcalMultiChoice *choice,
gint value,
gpointer data)
{
return calendar_get_month_name (value);
return g_strdup (gcal_get_month_name (value));
}
static void
@@ -269,9 +255,8 @@ calendar_init_month_display (GcalDateChooser *self)
for (i = 0; i < 12; i++)
{
month = calendar_get_month_name (i);
months[i] = g_strdup_printf ("%s", month);
g_free (month);
month = gcal_get_month_name (i);
months[i] = g_strdup (month);
}
months[12] = NULL;