diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index f2ec2f78..4b9d606a 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -1122,10 +1122,13 @@ gcal_month_view_draw_grid (GcalMonthView *view, pango_font_description_set_weight (bold_font, PANGO_WEIGHT_SEMIBOLD); for (i = 0; i < 7; i++) { + gchar *weekday; + + weekday = gcal_get_weekday (i); cairo_set_source_rgb (cr, color.red, color.green, color.blue); pango_layout_set_font_description (layout, bold_font); - pango_layout_set_text (layout, gcal_get_weekday (i), -1); + pango_layout_set_text (layout, weekday, -1); pango_cairo_update_layout (cr, layout); pango_layout_get_pixel_size (layout, &font_width, &font_height); diff --git a/src/gcal-utils.c b/src/gcal-utils.c index 3046dc14..dc4c514f 100644 --- a/src/gcal-utils.c +++ b/src/gcal-utils.c @@ -20,12 +20,43 @@ #include "gcal-utils.h" +#include +#include + #include +#include + #include -#include -#include +static const gint +ab_day[7] = +{ + ABDAY_1, + ABDAY_2, + ABDAY_3, + ABDAY_4, + ABDAY_5, + ABDAY_6, + ABDAY_7, +}; + +static const gint +month_item[12] = +{ + MON_1, + MON_2, + MON_3, + MON_4, + MON_5, + MON_6, + MON_7, + MON_8, + MON_9, + MON_10, + MON_11, + MON_12 +}; G_DEFINE_BOXED_TYPE (icaltimetype, icaltime, gcal_dup_icaltime, g_free) @@ -188,20 +219,16 @@ gcal_get_source_uid (GtkTreeModel *model, return uid; } -const gchar* +gchar* gcal_get_weekday (gint i) { - static const char* weekdays [] = - { - N_("Sun"), - N_("Mon"), - N_("Tue"), - N_("Wed"), - N_("Thu"), - N_("Fri"), - N_("Sat") - }; - return _(weekdays[i]); + return nl_langinfo (ab_day[i]); +} + +gchar* +gcal_get_month_name (gint i) +{ + return nl_langinfo (month_item[i + 1]); } GdkPixbuf* diff --git a/src/gcal-utils.h b/src/gcal-utils.h index ee78c752..5e188356 100644 --- a/src/gcal-utils.h +++ b/src/gcal-utils.h @@ -75,7 +75,9 @@ gchar* gcal_get_source_name (GtkTreeModel gchar* gcal_get_source_uid (GtkTreeModel *model, const gchar *name); -const gchar* gcal_get_weekday (gint i); +gchar* gcal_get_weekday (gint i); + +gchar* gcal_get_month_name (gint i); GdkPixbuf* gcal_get_pixbuf_from_color (GdkColor *color); diff --git a/src/gcal-week-view.c b/src/gcal-week-view.c index f0a6bea4..15c1ef9b 100644 --- a/src/gcal-week-view.c +++ b/src/gcal-week-view.c @@ -1176,13 +1176,16 @@ gcal_week_view_draw_header (GcalWeekView *view, for (i = 0; i < 7; i++) { gchar *weekday_header; + gchar *weekday_abv; gint n_day; n_day = start_of_week->day + i; if (n_day > icaltime_days_in_month (start_of_week->month, start_of_week->year)) n_day = n_day - icaltime_days_in_month (start_of_week->month, start_of_week->year); - weekday_header = g_strdup_printf ("%s %d",gcal_get_weekday (i), n_day); + weekday_abv = gcal_get_weekday (i); + weekday_header = g_strdup_printf ("%s %d",weekday_abv, n_day); + pango_layout_set_text (layout, weekday_header, -1); pango_cairo_update_layout (cr, layout); pango_layout_get_pixel_size (layout, NULL, &font_height);