{"thread":{"id":"51358","subject":"[PATCH] l10n: localizable upload progress messages","startedAt":"2019-06-21T18:51:46Z","lastAt":"2019-06-24T17:12:00Z","messageCount":4,"participants":["Dimitriy Ryazantcev","Junio C Hamano","Duy Nguyen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"377762","messageId":"20190621185051.77354-1-dimitriy.ryazantcev@gmail.com","threadId":"51358","inReplyTo":null,"subject":"[PATCH] l10n: localizable upload progress messages","fromName":"Dimitriy Ryazantcev","fromEmail":"dimitriy.ryazantcev@gmail.com","sentAt":"2019-06-21T18:50:51Z","receivedAt":"2019-06-21T18:51:46Z","isPatch":true,"sender":{"key":"dimitriy.ryazantcev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1285934?v=4"},"body":"Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>\n---\n progress.c | 3 ++-\n strbuf.c   | 8 ++++----\n 2 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/progress.c b/progress.c\nindex a2e8cf64a8..3d47c06495 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -151,7 +151,8 @@ static void throughput_string(struct strbuf *buf, uint64_t total,\n \tstrbuf_humanise_bytes(buf, total);\n \tstrbuf_addstr(buf, \" | \");\n \tstrbuf_humanise_bytes(buf, rate * 1024);\n-\tstrbuf_addstr(buf, \"/s\");\n+\t/* TRANSLATORS: per second */\n+\tstrbuf_addstr(buf, _(\"/s\"));\n }\n \n void display_throughput(struct progress *progress, uint64_t total)\ndiff --git a/strbuf.c b/strbuf.c\nindex 0e18b259ce..c309df1f5e 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -814,19 +814,19 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,\n void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)\n {\n \tif (bytes > 1 << 30) {\n-\t\tstrbuf_addf(buf, \"%u.%2.2u GiB\",\n+\t\tstrbuf_addf(buf, _(\"%u.%2.2u GiB\"),\n \t\t\t    (unsigned)(bytes >> 30),\n \t\t\t    (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);\n \t} else if (bytes > 1 << 20) {\n \t\tunsigned x = bytes + 5243;  /* for rounding */\n-\t\tstrbuf_addf(buf, \"%u.%2.2u MiB\",\n+\t\tstrbuf_addf(buf, _(\"%u.%2.2u MiB\"),\n \t\t\t    x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);\n \t} else if (bytes > 1 << 10) {\n \t\tunsigned x = bytes + 5;  /* for rounding */\n-\t\tstrbuf_addf(buf, \"%u.%2.2u KiB\",\n+\t\tstrbuf_addf(buf, _(\"%u.%2.2u KiB\"),\n \t\t\t    x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);\n \t} else {\n-\t\tstrbuf_addf(buf, \"%u bytes\", (unsigned)bytes);\n+\t\tstrbuf_addf(buf, _(\"%u bytes\"), (unsigned)bytes);\n \t}\n }\n \n-- \n2.22.0\n\n"},{"id":"377765","messageId":"xmqq8stukarw.fsf@gitster-ct.c.googlers.com","threadId":"51358","inReplyTo":"20190621185051.77354-1-dimitriy.ryazantcev@gmail.com","subject":"Re: [PATCH] l10n: localizable upload progress messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-21T19:18:11Z","receivedAt":"2019-06-21T19:18:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com> writes:\n\n> Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>\n> ---\n>  progress.c | 3 ++-\n>  strbuf.c   | 8 ++++----\n>  2 files changed, 6 insertions(+), 5 deletions(-)\n>\n> diff --git a/progress.c b/progress.c\n> index a2e8cf64a8..3d47c06495 100644\n> --- a/progress.c\n> +++ b/progress.c\n> @@ -151,7 +151,8 @@ static void throughput_string(struct strbuf *buf, uint64_t total,\n>  \tstrbuf_humanise_bytes(buf, total);\n>  \tstrbuf_addstr(buf, \" | \");\n>  \tstrbuf_humanise_bytes(buf, rate * 1024);\n> -\tstrbuf_addstr(buf, \"/s\");\n> +\t/* TRANSLATORS: per second */\n> +\tstrbuf_addstr(buf, _(\"/s\"));\n>  }\n\nHpmh, if it is OK to assume that in all human languages it is OK to\nexpress the reate as <number> followed by translated \"per second\",\nwithout allowing the order from getting changed, then ...\n\n>  \tif (bytes > 1 << 30) {\n> -\t\tstrbuf_addf(buf, \"%u.%2.2u GiB\",\n> +\t\tstrbuf_addf(buf, _(\"%u.%2.2u GiB\"),\n>  \t\t\t    (unsigned)(bytes >> 30),\n>  \t\t\t    (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);\n\nwouldn't it make more sense to split GiB, MiB, KiB and \"bytes\" units\nout of these messages, and ask only these unit names, without the\n%u.%2.2u number formats, to get translated by the localization team?\n\n>  \t} else if (bytes > 1 << 20) {\n>  \t\tunsigned x = bytes + 5243;  /* for rounding */\n> -\t\tstrbuf_addf(buf, \"%u.%2.2u MiB\",\n> +\t\tstrbuf_addf(buf, _(\"%u.%2.2u MiB\"),\n>  \t\t\t    x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);\n>  \t} else if (bytes > 1 << 10) {\n>  \t\tunsigned x = bytes + 5;  /* for rounding */\n> -\t\tstrbuf_addf(buf, \"%u.%2.2u KiB\",\n> +\t\tstrbuf_addf(buf, _(\"%u.%2.2u KiB\"),\n>  \t\t\t    x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);\n>  \t} else {\n> -\t\tstrbuf_addf(buf, \"%u bytes\", (unsigned)bytes);\n> +\t\tstrbuf_addf(buf, _(\"%u bytes\"), (unsigned)bytes);\n\nThis needs the Q_() to deal with plural (i.e. in en, between \"byte\"\nand \"bytes\").\n\n>  \t}\n>  }\n"},{"id":"377801","messageId":"CACsJy8BF0RHgrw9A_6zj8hQk7s15LvCZDz_P7rxgRvGfRhLJZg@mail.gmail.com","threadId":"51358","inReplyTo":"xmqq8stukarw.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] l10n: localizable upload progress messages","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-06-22T03:10:21Z","receivedAt":"2019-06-22T03:10:50Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Jun 22, 2019 at 2:18 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com> writes:\n>\n> > Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>\n> > ---\n> >  progress.c | 3 ++-\n> >  strbuf.c   | 8 ++++----\n> >  2 files changed, 6 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/progress.c b/progress.c\n> > index a2e8cf64a8..3d47c06495 100644\n> > --- a/progress.c\n> > +++ b/progress.c\n> > @@ -151,7 +151,8 @@ static void throughput_string(struct strbuf *buf, uint64_t total,\n> >       strbuf_humanise_bytes(buf, total);\n> >       strbuf_addstr(buf, \" | \");\n> >       strbuf_humanise_bytes(buf, rate * 1024);\n> > -     strbuf_addstr(buf, \"/s\");\n> > +     /* TRANSLATORS: per second */\n> > +     strbuf_addstr(buf, _(\"/s\"));\n> >  }\n>\n> Hpmh, if it is OK to assume that in all human languages it is OK to\n> express the reate as <number> followed by translated \"per second\",\n> without allowing the order from getting changed, then ...\n\nProbably not (but I don't know any language that is not ok with this).\nI would just add strbuf_humanise_rate() that prints \"GiB/s\",\n\"MiB/s\"... Then we probably should print \"bytes/second\". This will\nprint \"bytes/s\" which looks just weird.\n\n> >       if (bytes > 1 << 30) {\n> > -             strbuf_addf(buf, \"%u.%2.2u GiB\",\n> > +             strbuf_addf(buf, _(\"%u.%2.2u GiB\"),\n> >                           (unsigned)(bytes >> 30),\n> >                           (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);\n>\n> wouldn't it make more sense to split GiB, MiB, KiB and \"bytes\" units\n> out of these messages, and ask only these unit names, without the\n> %u.%2.2u number formats, to get translated by the localization team?\n\nThat assumes all languages will print the unit after the number. I\nguess that is ok and it helps share code if we add\nstrbuf_humanise_rate() above because only the unit part changes.\n-- \nDuy\n"},{"id":"377901","messageId":"xmqqef3ij4bo.fsf@gitster-ct.c.googlers.com","threadId":"51358","inReplyTo":"CACsJy8BF0RHgrw9A_6zj8hQk7s15LvCZDz_P7rxgRvGfRhLJZg@mail.gmail.com","subject":"Re: [PATCH] l10n: localizable upload progress messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-24T17:11:55Z","receivedAt":"2019-06-24T17:12:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n>> Hpmh, if it is OK to assume that in all human languages it is OK to\n>> express the reate as <number> followed by translated \"per second\",\n>> without allowing the order from getting changed, then ...\n>\n> Probably not (but I don't know any language that is not ok with this).\n> I would just add strbuf_humanise_rate() that prints \"GiB/s\",\n> \"MiB/s\"... Then we probably should print \"bytes/second\". This will\n> print \"bytes/s\" which looks just weird.\n>\n>> >       if (bytes > 1 << 30) {\n>> > -             strbuf_addf(buf, \"%u.%2.2u GiB\",\n>> > +             strbuf_addf(buf, _(\"%u.%2.2u GiB\"),\n>> >                           (unsigned)(bytes >> 30),\n>> >                           (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);\n>>\n>> wouldn't it make more sense to split GiB, MiB, KiB and \"bytes\" units\n>> out of these messages, and ask only these unit names, without the\n>> %u.%2.2u number formats, to get translated by the localization team?\n>\n> That assumes all languages will print the unit after the number. I\n> guess that is ok and it helps share code if we add\n> strbuf_humanise_rate() above because only the unit part changes.\n\nI think this is the direction I expected the discussion to go in.\nIt seems that the other subthread went the other way, though.\n"}]}