diff options
author | Matthieu Moy <Matthieu.Moy@imag.fr> | 2014-03-20 13:12:41 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-26 12:56:30 -0700 |
commit | 7a76c28ff29d6f819bb0bf9852b858f974b5c53a (patch) | |
tree | 4984072cbb3ef9bd68991161b16bf640e7b2c6ac | |
parent | 7bbc4e8fdb33e0a8e42e77cc05460d4c4f615f4d (diff) | |
download | git-7a76c28ff29d6f819bb0bf9852b858f974b5c53a.tar.gz git-7a76c28ff29d6f819bb0bf9852b858f974b5c53a.tar.xz |
status: disable translation when --porcelain is used
"git status --branch --porcelain" displays the status of the branch
(ahead, behind, gone), and used gettext to translate the string.
Use hardcoded strings when --porcelain is used, but keep the gettext
translation for "git status --short" which is essentially the same, but
meant to be read by a human.
Reported-by: Anarky <ghostanarky@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | wt-status.c | 13 | ||||
-rw-r--r-- | wt-status.h | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/wt-status.c b/wt-status.c index 85390b813..b53ce330b 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1483,19 +1483,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); } @@ -1540,5 +1542,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); } diff --git a/wt-status.h b/wt-status.h index 30a481258..82f6ce64f 100644 --- a/wt-status.h +++ b/wt-status.h @@ -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; |