Skip to content

Commit 4ab9211

Browse files
committed
Merge branch 'mm/status-porcelain-format-i18n-fix'
* mm/status-porcelain-format-i18n-fix: status: disable translation when --porcelain is used
2 parents 1d9aaed + 7a76c28 commit 4ab9211

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
@@ -1547,19 +1547,21 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
15471547
return;
15481548
}
15491549

1550+
#define LABEL(string) (s->no_gettext ? (string) : _(string))
1551+
15501552
color_fprintf(s->fp, header_color, " [");
15511553
if (upstream_is_gone) {
1552-
color_fprintf(s->fp, header_color, _("gone"));
1554+
color_fprintf(s->fp, header_color, LABEL(N_("gone")));
15531555
} else if (!num_ours) {
1554-
color_fprintf(s->fp, header_color, _("behind "));
1556+
color_fprintf(s->fp, header_color, LABEL(N_("behind ")));
15551557
color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
15561558
} else if (!num_theirs) {
1557-
color_fprintf(s->fp, header_color, _("ahead "));
1559+
color_fprintf(s->fp, header_color, LABEL(N_(("ahead "))));
15581560
color_fprintf(s->fp, branch_color_local, "%d", num_ours);
15591561
} else {
1560-
color_fprintf(s->fp, header_color, _("ahead "));
1562+
color_fprintf(s->fp, header_color, LABEL(N_(("ahead "))));
15611563
color_fprintf(s->fp, branch_color_local, "%d", num_ours);
1562-
color_fprintf(s->fp, header_color, _(", behind "));
1564+
color_fprintf(s->fp, header_color, ", %s", LABEL(N_("behind ")));
15631565
color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
15641566
}
15651567

@@ -1604,5 +1606,6 @@ void wt_porcelain_print(struct wt_status *s)
16041606
s->use_color = 0;
16051607
s->relative_paths = 0;
16061608
s->prefix = NULL;
1609+
s->no_gettext = 1;
16071610
wt_shortstatus_print(s);
16081611
}

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)