* [PATCH] i18n: format_tracking_info "Your branch is behind" message
@ 2012-02-01 17:21 Jiang Xin
2012-02-01 17:39 ` Ævar Arnfjörð Bjarmason
0 siblings, 1 reply; 2+ messages in thread
From: Jiang Xin @ 2012-02-01 17:21 UTC (permalink / raw)
To: Git List, avarab; +Cc: Jiang Xin
Function format_tracking_info in remote.c is called by
wt_status_print_tracking in wt-status.c, which will print
branch tracking message in git-status. git-checkout also
show these messages through it's report_tracking function.
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
---
remote.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/remote.c b/remote.c
index 73a38..51853 100644
--- a/remote.c
+++ b/remote.c
@@ -1572,18 +1572,18 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
base = branch->merge[0]->dst;
base = shorten_unambiguous_ref(base, 0);
if (!num_theirs)
- strbuf_addf(sb, "Your branch is ahead of '%s' "
- "by %d commit%s.\n",
- base, num_ours, (num_ours == 1) ? "" : "s");
+ strbuf_addf(sb, _("Your branch is ahead of '%s' "
+ "by %d %s.\n"),
+ base, num_ours, Q_("commit", "commits", num_ours));
else if (!num_ours)
- strbuf_addf(sb, "Your branch is behind '%s' "
- "by %d commit%s, "
- "and can be fast-forwarded.\n",
- base, num_theirs, (num_theirs == 1) ? "" : "s");
+ strbuf_addf(sb, _("Your branch is behind '%s' "
+ "by %d %s, "
+ "and can be fast-forwarded.\n"),
+ base, num_theirs, Q_("commit", "commits", num_theirs));
else
- strbuf_addf(sb, "Your branch and '%s' have diverged,\n"
+ strbuf_addf(sb, _("Your branch and '%s' have diverged,\n"
"and have %d and %d different commit(s) each, "
- "respectively.\n",
+ "respectively.\n"),
base, num_ours, num_theirs);
return 1;
}
--
1.7.9.3.g1fbd7
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] i18n: format_tracking_info "Your branch is behind" message
2012-02-01 17:21 [PATCH] i18n: format_tracking_info "Your branch is behind" message Jiang Xin
@ 2012-02-01 17:39 ` Ævar Arnfjörð Bjarmason
0 siblings, 0 replies; 2+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2012-02-01 17:39 UTC (permalink / raw)
To: Jiang Xin; +Cc: Git List
On Wed, Feb 1, 2012 at 18:21, Jiang Xin <worldhello.net@gmail.com> wrote:
> Function format_tracking_info in remote.c is called by
> wt_status_print_tracking in wt-status.c, which will print
> branch tracking message in git-status. git-checkout also
> show these messages through it's report_tracking function.
>
> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
> ---
> remote.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/remote.c b/remote.c
> index 73a38..51853 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -1572,18 +1572,18 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
> base = branch->merge[0]->dst;
> base = shorten_unambiguous_ref(base, 0);
> if (!num_theirs)
> - strbuf_addf(sb, "Your branch is ahead of '%s' "
> - "by %d commit%s.\n",
> - base, num_ours, (num_ours == 1) ? "" : "s");
> + strbuf_addf(sb, _("Your branch is ahead of '%s' "
> + "by %d %s.\n"),
> + base, num_ours, Q_("commit", "commits", num_ours));
> else if (!num_ours)
> - strbuf_addf(sb, "Your branch is behind '%s' "
> - "by %d commit%s, "
> - "and can be fast-forwarded.\n",
> - base, num_theirs, (num_theirs == 1) ? "" : "s");
> + strbuf_addf(sb, _("Your branch is behind '%s' "
> + "by %d %s, "
> + "and can be fast-forwarded.\n"),
> + base, num_theirs, Q_("commit", "commits", num_theirs));
These two should be something like:
_Q("Your branch is behind '%s' by %d commit",
"Your branch is behind '%s' by %d commits",
base,
num_theirs);
Otherwise we're imposing word order in the translation.
> else
> - strbuf_addf(sb, "Your branch and '%s' have diverged,\n"
> + strbuf_addf(sb, _("Your branch and '%s' have diverged,\n"
> "and have %d and %d different commit(s) each, "
> - "respectively.\n",
> + "respectively.\n"),
> base, num_ours, num_theirs);
And this is a nice example of where gettext really can't do the right
thing, it only deals with messages with one numeric counter ;/
It's probably best to just pick one, probably the latter one.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-01 17:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-01 17:21 [PATCH] i18n: format_tracking_info "Your branch is behind" message Jiang Xin
2012-02-01 17:39 ` Ævar Arnfjörð Bjarmason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).