Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 360f852

Browse files
committed
Merge branch 'mm/status-porcelain-format-i18n-fix' into maint
* mm/status-porcelain-format-i18n-fix: status: disable translation when --porcelain is used
2 parents 86b4c16 + 7a76c28 commit 360f852

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

wt-status.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,19 +1542,21 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
15421542
return;
15431543
}
15441544

1545+
#define LABEL(string) (s->no_gettext ? (string) : _(string))
1546+
15451547
color_fprintf(s->fp, header_color, " [");
15461548
if (upstream_is_gone) {
1547-
color_fprintf(s->fp, header_color, _("gone"));
1549+
color_fprintf(s->fp, header_color, LABEL(N_("gone")));
15481550
} else if (!num_ours) {
1549-
color_fprintf(s->fp, header_color, _("behind "));
1551+
color_fprintf(s->fp, header_color, LABEL(N_("behind ")));
15501552
color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
15511553
} else if (!num_theirs) {
1552-
color_fprintf(s->fp, header_color, _("ahead "));
1554+
color_fprintf(s->fp, header_color, LABEL(N_(("ahead "))));
15531555
color_fprintf(s->fp, branch_color_local, "%d", num_ours);
15541556
} else {
1555-
color_fprintf(s->fp, header_color, _("ahead "));
1557+
color_fprintf(s->fp, header_color, LABEL(N_(("ahead "))));
15561558
color_fprintf(s->fp, branch_color_local, "%d", num_ours);
1557-
color_fprintf(s->fp, header_color, _(", behind "));
1559+
color_fprintf(s->fp, header_color, ", %s", LABEL(N_("behind ")));
15581560
color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
15591561
}
15601562

@@ -1599,5 +1601,6 @@ void wt_porcelain_print(struct wt_status *s)
15991601
s->use_color = 0;
16001602
s->relative_paths = 0;
16011603
s->prefix = NULL;
1604+
s->no_gettext = 1;
16021605
wt_shortstatus_print(s);
16031606
}

wt-status.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct wt_status {
5050
enum commit_whence whence;
5151
int nowarn;
5252
int use_color;
53+
int no_gettext;
5354
int display_comment_prefix;
5455
int relative_paths;
5556
int submodule_summary;

0 commit comments

Comments
 (0)