# [PATCH v3] l10n: localizable upload progress messages

10 messages from 2019-06-22 to 2019-06-24. Participants: Dimitriy Ryazantcev, Duy Nguyen, Dimitriy, Johannes Sixt, brian m. carlson, Junio C Hamano.
Thread: https://gitlist.dev/t/51362

## Dimitriy Ryazantcev, 2019-06-22 09:36

Subject: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <20190622093655.80092-2-dimitriy.ryazantcev@gmail.com>
URL: https://gitlist.dev/e/20190622093655.80092-2-dimitriy.ryazantcev%40gmail.com

```
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
---
 progress.c |  4 +++-
 strbuf.c   | 16 ++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/progress.c b/progress.c
index a2e8cf64a8..61d8cf5d04 100644
--- a/progress.c
+++ b/progress.c
@@ -151,7 +151,9 @@ static void throughput_string(struct strbuf *buf, uint64_t total,
 	strbuf_humanise_bytes(buf, total);
 	strbuf_addstr(buf, " | ");
 	strbuf_humanise_bytes(buf, rate * 1024);
-	strbuf_addstr(buf, "/s");
+	strbuf_addstr(buf, "/");
+	/* TRANSLATORS: IEC 80000-13:2008, subclause 13-12.b: second */
+	strbuf_addstr(buf, _("s"));
 }
 
 void display_throughput(struct progress *progress, uint64_t total)
diff --git a/strbuf.c b/strbuf.c
index 0e18b259ce..0a3ebc3749 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
 void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
 {
 	if (bytes > 1 << 30) {
-		strbuf_addf(buf, "%u.%2.2u GiB",
+		strbuf_addf(buf, "%u.%2.2u ",
 			    (unsigned)(bytes >> 30),
 			    (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
+		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: gibi */
+		strbuf_addstr(buf, _("Gi"));
 	} else if (bytes > 1 << 20) {
 		unsigned x = bytes + 5243;  /* for rounding */
-		strbuf_addf(buf, "%u.%2.2u MiB",
+		strbuf_addf(buf, "%u.%2.2u ",
 			    x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
+		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: mebi */
+		strbuf_addstr(buf, _("Mi"));
 	} else if (bytes > 1 << 10) {
 		unsigned x = bytes + 5;  /* for rounding */
-		strbuf_addf(buf, "%u.%2.2u KiB",
+		strbuf_addf(buf, "%u.%2.2u ",
 			    x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
+		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: kibi */
+		strbuf_addstr(buf, _("Ki"));
 	} else {
-		strbuf_addf(buf, "%u bytes", (unsigned)bytes);
+		strbuf_addf(buf, "%u ", (unsigned)bytes);
 	}
+	/* TRANSLATORS: ISO/IEC 80000-13:2008, subclause 13-9.c: byte */
+	strbuf_addstr(buf, _("B"));
 }
 
 void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
-- 
2.22.0


```

## Duy Nguyen, 2019-06-22 11:42

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <CACsJy8CPChOGSZVfXd6ioaXHWg_aFxNMzr2J=Zdm2RZXkO++Ew@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8CPChOGSZVfXd6ioaXHWg_aFxNMzr2J%3DZdm2RZXkO%2B%2BEw%40mail.gmail.com
In-Reply-To: <20190622093655.80092-2-dimitriy.ryazantcev@gmail.com>

```
On Sat, Jun 22, 2019 at 4:37 PM Dimitriy Ryazantcev
<dimitriy.ryazantcev@gmail.com> wrote:
> diff --git a/strbuf.c b/strbuf.c
> index 0e18b259ce..0a3ebc3749 100644
> --- a/strbuf.c
> +++ b/strbuf.c
> @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
>  void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
>  {
>         if (bytes > 1 << 30) {
> -               strbuf_addf(buf, "%u.%2.2u GiB",
> +               strbuf_addf(buf, "%u.%2.2u ",
>                             (unsigned)(bytes >> 30),
>                             (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
> +               /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: gibi */
> +               strbuf_addstr(buf, _("Gi"));

It may be ISO standard, but GiB to me looks much easier to understand.
What's the reason for changing GiB to Gi btw?

>         } else if (bytes > 1 << 20) {
>                 unsigned x = bytes + 5243;  /* for rounding */
> -               strbuf_addf(buf, "%u.%2.2u MiB",
> +               strbuf_addf(buf, "%u.%2.2u ",
>                             x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
> +               /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: mebi */
> +               strbuf_addstr(buf, _("Mi"));
>         } else if (bytes > 1 << 10) {
>                 unsigned x = bytes + 5;  /* for rounding */
> -               strbuf_addf(buf, "%u.%2.2u KiB",
> +               strbuf_addf(buf, "%u.%2.2u ",
>                             x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
> +               /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: kibi */
> +               strbuf_addstr(buf, _("Ki"));
>         } else {
> -               strbuf_addf(buf, "%u bytes", (unsigned)bytes);
> +               strbuf_addf(buf, "%u ", (unsigned)bytes);
>         }
> +       /* TRANSLATORS: ISO/IEC 80000-13:2008, subclause 13-9.c: byte */
> +       strbuf_addstr(buf, _("B"));
>  }
>
>  void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
> --
> 2.22.0
>


-- 
Duy

```

