Open Bug 945040 Opened 8 years ago Updated 1 year ago

Bytes unit should support singular and plural

Categories

(Toolkit :: Downloads API, defect)

defect
Not set
trivial

Tracking

()

People

(Reporter: nicolas.barbulesco, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

Firefox 25.0.1, Mac OS X Mavericks.

In the Prefs → Advanced → Network, there is “0 octets”. 
See screen photo :  
http://pbrd.co/1j8PMH8 
This is incorrect. 
This has to be written correctly “0 octet”.

Thank you for correcting that little bug.
Based on https://developer.mozilla.org/en-US/docs/Localization_and_Plurals
French uses plural rule #2 as opposed to English using rule #1 (which it looks like the text might be doing instead). This pluralization looks like it might be incorrectly done. Moving over to l10n area for someone to test and triage.
Component: Preferences → Localization
Product: Firefox → Core
Summary: Octets written incorrectly in plural → Octets written incorrectly in plural in French
The string in question is here:

https://mxr.mozilla.org/l10n-mozilla-aurora/source/fr/browser/chrome/browser/preferences/preferences.properties#121

Benoit, can you confirm whether this is a translation issue or a coding issue?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(benoit.leseul)
Wow, that's a tricky question.

It looks like the size string is made from DownloadUtils.convertByteUnits() which uses the units provided in https://mxr.mozilla.org/l10n-mozilla-aurora/source/fr/toolkit/chrome/mozapps/downloads/downloads.properties#66

The size unit names there don't seem to be pluralform aware, unlike, for example, the time units.
So what we get in the end is just a concatenation of a number and an unformatted size unit.

According to https://developer.mozilla.org/en-US/docs/Localization_and_Plurals only French and Brasilian Portuguese use a plural rule where 0 and 1 are pluralized in the same way. 

I wonder if it's worth using plural forms here, or just a special string for 0 (where we could actually put something like "no disk space").
Flags: needinfo?(benoit.leseul) → needinfo?(l10n)
The "bytes" unit is a real word, in contrast to the other units like kB etc.

Guess we'll need to actually support plurals for that one. This doesn't just affect 0 or 1, but also more complex numbers.

Alexander, stas, I wonder if a string like https://mxr.mozilla.org/l10n-mozilla-aurora/source/ru/browser/chrome/browser/preferences/preferences.properties#56 would need to support the rest of the sentence? Like, would the verb change?
Component: Localization → Download Manager
Flags: needinfo?(l10n)
Product: Core → Toolkit
Summary: Octets written incorrectly in plural in French → bytes unit in download manager should support plurals
(In reply to Axel Hecht [:Pike] from comment #4)
> Alexander, stas, I wonder if a string like
> https://mxr.mozilla.org/l10n-mozilla-aurora/source/ru/browser/chrome/browser/
> preferences/preferences.properties#56 would need to support the rest of the
> sentence? Like, would the verb change?
No. It doesn't require verb change.
So we need to fix the function more than the single string?
http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/DownloadUtils.jsm#452

Doesn't it fail for English too ("1 bytes")?
(In reply to Alexander L. Slovesnik from comment #5)
> (In reply to Axel Hecht [:Pike] from comment #4)
> > Alexander, stas, I wonder if a string like
> > https://mxr.mozilla.org/l10n-mozilla-aurora/source/ru/browser/chrome/browser/
> > preferences/preferences.properties#56 would need to support the rest of the
> > sentence? Like, would the verb change?
> No. It doesn't require verb change.

Same for Polish, no change required.
OS: Mac OS X → All
The bug I reported is not in the Downloads manager, it is in the Preferences.
Summary: bytes unit in download manager should support plurals → Bytes unit should support singular and plural
It's a string from downloads manager that gets used in preferences.
Let's widen the scope of this bug towards all the places where it occurs in Firefox.

In Firefox 26 Mac I encounter this bug also in the bubble that comes in when adding an extension to Firefox. 
See screen photo : 
http://pbrd.co/1aWUpOe
Component: Download Manager → General
Product: Toolkit → Firefox
I honestly don't understand how "Firefox-General" can be considered broader than toolkit (but I don't plan on engaging in a battle of moving back and forward this bug).

I tried to follow the code for this pop-up but failed to understand where the download info is generated
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-addons.js#94
Not sure at what point it is added either. 

But I'm pretty sure it comes from Download manager code as well, since:
a) this one is an actual download notification; and
b) we have no other occurrence of that string anywhere else: http://transvision.mozfr.org/?repo=central&sourcelocale=en-US&locale=fr&search_type=strings&recherche=ind%C3%A9termin%C3%A9

So it must be fixed in toolkit before it can be used in any application.
Component: General → Download Manager
Product: Firefox → Toolkit
Pike, before searching for a reviewer, can you tell me if this patch makes sense to you?
Attachment #8365647 - Flags: feedback?(l10n)
(In reply to Francesco Lodolo [:flod] from comment #13)
> Created attachment 8365647 [details] [diff] [review]
> Patch to use plural form for bytes

This may just be a cargo cult suggestion, because I'm not sure why it was made in the first place, but you could create a convertByteUnitUnits helper function like convertTimeUnitsUnits:
http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/DownloadUtils.jsm#537
Not sure if it really improves code readability. I guess convertTimeUnitsUnits makes more sense because it's used twice.
Missed one test
Attachment #8365647 - Attachment is obsolete: true
Attachment #8365647 - Flags: feedback?(l10n)
Attachment #8365659 - Flags: feedback?(l10n)
Comment on attachment 8365659 [details] [diff] [review]
Patch to use plural form for bytes

Review of attachment 8365659 [details] [diff] [review]:
-----------------------------------------------------------------

Looking at http://mxr.mozilla.org/l10n-mozilla-aurora/search?string=gigabyte&find=downloads, I see a few languages like Bengali and Arabic that don't seem to be using abbreviations for the units, and that might fall into the same bucket as "byte".

Can you check with folks if they're affected on the other units, too? Canceling the feedback request for now.
Attachment #8365659 - Flags: feedback?(l10n)
List of locales using words from what I can see: bn-BD, bn-IN, fa, hi-IN, km, mai, ml.

Sending an email to the localizers involved.
Forgot Arabic (ar) in the list above.

So far got a reply only from fa (Ehsan), and they don't need a plural form: they're just transliterating KB, MB, etc. so it's invariant.

@Anas
Is it the same for Arabic?
http://hg.mozilla.org/releases/l10n/mozilla-aurora/ar/file/3d67115a5f40/toolkit/chrome/mozapps/downloads/downloads.properties#l66
Assignee: nobody → francesco.lodolo
Flags: needinfo?(linux.anas)
(In reply to Francesco Lodolo [:flod] from comment #19)
> Forgot Arabic (ar) in the list above.
> 
> So far got a reply only from fa (Ehsan), and they don't need a plural form:
> they're just transliterating KB, MB, etc. so it's invariant.
> 
> @Anas
> Is it the same for Arabic?
> http://hg.mozilla.org/releases/l10n/mozilla-aurora/ar/file/3d67115a5f40/
> toolkit/chrome/mozapps/downloads/downloads.properties#l66

It is the same for Arabic. I will replace those entries with their corresponding abreviations.
Flags: needinfo?(linux.anas)
(In reply to Anas Husseini [:linostar] from comment #20)
> (In reply to Francesco Lodolo [:flod] from comment #19)
> > Forgot Arabic (ar) in the list above.
> > 
> > So far got a reply only from fa (Ehsan), and they don't need a plural form:
> > they're just transliterating KB, MB, etc. so it's invariant.
> > 
> > @Anas
> > Is it the same for Arabic?
> > http://hg.mozilla.org/releases/l10n/mozilla-aurora/ar/file/3d67115a5f40/
> > toolkit/chrome/mozapps/downloads/downloads.properties#l66
> 
> It is the same for Arabic. I will replace those entries with their
> corresponding abreviations.

The (partially) non abbreviated units are there in purpose as I consider those abbreviations vague in Arabic, but either case we do not need plural forms here.
:Maktrix
Can you tell me if bn-BD needs a plural form for these strings (KB, GB, etc.) or it's just transliterating the original abbreviations?
Flags: needinfo?(mahayalamkhan)
(In reply to Francesco Lodolo [:flod] from comment #22)
> :Maktrix
> Can you tell me if bn-BD needs a plural form for these strings (KB, GB,
> etc.) or it's just transliterating the original abbreviations?

Usually, we don't translate these into Bengali. Things is that we don't have Bengali terminology for these, AFAIK. We use English initials or transliterate them.
Flags: needinfo?(mahayalamkhan)
Thanks :-)

So far: ar, bn-BD, fa are just transliterating the original abbreviation.
@Rajesh
Can you tell me what hi-IN does in this case? Are these just transliterated abbreviations?
http://hg.mozilla.org/releases/l10n/mozilla-aurora/hi-IN/file/default/toolkit/chrome/mozapps/downloads/downloads.properties#l66
Flags: needinfo?(rajeshkajha)
Hindi also transliterating the abbreviations as per the community style guide of FUEL.(http://fuelproject.org/styleguide/index)
Flags: needinfo?(rajeshkajha)
Comment on attachment 8365659 [details] [diff] [review]
Patch to use plural form for bytes

Review of attachment 8365659 [details] [diff] [review]:
-----------------------------------------------------------------

Resending f? to Pike. 

So far all locales are transliterating English abbreviations. 

We're still missing km, mai, ml:
* based on the characters and Google Translate, km and mai are doing the same. 
* mai is not supported by Google Translate, but from the characters it seems reasonable that they're using English abbreviations with dots.
Attachment #8365659 - Flags: feedback?(l10n)
In Firefox 34.0.5 in french, I install an add-on. 
When Firefox downloads the add-on, the speed “0 octets/s” appears. This is incorrect. 
The correct speed to show instead is “0 octet/s”. 
Thank you.
Comment on attachment 8365659 [details] [diff] [review]
Patch to use plural form for bytes

Not sure if you still want to spend time on this patch, also because as far as I know we might be changing the time format in the near future, but if you test and unbitrot the patch I can review it.
Attachment #8365659 - Flags: feedback?(l10n)
(In reply to :Paolo Amadini from comment #29)
> Not sure if you still want to spend time on this patch, also because as far
> as I know we might be changing the time format in the near future, but if
> you test and unbitrot the patch I can review it.

Time format -> Size format?

Right now I don't even have a VM set up to run tests, so I don't plan to work on this bug further. I can leave the patch here, in case someone wants to start from where I left.
Assignee: francesco.lodolo → nobody
You need to log in before you can comment on or make changes to this bug.