[evolution] Use e_cal_recur_get_localized_nth() instead of e_cal_recur_nth array



commit 60e8f786891909aac4b930d993770c712949ea30
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 29 18:22:41 2018 +0100

    Use e_cal_recur_get_localized_nth() instead of e_cal_recur_nth array
    
    The now deprecated e_cal_recur_nth array usage with bare _() didn't always
    work, it worked here only due to the same strings being marked for
    translation in the "evolution" translation domain, which avoids
    the intention of not localizing the same string multiple times.

 src/calendar/gui/e-comp-editor-page-recurrence.c |    6 +++---
 src/calendar/gui/print.c                         |   12 +-----------
 2 files changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-page-recurrence.c 
b/src/calendar/gui/e-comp-editor-page-recurrence.c
index 1fc7515..dcbf1e7 100644
--- a/src/calendar/gui/e-comp-editor-page-recurrence.c
+++ b/src/calendar/gui/e-comp-editor-page-recurrence.c
@@ -540,7 +540,7 @@ ecep_recurrence_make_recur_month_num_subtree (GtkTreeStore *store,
 
        for (i = start; i < end; i++) {
                gtk_tree_store_append (store, &iter, &parent);
-               gtk_tree_store_set (store, &iter, 0, _(e_cal_recur_nth[i]), 1, i + 1, -1);
+               gtk_tree_store_set (store, &iter, 0, e_cal_recur_get_localized_nth (i), 1, i + 1, -1);
        }
 }
 
@@ -614,7 +614,7 @@ ecep_recurrence_make_recur_month_num_combo (gint month_index)
 
        /* Current date */
        gtk_tree_store_append (store, &iter, NULL);
-       gtk_tree_store_set (store, &iter, 0, _(e_cal_recur_nth[month_index - 1]), 1, MONTH_NUM_DAY, -1);
+       gtk_tree_store_set (store, &iter, 0, e_cal_recur_get_localized_nth (month_index - 1), 1, 
MONTH_NUM_DAY, -1);
 
        gtk_tree_store_append (store, &iter, NULL);
        /* TRANSLATORS: Entire string is for example: This appointment recurs/Every [x] month(s) on the 
[Other date] [11th to 20th] [17th] [forever]'
@@ -718,7 +718,7 @@ ecep_recurrence_month_num_combo_changed_cb (GtkComboBox *combo,
 
                        g_return_if_fail (gtk_tree_model_iter_nth_child (model, &iter, NULL, month_num));
 
-                       gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, 
_(e_cal_recur_nth[page_recurrence->priv->month_index - 1]), -1);
+                       gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, e_cal_recur_get_localized_nth 
(page_recurrence->priv->month_index - 1), -1);
                        gtk_combo_box_set_active_iter (GTK_COMBO_BOX 
(page_recurrence->priv->month_num_combo), &iter);
                } else {
                        /* top level node */
diff --git a/src/calendar/gui/print.c b/src/calendar/gui/print.c
index 0a4a10b..175adee 100644
--- a/src/calendar/gui/print.c
+++ b/src/calendar/gui/print.c
@@ -661,16 +661,6 @@ enum datefmt {
        DATE_YEAR = 1 << 3
 };
 
-static const gchar *days[] = {
-       N_("1st"), N_("2nd"), N_("3rd"), N_("4th"), N_("5th"),
-       N_("6th"), N_("7th"), N_("8th"), N_("9th"), N_("10th"),
-       N_("11th"), N_("12th"), N_("13th"), N_("14th"), N_("15th"),
-       N_("16th"), N_("17th"), N_("18th"), N_("19th"), N_("20th"),
-       N_("21st"), N_("22nd"), N_("23rd"), N_("24th"), N_("25th"),
-       N_("26th"), N_("27th"), N_("28th"), N_("29th"), N_("30th"),
-       N_("31st")
-};
-
 /*
   format the date 'nicely' and consistently for various headers
 */
@@ -688,7 +678,7 @@ format_date (struct tm *tm,
        if (flags & DATE_DAY) {
                if (flags & DATE_DAYNAME)
                        g_string_append (fmt, " ");
-               g_string_append (fmt, gettext (days[tm->tm_mday - 1]));
+               g_string_append (fmt, e_cal_recur_get_localized_nth (tm->tm_mday - 1));
        }
        if (flags & DATE_MONTH) {
                if (flags & (DATE_DAY | DATE_DAYNAME))


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