From b5a911421fbacc0e937264919ad4718f2fc4de14 Mon Sep 17 00:00:00 2001
From: Baptiste Jonglez <baptiste--git@jonglez.org>
Date: Fri, 25 May 2012 13:17:37 +0200
Subject: Fix incorrect i18n usage for some strings

Some strings are initialized without wrapping them in _(); instead,
_() is applied on the variable when it is used.

This is incorrect, since these strings don't get added to the catalog.
Fix that by applying _() only once, when the string is declared.

Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
---
 src/args.c     |  8 ++++----
 src/calendar.c |  4 ++--
 src/custom.c   |  2 +-
 src/day.c      | 24 ++++++++++++------------
 src/recur.c    |  4 ++--
 src/utils.c    |  2 +-
 6 files changed, 22 insertions(+), 22 deletions(-)

(limited to 'src')

diff --git a/src/args.c b/src/args.c
index 99c468f..a569e2a 100644
--- a/src/args.c
+++ b/src/args.c
@@ -483,9 +483,9 @@ date_arg(const char *ddate, int add_line, const char *fmt_apt,
       char outstr[BUFSIZ];
       fputs(_("Argument to the '-d' flag is not valid\n"), stderr);
       snprintf(outstr, BUFSIZ,
-               "Possible argument format are: '%s' or 'n'\n",
+               _("Possible argument format are: '%s' or 'n'\n"),
                DATEFMT_DESC(conf.input_datefmt));
-      fputs(_(outstr), stdout);
+      fputs(outstr, stdout);
       more_info();
     }
   }
@@ -539,9 +539,9 @@ date_arg_extended(const char *startday, const char *range, int add_line,
     char outstr[BUFSIZ];
     fputs(_("Argument is not valid\n"), stderr);
     snprintf(outstr, BUFSIZ,
-             "Argument format for -s and --startday is: '%s'\n",
+             _("Argument format for -s and --startday is: '%s'\n"),
              DATEFMT_DESC(conf.input_datefmt));
-    fputs(_(outstr), stdout);
+    fputs(outstr, stdout);
     fputs(_("Argument format for -r and --range is: 'n'\n"), stdout);
     more_info();
   }
diff --git a/src/calendar.c b/src/calendar.c
index 7328718..be39f38 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -582,11 +582,11 @@ void calendar_change_day(int datefmt)
       _("The day you entered is not valid "
         "(should be between 01/01/1902 and 12/31/2037)");
   const char *mesg_line2 = _("Press [ENTER] to continue");
-  const char *request_date = "Enter the day to go to [ENTER for today] : %s";
+  const char *request_date = _("Enter the day to go to [ENTER for today] : %s");
 
   while (wrong_day) {
     snprintf(outstr, BUFSIZ, request_date, DATEFMT_DESC(datefmt));
-    status_mesg(_(outstr), "");
+    status_mesg(outstr, "");
     if (getstring(win[STA].p, selected_day, LDAY, 0, 1) == GETSTRING_ESC)
       return;
     else {
diff --git a/src/custom.c b/src/custom.c
index e407b00..e6f7d3d 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -1044,7 +1044,7 @@ void custom_config_main(void)
       else {
         colorize = 0;
         wins_erase_status_bar();
-        mvwprintw(win[STA].p, 0, 0, _(no_color_support));
+        mvwprintw(win[STA].p, 0, 0, no_color_support);
         wgetch(win[STA].p);
       }
       break;
diff --git a/src/day.c b/src/day.c
index c542c46..524d4c1 100644
--- a/src/day.c
+++ b/src/day.c
@@ -718,9 +718,9 @@ static void update_rept(struct rpt **rpt, const long start)
   while (newfreq == 0);
 
   do {
-    snprintf(outstr, BUFSIZ, "Enter the new ending date: [%s] or '0'",
+    snprintf(outstr, BUFSIZ, _("Enter the new ending date: [%s] or '0'"),
              DATEFMT_DESC(conf.input_datefmt));
-    status_mesg(_(outstr), "");
+    status_mesg(outstr, "");
     timstr = date_sec2date_str((*rpt)->until, DATEFMT(conf.input_datefmt));
     if (updatestring(win[STA].p, &timstr, 0, 1) != GETSTRING_VALID) {
       mem_free(timstr);
@@ -751,7 +751,7 @@ static void update_rept(struct rpt **rpt, const long start)
           date_entered = 1;
       } else {
         snprintf(outstr, BUFSIZ, msg_fmts, DATEFMT_DESC(conf.input_datefmt));
-        status_mesg(msg_wrong_date, _(outstr));
+        status_mesg(msg_wrong_date, outstr);
         wgetch(win[STA].p);
         date_entered = 0;
       }
@@ -785,8 +785,8 @@ void day_edit_item(void)
   case RECUR_EVNT:
     re = recur_get_event(date, day_item_nb(date, item_num, RECUR_EVNT));
     const char *choice_recur_evnt[2] = {
-      "Description",
-      "Repetition",
+      _("Description"),
+      _("Repetition"),
     };
     switch (status_ask_simplechoice(_("Edit: "), choice_recur_evnt, 2)) {
     case 1:
@@ -806,10 +806,10 @@ void day_edit_item(void)
   case RECUR_APPT:
     ra = recur_get_apoint(date, day_item_nb(date, item_num, RECUR_APPT));
     const char *choice_recur_appt[4] = {
-      "Start time",
-      "End time",
-      "Description",
-      "Repetition",
+      _("Start time"),
+      _("End time"),
+      _("Description"),
+      _("Repetition"),
     };
     switch (status_ask_simplechoice(_("Edit: "), choice_recur_appt, 4)) {
     case 1:
@@ -835,9 +835,9 @@ void day_edit_item(void)
   case APPT:
     a = apoint_get(date, day_item_nb(date, item_num, APPT));
     const char *choice_appt[3] = {
-      "Start time",
-      "End time",
-      "Description",
+      _("Start time"),
+      _("End time"),
+      _("Description"),
     };
     switch (status_ask_simplechoice(_("Edit: "), choice_appt, 3)) {
     case 1:
diff --git a/src/recur.c b/src/recur.c
index dad9c25..e8ddffc 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -867,7 +867,7 @@ void recur_repeat_item(void)
 
   while (!date_entered) {
     snprintf(outstr, BUFSIZ, mesg_until_1, DATEFMT_DESC(conf.input_datefmt));
-    status_mesg(_(outstr), "");
+    status_mesg(outstr, "");
     if (getstring(win[STA].p, user_input, BUFSIZ, 0, 1) == GETSTRING_VALID) {
       if (strlen(user_input) == 1 && strcmp(user_input, "0") == 0) {
         until = 0;
@@ -891,7 +891,7 @@ void recur_repeat_item(void)
         } else {
           snprintf(outstr, BUFSIZ, mesg_wrong_2,
                    DATEFMT_DESC(conf.input_datefmt));
-          status_mesg(mesg_wrong_1, _(outstr));
+          status_mesg(mesg_wrong_1, outstr);
           wgetch(win[STA].p);
           date_entered = 0;
         }
diff --git a/src/utils.c b/src/utils.c
index b3d9c71..bf950aa 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -253,7 +253,7 @@ status_ask_simplechoice(const char *prefix, const char *choice[], int nb_choice)
 
   for (i = 0; i < nb_choice; i++) {
     snprintf(tmp, BUFSIZ, ((i + 1) == nb_choice) ? "(%d) %s?" : "(%d) %s, ",
-             (i + 1), _(choice[i]));
+             (i + 1), choice[i]);
     strcat(choicestr, tmp);
   }
 
-- 
cgit v1.2.3-70-g09d2