## Dimitriy, 2019-06-22 16:39

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <CAPUT4mQnsThA=ZxZD8K+J+u6tbN5PggPomuymEUO=u2GT88aUA@mail.gmail.com>
URL: https://gitlist.dev/e/CAPUT4mQnsThA%3DZxZD8K%2BJ%2Bu6tbN5PggPomuymEUO%3Du2GT88aUA%40mail.gmail.com
In-Reply-To: <CACsJy8CPChOGSZVfXd6ioaXHWg_aFxNMzr2J=Zdm2RZXkO++Ew@mail.gmail.com>

```
Duy Nguyen <pclouds@gmail.com> wrote:
>
> On Sat, Jun 22, 2019 at 4:37 PM Dimitriy Ryazantcev
> <dimitriy.ryazantcev@gmail.com> wrote:
> > diff --git a/strbuf.c b/strbuf.c
> > index 0e18b259ce..0a3ebc3749 100644
> > --- a/strbuf.c
> > +++ b/strbuf.c
> > @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
> >  void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
> >  {
> >         if (bytes > 1 << 30) {
> > -               strbuf_addf(buf, "%u.%2.2u GiB",
> > +               strbuf_addf(buf, "%u.%2.2u ",
> >                             (unsigned)(bytes >> 30),
> >                             (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
> > +               /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: gibi */
> > +               strbuf_addstr(buf, _("Gi"));
>
> It may be ISO standard, but GiB to me looks much easier to understand.
> What's the reason for changing GiB to Gi btw?

I just moved 'B' out of else block so it will be prepended with
'Gi'/'Mi'/'Ki' when needed.
Note: I changed 'bytes' to just 'B' unit.

>
> >         } else if (bytes > 1 << 20) {
> >                 unsigned x = bytes + 5243;  /* for rounding */
> > -               strbuf_addf(buf, "%u.%2.2u MiB",
> > +               strbuf_addf(buf, "%u.%2.2u ",
> >                             x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
> > +               /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: mebi */
> > +               strbuf_addstr(buf, _("Mi"));
> >         } else if (bytes > 1 << 10) {
> >                 unsigned x = bytes + 5;  /* for rounding */
> > -               strbuf_addf(buf, "%u.%2.2u KiB",
> > +               strbuf_addf(buf, "%u.%2.2u ",
> >                             x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
> > +               /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: kibi */
> > +               strbuf_addstr(buf, _("Ki"));
> >         } else {
> > -               strbuf_addf(buf, "%u bytes", (unsigned)bytes);
> > +               strbuf_addf(buf, "%u ", (unsigned)bytes);
> >         }
> > +       /* TRANSLATORS: ISO/IEC 80000-13:2008, subclause 13-9.c: byte */
> > +       strbuf_addstr(buf, _("B"));
> >  }
> >
> >  void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
> > --
> > 2.22.0
> >
>
>
> --
> Duy



-- 
Sincerely,
Dimitriy Ryazantcev

```

## Johannes Sixt, 2019-06-22 21:42

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <65cf1cfd-bb5f-dba0-17d6-7fee0ed1f51f@kdbg.org>
URL: https://gitlist.dev/e/65cf1cfd-bb5f-dba0-17d6-7fee0ed1f51f%40kdbg.org
In-Reply-To: <20190622093655.80092-2-dimitriy.ryazantcev@gmail.com>

