* bug: incorrect plurality of "commit" in git status
@ 2016-05-02 22:46 Alfonsogonzalez, Ernesto (GE Digital)
2016-05-03 0:12 ` [PATCH] remote.c: specify correct plural form in "commit diverge" message Nguyễn Thái Ngọc Duy
0 siblings, 1 reply; 8+ messages in thread
From: Alfonsogonzalez, Ernesto (GE Digital) @ 2016-05-02 22:46 UTC (permalink / raw)
To: git@vger.kernel.org
[debian-vm]$ gt
On branch feat/junit-test
Your branch and 'origin/feat/junit-test' have diverged,
and have 19 and 1 different commit each, respectively.
Should be "commits"
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] remote.c: specify correct plural form in "commit diverge" message
2016-05-02 22:46 bug: incorrect plurality of "commit" in git status Alfonsogonzalez, Ernesto (GE Digital)
@ 2016-05-03 0:12 ` Nguyễn Thái Ngọc Duy
2016-05-03 0:16 ` Stefan Beller
0 siblings, 1 reply; 8+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2016-05-03 0:12 UTC (permalink / raw)
To: git; +Cc: ernesto.alfonsogonzalez, Nguyễn Thái Ngọc Duy
We need to count both "ours" and "theirs" commits when selecting plural
form for this message. Note that even though in this block, both ours
and theirs must be positive (i.e. can't be in singular form), we still
keep Q_(singular, plural) because languages other than English may have
more than one plural form.
Reported-by: Alfonsogonzalez, Ernesto (GE Digital) <ernesto.alfonsogonzalez@ge.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
remote.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/remote.c b/remote.c
index 28fd676..212426e 100644
--- a/remote.c
+++ b/remote.c
@@ -2108,7 +2108,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
"Your branch and '%s' have diverged,\n"
"and have %d and %d different commits each, "
"respectively.\n",
- theirs),
+ ours + theirs),
base, ours, theirs);
if (advice_status_hints)
strbuf_addf(sb,
--
2.8.0.rc0.210.gd302cd2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message
2016-05-03 0:12 ` [PATCH] remote.c: specify correct plural form in "commit diverge" message Nguyễn Thái Ngọc Duy
@ 2016-05-03 0:16 ` Stefan Beller
2016-05-03 0:20 ` Duy Nguyen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Beller @ 2016-05-03 0:16 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy
Cc: git@vger.kernel.org, ernesto.alfonsogonzalez
On Mon, May 2, 2016 at 5:12 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> We need to count both "ours" and "theirs" commits when selecting plural
> form for this message. Note that even though in this block, both ours
> and theirs must be positive (i.e. can't be in singular form), we still
> keep Q_(singular, plural) because languages other than English may have
> more than one plural form.
>
> Reported-by: Alfonsogonzalez, Ernesto (GE Digital) <ernesto.alfonsogonzalez@ge.com>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> remote.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/remote.c b/remote.c
> index 28fd676..212426e 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -2108,7 +2108,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
> "Your branch and '%s' have diverged,\n"
> "and have %d and %d different commits each, "
> "respectively.\n",
> - theirs),
> + ours + theirs),
I think it needs to be max(ours, theirs)
"Your branch and '%s' have diverged,\n"
"and have 1 and 1 different commit each, "
so singular for that too, no?
> base, ours, theirs);
> if (advice_status_hints)
> strbuf_addf(sb,
> --
> 2.8.0.rc0.210.gd302cd2
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message
2016-05-03 0:16 ` Stefan Beller
@ 2016-05-03 0:20 ` Duy Nguyen
2016-05-03 4:20 ` Jeff King
0 siblings, 1 reply; 8+ messages in thread
From: Duy Nguyen @ 2016-05-03 0:20 UTC (permalink / raw)
To: Stefan Beller; +Cc: git@vger.kernel.org, ernesto.alfonsogonzalez
On Tue, May 3, 2016 at 7:16 AM, Stefan Beller <sbeller@google.com> wrote:
> On Mon, May 2, 2016 at 5:12 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>> We need to count both "ours" and "theirs" commits when selecting plural
>> form for this message. Note that even though in this block, both ours
>> and theirs must be positive (i.e. can't be in singular form), we still
>> keep Q_(singular, plural) because languages other than English may have
>> more than one plural form.
>>
>> Reported-by: Alfonsogonzalez, Ernesto (GE Digital) <ernesto.alfonsogonzalez@ge.com>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>> remote.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/remote.c b/remote.c
>> index 28fd676..212426e 100644
>> --- a/remote.c
>> +++ b/remote.c
>> @@ -2108,7 +2108,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
>> "Your branch and '%s' have diverged,\n"
>> "and have %d and %d different commits each, "
>> "respectively.\n",
>> - theirs),
>> + ours + theirs),
>
> I think it needs to be max(ours, theirs)
>
> "Your branch and '%s' have diverged,\n"
> "and have 1 and 1 different commit each, "
>
> so singular for that too, no?
I thought that would be "1 and 1 commits". English is complicated :-D
I don't think Q_() is prepared to deal with this, other languages may
have different interpretation of "x and y" too. But we can at least
make the English version right.
--
Duy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message
2016-05-03 0:20 ` Duy Nguyen
@ 2016-05-03 4:20 ` Jeff King
2016-05-03 4:43 ` Duy Nguyen
0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2016-05-03 4:20 UTC (permalink / raw)
To: Duy Nguyen; +Cc: Stefan Beller, git@vger.kernel.org, ernesto.alfonsogonzalez
On Tue, May 03, 2016 at 07:20:27AM +0700, Duy Nguyen wrote:
> > I think it needs to be max(ours, theirs)
> >
> > "Your branch and '%s' have diverged,\n"
> > "and have 1 and 1 different commit each, "
> >
> > so singular for that too, no?
>
> I thought that would be "1 and 1 commits". English is complicated :-D
> I don't think Q_() is prepared to deal with this, other languages may
> have different interpretation of "x and y" too. But we can at least
> make the English version right.
Yes, it should still be "1 and 1 commits", I think. An actual human
would probably say something like "and each has %d commit(s)" when the
two values are the same, though.
Note that I do not think the singular case can ever trigger with your
new code. We know that both "ours" and "theirs" are non-zero to get to
this message, which means "ours + theirs" must be at least 2 (barring
negative commit counts, of course :) ).
So you could probably replace the Q_() with just a _().
-Peff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message
2016-05-03 4:20 ` Jeff King
@ 2016-05-03 4:43 ` Duy Nguyen
2016-05-03 4:48 ` Jeff King
0 siblings, 1 reply; 8+ messages in thread
From: Duy Nguyen @ 2016-05-03 4:43 UTC (permalink / raw)
To: Jeff King; +Cc: Stefan Beller, git@vger.kernel.org, ernesto.alfonsogonzalez
On Tue, May 3, 2016 at 11:20 AM, Jeff King <peff@peff.net> wrote:
> Note that I do not think the singular case can ever trigger with your
> new code. We know that both "ours" and "theirs" are non-zero to get to
> this message, which means "ours + theirs" must be at least 2 (barring
> negative commit counts, of course :) ).
>
> So you could probably replace the Q_() with just a _().
Problem is there are languages with more than one plural form (and the
winner is Arabic with six(!) forms [1]). So even if singular form is
never used, I think we still should stick to Q_().
[1] https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
--
Duy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message
2016-05-03 4:43 ` Duy Nguyen
@ 2016-05-03 4:48 ` Jeff King
2016-05-03 9:32 ` Duy Nguyen
0 siblings, 1 reply; 8+ messages in thread
From: Jeff King @ 2016-05-03 4:48 UTC (permalink / raw)
To: Duy Nguyen; +Cc: Stefan Beller, git@vger.kernel.org, ernesto.alfonsogonzalez
On Tue, May 03, 2016 at 11:43:41AM +0700, Duy Nguyen wrote:
> On Tue, May 3, 2016 at 11:20 AM, Jeff King <peff@peff.net> wrote:
> > Note that I do not think the singular case can ever trigger with your
> > new code. We know that both "ours" and "theirs" are non-zero to get to
> > this message, which means "ours + theirs" must be at least 2 (barring
> > negative commit counts, of course :) ).
> >
> > So you could probably replace the Q_() with just a _().
>
> Problem is there are languages with more than one plural form (and the
> winner is Arabic with six(!) forms [1]). So even if singular form is
> never used, I think we still should stick to Q_().
Neat, I didn't know Q_() could handle that (I guess you are stuck
specifying only the two cases in the untranslated form, but the PO files
can do magic in the backend).
It would be nice if there were some way to mark it as "this string will
never be shown", or "will always be >= 2" as a hint for translators. I
guess those can go in a specially-formatted comment.
-Peff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] remote.c: specify correct plural form in "commit diverge" message
2016-05-03 4:48 ` Jeff King
@ 2016-05-03 9:32 ` Duy Nguyen
0 siblings, 0 replies; 8+ messages in thread
From: Duy Nguyen @ 2016-05-03 9:32 UTC (permalink / raw)
To: Jeff King; +Cc: Stefan Beller, git@vger.kernel.org, ernesto.alfonsogonzalez
On Tue, May 3, 2016 at 11:48 AM, Jeff King <peff@peff.net> wrote:
> On Tue, May 03, 2016 at 11:43:41AM +0700, Duy Nguyen wrote:
>
>> On Tue, May 3, 2016 at 11:20 AM, Jeff King <peff@peff.net> wrote:
>> > Note that I do not think the singular case can ever trigger with your
>> > new code. We know that both "ours" and "theirs" are non-zero to get to
>> > this message, which means "ours + theirs" must be at least 2 (barring
>> > negative commit counts, of course :) ).
>> >
>> > So you could probably replace the Q_() with just a _().
>>
>> Problem is there are languages with more than one plural form (and the
>> winner is Arabic with six(!) forms [1]). So even if singular form is
>> never used, I think we still should stick to Q_().
>
> Neat, I didn't know Q_() could handle that (I guess you are stuck
> specifying only the two cases in the untranslated form, but the PO files
> can do magic in the backend).
>
> It would be nice if there were some way to mark it as "this string will
> never be shown", or "will always be >= 2" as a hint for translators. I
> guess those can go in a specially-formatted comment.
Yep, that's the only way I know. But it's probably not good for this
purpose. Imagine if the code is moved around a bit and this exact
string can take n == 1 (probably not given the "x _and_ y commits"
pattern) then we need to tell all translators (optional hints are not
enough) to translate the "n < 2" part or empty string can be printed.
And at least in _() case, empty string is an indication of
untranslated messages, the translator would just translate anyway so
he/she can identify new messages easier.
On the practical side, since
this string has been here for a long time, it's been already
translated in all supported languages (except it.po), hinting now
won't help much (besides it.po)
--
Duy
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-05-03 9:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-02 22:46 bug: incorrect plurality of "commit" in git status Alfonsogonzalez, Ernesto (GE Digital)
2016-05-03 0:12 ` [PATCH] remote.c: specify correct plural form in "commit diverge" message Nguyễn Thái Ngọc Duy
2016-05-03 0:16 ` Stefan Beller
2016-05-03 0:20 ` Duy Nguyen
2016-05-03 4:20 ` Jeff King
2016-05-03 4:43 ` Duy Nguyen
2016-05-03 4:48 ` Jeff King
2016-05-03 9:32 ` Duy Nguyen
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).