Merge branch 'mm/status-porcelain-format-i18n-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 8 Apr 2014 19:07:06 +0000 (12:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Apr 2014 19:07:06 +0000 (12:07 -0700)
* mm/status-porcelain-format-i18n-fix:
status: disable translation when --porcelain is used

wt-status.c
wt-status.h
index c89c3bb5373c49490980eba45f5a81707cc79bea..9bf96c3af064bcc71ea62c97018312bd084e9273 100644 (file)
@@ -1542,19 +1542,21 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
                return;
        }
 
+#define LABEL(string) (s->no_gettext ? (string) : _(string))
+
        color_fprintf(s->fp, header_color, " [");
        if (upstream_is_gone) {
-               color_fprintf(s->fp, header_color, _("gone"));
+               color_fprintf(s->fp, header_color, LABEL(N_("gone")));
        } else if (!num_ours) {
-               color_fprintf(s->fp, header_color, _("behind "));
+               color_fprintf(s->fp, header_color, LABEL(N_("behind ")));
                color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
        } else if (!num_theirs) {
-               color_fprintf(s->fp, header_color, _("ahead "));
+               color_fprintf(s->fp, header_color, LABEL(N_(("ahead "))));
                color_fprintf(s->fp, branch_color_local, "%d", num_ours);
        } else {
-               color_fprintf(s->fp, header_color, _("ahead "));
+               color_fprintf(s->fp, header_color, LABEL(N_(("ahead "))));
                color_fprintf(s->fp, branch_color_local, "%d", num_ours);
-               color_fprintf(s->fp, header_color, _(", behind "));
+               color_fprintf(s->fp, header_color, ", %s", LABEL(N_("behind ")));
                color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
        }
 
@@ -1599,5 +1601,6 @@ void wt_porcelain_print(struct wt_status *s)
        s->use_color = 0;
        s->relative_paths = 0;
        s->prefix = NULL;
+       s->no_gettext = 1;
        wt_shortstatus_print(s);
 }
index 30a481258366733ad5d6a65e3a9c3ae1ee74e833..82f6ce64f8312f9d02e6dc08d46ec8af96a311a3 100644 (file)
@@ -50,6 +50,7 @@ struct wt_status {
        enum commit_whence whence;
        int nowarn;
        int use_color;
+       int no_gettext;
        int display_comment_prefix;
        int relative_paths;
        int submodule_summary;