```
Am 22.06.19 um 11:36 schrieb Dimitriy Ryazantcev:
> Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
> ---
>  progress.c |  4 +++-
>  strbuf.c   | 16 ++++++++++++----
>  2 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/progress.c b/progress.c
> index a2e8cf64a8..61d8cf5d04 100644
> --- a/progress.c
> +++ b/progress.c
> @@ -151,7 +151,9 @@ static void throughput_string(struct strbuf *buf, uint64_t total,
>  	strbuf_humanise_bytes(buf, total);
>  	strbuf_addstr(buf, " | ");
>  	strbuf_humanise_bytes(buf, rate * 1024);
> -	strbuf_addstr(buf, "/s");
> +	strbuf_addstr(buf, "/");
> +	/* TRANSLATORS: IEC 80000-13:2008, subclause 13-12.b: second */
> +	strbuf_addstr(buf, _("s"));
>  }
>  
>  void display_throughput(struct progress *progress, uint64_t total)
> diff --git a/strbuf.c b/strbuf.c
> index 0e18b259ce..0a3ebc3749 100644
> --- a/strbuf.c
> +++ b/strbuf.c
> @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
>  void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
>  {
>  	if (bytes > 1 << 30) {
> -		strbuf_addf(buf, "%u.%2.2u GiB",
> +		strbuf_addf(buf, "%u.%2.2u ",
>  			    (unsigned)(bytes >> 30),
>  			    (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
> +		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: gibi */
> +		strbuf_addstr(buf, _("Gi"));
>  	} else if (bytes > 1 << 20) {
>  		unsigned x = bytes + 5243;  /* for rounding */
> -		strbuf_addf(buf, "%u.%2.2u MiB",
> +		strbuf_addf(buf, "%u.%2.2u ",
>  			    x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
> +		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: mebi */
> +		strbuf_addstr(buf, _("Mi"));
>  	} else if (bytes > 1 << 10) {
>  		unsigned x = bytes + 5;  /* for rounding */
> -		strbuf_addf(buf, "%u.%2.2u KiB",
> +		strbuf_addf(buf, "%u.%2.2u ",
>  			    x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
> +		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: kibi */
> +		strbuf_addstr(buf, _("Ki"));
>  	} else {
> -		strbuf_addf(buf, "%u bytes", (unsigned)bytes);
> +		strbuf_addf(buf, "%u ", (unsigned)bytes);
>  	}
> +	/* TRANSLATORS: ISO/IEC 80000-13:2008, subclause 13-9.c: byte */
> +	strbuf_addstr(buf, _("B"));
>  }
>  
>  void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
> 

All of the prefixes are in ISO/IEC, i.e., standardized. Why do they have
to be translated?

Isn't the way of presentation of magnitudes with a unit also
standardized, and should not need to be translated?

-- Hannes

```

## brian m. carlson, 2019-06-23 01:03

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <20190623010311.GC965782@genre.crustytoothpaste.net>
URL: https://gitlist.dev/e/20190623010311.GC965782%40genre.crustytoothpaste.net
In-Reply-To: <65cf1cfd-bb5f-dba0-17d6-7fee0ed1f51f@kdbg.org>

```
On 2019-06-22 at 21:42:33, Johannes Sixt wrote:
> Am 22.06.19 um 11:36 schrieb Dimitriy Ryazantcev:
> > diff --git a/strbuf.c b/strbuf.c
> > index 0e18b259ce..0a3ebc3749 100644
> > --- a/strbuf.c
> > +++ b/strbuf.c
> > @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
> >  void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
> >  {
> >  	if (bytes > 1 << 30) {
> > -		strbuf_addf(buf, "%u.%2.2u GiB",
> > +		strbuf_addf(buf, "%u.%2.2u ",
> >  			    (unsigned)(bytes >> 30),
> >  			    (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
> > +		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: gibi */
> > +		strbuf_addstr(buf, _("Gi"));
> >  	} else if (bytes > 1 << 20) {
> >  		unsigned x = bytes + 5243;  /* for rounding */
> > -		strbuf_addf(buf, "%u.%2.2u MiB",
> > +		strbuf_addf(buf, "%u.%2.2u ",
> >  			    x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
> > +		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: mebi */
> > +		strbuf_addstr(buf, _("Mi"));
> >  	} else if (bytes > 1 << 10) {
> >  		unsigned x = bytes + 5;  /* for rounding */
> > -		strbuf_addf(buf, "%u.%2.2u KiB",
> > +		strbuf_addf(buf, "%u.%2.2u ",
> >  			    x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
> > +		/* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: kibi */
> > +		strbuf_addstr(buf, _("Ki"));
> >  	} else {
> > -		strbuf_addf(buf, "%u bytes", (unsigned)bytes);
> > +		strbuf_addf(buf, "%u ", (unsigned)bytes);
> >  	}
> > +	/* TRANSLATORS: ISO/IEC 80000-13:2008, subclause 13-9.c: byte */
> > +	strbuf_addstr(buf, _("B"));
> >  }
> >  
> >  void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
> > 
> 
> All of the prefixes are in ISO/IEC, i.e., standardized. Why do they have
> to be translated?
> 
> Isn't the way of presentation of magnitudes with a unit also
> standardized, and should not need to be translated?

In my view, the translation is less important for the prefixes and more
important for the unit: at least French prefers the term "octet" over
"byte"[0], so instead of writing "MB", you'd write "Mo".

In general, I think it's better to keep the prefixes and units together,
since trying to translate a single letter runs the risk of collisions
with other places in the code. It's likely to be easier for translators
as well.

[0] Technically, as in English, they have different meanings, but I've
always seen French units written with "o" for "octet", not "B" for
"byte".
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

```

## Dimitriy, 2019-06-23 08:28

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <CAPUT4mSHK8bD-TGf9QOM2O2ChxTvwScCvmmQH37pedGDVR2w-g@mail.gmail.com>
URL: https://gitlist.dev/e/CAPUT4mSHK8bD-TGf9QOM2O2ChxTvwScCvmmQH37pedGDVR2w-g%40mail.gmail.com
In-Reply-To: <20190623010311.GC965782@genre.crustytoothpaste.net>

```
brian m. carlson <sandals@crustytoothpaste.net> wrote:
>
> On 2019-06-22 at 21:42:33, Johannes Sixt wrote:
> > Am 22.06.19 um 11:36 schrieb Dimitriy Ryazantcev:
> > > diff --git a/strbuf.c b/strbuf.c
> > > index 0e18b259ce..0a3ebc3749 100644
> > > --- a/strbuf.c
> > > +++ b/strbuf.c
> > > @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
> > >  void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
> > >  {
> > >     if (bytes > 1 << 30) {
> > > -           strbuf_addf(buf, "%u.%2.2u GiB",
> > > +           strbuf_addf(buf, "%u.%2.2u ",
> > >                         (unsigned)(bytes >> 30),
> > >                         (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
> > > +           /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: gibi */
> > > +           strbuf_addstr(buf, _("Gi"));
> > >     } else if (bytes > 1 << 20) {
> > >             unsigned x = bytes + 5243;  /* for rounding */
> > > -           strbuf_addf(buf, "%u.%2.2u MiB",
> > > +           strbuf_addf(buf, "%u.%2.2u ",
> > >                         x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
> > > +           /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: mebi */
> > > +           strbuf_addstr(buf, _("Mi"));
> > >     } else if (bytes > 1 << 10) {
> > >             unsigned x = bytes + 5;  /* for rounding */
> > > -           strbuf_addf(buf, "%u.%2.2u KiB",
> > > +           strbuf_addf(buf, "%u.%2.2u ",
> > >                         x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
> > > +           /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: kibi */
> > > +           strbuf_addstr(buf, _("Ki"));
> > >     } else {
> > > -           strbuf_addf(buf, "%u bytes", (unsigned)bytes);
> > > +           strbuf_addf(buf, "%u ", (unsigned)bytes);
> > >     }
> > > +   /* TRANSLATORS: ISO/IEC 80000-13:2008, subclause 13-9.c: byte */
> > > +   strbuf_addstr(buf, _("B"));
> > >  }
> > >
> > >  void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
> > >
> >
> > All of the prefixes are in ISO/IEC, i.e., standardized. Why do they have
> > to be translated?
> >
> > Isn't the way of presentation of magnitudes with a unit also
> > standardized, and should not need to be translated?
>
> In my view, the translation is less important for the prefixes and more
> important for the unit: at least French prefers the term "octet" over
> "byte"[0], so instead of writing "MB", you'd write "Mo".

Localization according to local rules is important for every unit part.
There is a Russian adoption of IEC 80000-13:2008 called
GOST R IEC 80000-13-2016[0].
And in this document there is national translations for these units\prefixes.
So 'KiB' should become 'КиБ' according to this national standard.
Same story with Ukrainian adoption called DSTU IEC 80000-13:2016[1]:
'KiB' -> 'КіБ'.
Also according to ISO website seems that there is French version of
IEC 80000-13:2008 exist. Not sure about French translation through.

> In general, I think it's better to keep the prefixes and units together,
> since trying to translate a single letter runs the risk of collisions
> with other places in the code. It's likely to be easier for translators
> as well.

I agree with you in this part.
I searched for similar code in other codebases and found such in KDE
codebase[2]. I'll update patch if there is no objections.

> [0] Technically, as in English, they have different meanings, but I've
> always seen French units written with "o" for "octet", not "B" for
> "byte".

To solve this ambiguity IEC standard in subclause 13-9.с says
that 'byte' implies 'octet' (8-bit byte).

> --
> brian m. carlson: Houston, Texas, US
> OpenPGP: https://keybase.io/bk2204

[0] http://docs.cntd.ru/document/1200143231
[1] http://online.budstandart.com/ua/catalog/doc-page.html?id_doc=69033
[1] https://cgit.kde.org/kcoreaddons.git/tree/src/lib/util/kformatprivate.cpp#n254

-- 
Sincerely,
Dimitriy Ryazantcev

```

## Johannes Sixt, 2019-06-23 13:10

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <2074c719-a077-35c4-f30b-769580e17879@kdbg.org>
URL: https://gitlist.dev/e/2074c719-a077-35c4-f30b-769580e17879%40kdbg.org
In-Reply-To: <CAPUT4mSHK8bD-TGf9QOM2O2ChxTvwScCvmmQH37pedGDVR2w-g@mail.gmail.com>

```
Am 23.06.19 um 10:28 schrieb Dimitriy:
> brian m. carlson <sandals@crustytoothpaste.net> wrote:
>>
>> On 2019-06-22 at 21:42:33, Johannes Sixt wrote:
>>> Am 22.06.19 um 11:36 schrieb Dimitriy Ryazantcev:
>>>> diff --git a/strbuf.c b/strbuf.c
>>>> index 0e18b259ce..0a3ebc3749 100644
>>>> --- a/strbuf.c
>>>> +++ b/strbuf.c
>>>> @@ -814,20 +814,28 @@ void strbuf_addstr_urlencode(struct strbuf *sb, const char *s,
>>>>  void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
>>>>  {
>>>>     if (bytes > 1 << 30) {
>>>> -           strbuf_addf(buf, "%u.%2.2u GiB",
>>>> +           strbuf_addf(buf, "%u.%2.2u ",
>>>>                         (unsigned)(bytes >> 30),
>>>>                         (unsigned)(bytes & ((1 << 30) - 1)) / 10737419);
>>>> +           /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: gibi */
>>>> +           strbuf_addstr(buf, _("Gi"));
>>>>     } else if (bytes > 1 << 20) {
>>>>             unsigned x = bytes + 5243;  /* for rounding */
>>>> -           strbuf_addf(buf, "%u.%2.2u MiB",
>>>> +           strbuf_addf(buf, "%u.%2.2u ",
>>>>                         x >> 20, ((x & ((1 << 20) - 1)) * 100) >> 20);
>>>> +           /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: mebi */
>>>> +           strbuf_addstr(buf, _("Mi"));
>>>>     } else if (bytes > 1 << 10) {
>>>>             unsigned x = bytes + 5;  /* for rounding */
>>>> -           strbuf_addf(buf, "%u.%2.2u KiB",
>>>> +           strbuf_addf(buf, "%u.%2.2u ",
>>>>                         x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
>>>> +           /* TRANSLATORS: ISO/IEC 80000-13:2008, clause 4: kibi */
>>>> +           strbuf_addstr(buf, _("Ki"));
>>>>     } else {
>>>> -           strbuf_addf(buf, "%u bytes", (unsigned)bytes);
>>>> +           strbuf_addf(buf, "%u ", (unsigned)bytes);
>>>>     }
>>>> +   /* TRANSLATORS: ISO/IEC 80000-13:2008, subclause 13-9.c: byte */
>>>> +   strbuf_addstr(buf, _("B"));
>>>>  }
>>>>
>>>>  void strbuf_add_absolute_path(struct strbuf *sb, const char *path)
>>>>
>>>
>>> All of the prefixes are in ISO/IEC, i.e., standardized. Why do they have
>>> to be translated?
>>>
>>> Isn't the way of presentation of magnitudes with a unit also
>>> standardized, and should not need to be translated?
>>
>> In my view, the translation is less important for the prefixes and more
>> important for the unit: at least French prefers the term "octet" over
>> "byte"[0], so instead of writing "MB", you'd write "Mo".
> 
> Localization according to local rules is important for every unit part.
> There is a Russian adoption of IEC 80000-13:2008 called
> GOST R IEC 80000-13-2016[0].
> And in this document there is national translations for these units\prefixes.
> So 'KiB' should become 'КиБ' according to this national standard.
> Same story with Ukrainian adoption called DSTU IEC 80000-13:2016[1]:
> 'KiB' -> 'КіБ'.
> Also according to ISO website seems that there is French version of
> IEC 80000-13:2008 exist. Not sure about French translation through.

Thanks for educating me. Given your explanations, wouldn't it be much
more natural to keep the prefix with the unit instead of separating
them, as the patch does?

-- Hannes

```

## brian m. carlson, 2019-06-23 16:58

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <20190623165835.GD965782@genre.crustytoothpaste.net>
URL: https://gitlist.dev/e/20190623165835.GD965782%40genre.crustytoothpaste.net
In-Reply-To: <CAPUT4mSHK8bD-TGf9QOM2O2ChxTvwScCvmmQH37pedGDVR2w-g@mail.gmail.com>

```
On 2019-06-23 at 08:28:41, Dimitriy wrote:
> brian m. carlson <sandals@crustytoothpaste.net> wrote:
> > In my view, the translation is less important for the prefixes and more
> > important for the unit: at least French prefers the term "octet" over
> > "byte"[0], so instead of writing "MB", you'd write "Mo".
> 
> Localization according to local rules is important for every unit part.
> There is a Russian adoption of IEC 80000-13:2008 called
> GOST R IEC 80000-13-2016[0].
> And in this document there is national translations for these units\prefixes.
> So 'KiB' should become 'КиБ' according to this national standard.
> Same story with Ukrainian adoption called DSTU IEC 80000-13:2016[1]:
> 'KiB' -> 'КіБ'.
> Also according to ISO website seems that there is French version of
> IEC 80000-13:2008 exist. Not sure about French translation through.

I figured the impetus for this change was something like this.

> > In general, I think it's better to keep the prefixes and units together,
> > since trying to translate a single letter runs the risk of collisions
> > with other places in the code. It's likely to be easier for translators
> > as well.
> 
> I agree with you in this part.
> I searched for similar code in other codebases and found such in KDE
> codebase[2]. I'll update patch if there is no objections.

Yeah, that sounds good. It's probably sufficient in this case to simply
mark the existing format strings for translation, since we know
translators can already handle other format strings we have. Also,
perhaps translators will want to switch the period for a comma, as is
common in some languages.

> > [0] Technically, as in English, they have different meanings, but I've
> > always seen French units written with "o" for "octet", not "B" for
> > "byte".
> 
> To solve this ambiguity IEC standard in subclause 13-9.с says
> that 'byte' implies 'octet' (8-bit byte).

French Wikipedia also tells me that "B" is the symbol for the bel, so
"o" is preferable because it doesn't conflict. I have no strong opinions
either way.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

```

## Junio C Hamano, 2019-06-24 18:01

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <xmqq1rzij20h.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqq1rzij20h.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <CAPUT4mQnsThA=ZxZD8K+J+u6tbN5PggPomuymEUO=u2GT88aUA@mail.gmail.com>

```
Dimitriy <dimitriy.ryazantcev@gmail.com> writes:

> I just moved 'B' out of else block so it will be prepended with
> 'Gi'/'Mi'/'Ki' when needed.
> Note: I changed 'bytes' to just 'B' unit.

That makes this change more than "localizable messages", doesn't it?

As an old timer, I do not mind MiB (I'd prefer the old-fashioned MB
myself), but I think "20 bytes" (or "1 byte") spelled out is much
easier to grok and less prone to get misunderstood than "20B".  Like
it or not, with scale prefixes, e.g. "20 kiB", "20 MiB", etc., it is
hard to misunderstand what 'B' means in there, but without any scale
prefix, i.e. "20 B", it is rather easy to get confused what 'B'
means.

```

## Junio C Hamano, 2019-06-24 18:04

Subject: Re: [PATCH v3] l10n: localizable upload progress messages
Message-ID: <xmqqwohahnbf.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqwohahnbf.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <2074c719-a077-35c4-f30b-769580e17879@kdbg.org>

```
Johannes Sixt <j6t@kdbg.org> writes:

> Thanks for educating me. Given your explanations, wouldn't it be much
> more natural to keep the prefix with the unit instead of separating
> them, as the patch does?

Yup, that "octet" comment was illuminating.  Great discussion.

Also I am with Duy's message in the other subthread.  We should keep
the number placeholder "%[udf]" and the unit in a single string),
instead of hardcoding the "a number must come and then unit" in the
code.

Thanks.

```
