Closed Bug 74714 Opened 23 years ago Closed 20 years ago

don't hardcode "KB"/"MB" in MailNews

Categories

(MailNews Core :: Localization, defect)

defect
Not set
trivial

Tracking

(Not tracked)

VERIFIED FIXED
Future

People

(Reporter: Peter, Assigned: standard8)

References

Details

(Keywords: polish)

Attachments

(1 file, 5 obsolete files)

Mozilla/5.0 (Windows; U; WinNT4.0; en-US; 0.8.1)

Message "Size" should have a space between the number and "kb" to make it more
legible. 

The k looks kinda like a 7 or 1 and the b looks like an 8 when so close to other
numbers.
so 718kb becomes 718 kb
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: polish
In every representation of kilobyte(s) that I've seen, xkb (where x is a number)
is how it's done.  I'm sure we don't want to break tradition (in fact, there
might surely exist an RFC out there that deals with this issue.) It's the same
thing with ohms, volts, etc.  You see 9V battery, not 9 V battery.  invalid.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Yes, and most people use M$ IE too. Mozilla is not meant to be a "traditional"
browser. We are here to make something *new*, and not repeat the mistakes of the
past. Actually, things like m, m², km are separated from the value (in most
countries). Unless someone can find the actual FRC that prohibits this, I think
this bug should remain open.

The point is that it is difficult to read that way. We need to be bold and do
what is *best* and not what *most* do. Reopen.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
-> Localization
Assignee: sspitzer → rchen
Status: REOPENED → NEW
Component: Mail Window Front End → Localization
QA Contact: esther → ji
Please be more specific, which message or in the xx file or how to reproduce the 
problem so that we can narrow down the area.
This is not a localization problem. It is the string appending issue. I can 
see the string is hardcoded in line 350 nsMsgDBView.cpp. We need to move it out 
to a .properties or .dtd.

hwaara, can you fix it?

Reassigned it to hwaara.
Assignee: rchen → hwaara
I think I can move it out to a properties/dtd file - but that's not the actual
problem here.  

I don't think we should have a space between the number and the KB/K. We don't
in other places in this app, so why be inconsistent?

If you want, I can morph this bug into "make the KB localizable" but I WONTFIX
the space.
FWIW, the American Heritage Dictionary (which we use as a department reference)
lists the abbreviation as "KB" (uppercase letters).
Then why not change it in the rest of the app . Ehy not make everything better
insted of the most visible implementation of "kb" worse, just because it is easier.

Well, if you're all going to be stubborn about this and keep it difficult to
read, then maybe at least you can make the size collumn *right justified*.

That way all kb's will be aligned and the size of the file is clearly determined
by how far it extends to the left.

This would be standard conform because all spreadsheets (e.g. Excel) show number
collumns right justified. How about it?

BTW: what does "make the KB localizable" mean?
4.x right justifies, and it does look better than left justified.
File a new bug (not on me) about that then.  The inital bug description is no
longer current as to what you want fixed.
Status: NEW → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → WONTFIX
> "Well, if you're all going to be stubborn about this"

peter, keep it civil.  thanks.
The following things disagree with Håkan's resolution:
*   Outlook Express 5.0 for Mac OS;
*   Internet Explorer 5.0 for Mac OS;
*   Nautilus (GNOME file manager);
*   the Finder (Mac OS file manager);
*   the /American Institute of Physics Style Manual/, fourth edition, section 3
    (and if anyone would know about units of measurement, it would be them,
    right?);
*   bug 65710;
*   me.

The general rule is that there should be a space between a number and its unit 
of measurement (e.g. `13 cm'), unless the unit is before the number (e.g. 
`NZ$0.02'). So, you don't write `67kilobytes', you write `67 kilobytes'. And 
you don't write `67kb', you write `67 k'. (For kilobytes we omit the `B', to 
help in visually distinguishing between `k' and `MB' in a column of sizes ... 
but that's another bug.)

The only app I can find which doesn't put a space between the number and the 
unit is Windows Explorer. So if you want to make this platform-specific, then 
you can omit the space on Windows. But if you're not going to make it
platform-specific (and I can understand perfectly why you wouldn't want to 
bother:-), it should have a space. Reopening.
Blocks: 65710
Severity: enhancement → trivial
Status: RESOLVED → REOPENED
Keywords: nsCatFood
OS: Windows NT → All
Hardware: PC → All
Resolution: WONTFIX → ---
Summary: Message "Size" should have a space between the number and "kb" → Message size should have a space between the number and "kb"
Matthew, I could not have said it better myself.  There definately _should_ be 
a space between the number and the unit.  Of all the computer applications I 
have seen, the Opera browser seems to display measurements most correctly 
(according to SI), perhaps those involved could have a look at that as a rough 
guide.

I believe that this property should not depend on either platform or locale, as 
it is internationally correct.

On a related note, the correct symbol / abbreviation for second is "s", 
not "sec" as was used in Netscape Communicator.
I propose let's move it to a properties/dtd file so that people can do whatever 
they think it right - add space or change it to KB.  Hardcode in cpp is just not 
the right way. Thanks.
Priority: -- → P5
I have better stuff to do - reassign to module owner and reset bug info.
Assignee: hwaara → rchen
Status: REOPENED → NEW
Priority: P5 → --
Changed the title to "Hardcoded string in nsMsgDBView.cpp".  Please remove it to 
a properties or dtd file.

Reassigned to sspitzer.  
Assignee: rchen → sspitzer
Summary: Message size should have a space between the number and "kb" → Hardcoded string in nsMsgDBView.cpp
there are two of them.  yes, we should be using the string bundle for these.
Summary: Hardcoded string in nsMsgDBView.cpp → remove hardcoded strings in nsMsgDBView.cpp "Re: " and "KB"
According to the offical Norwegian standard NS-ISO 31, there should be a space
between the number and the unit. Therefore, this *needs* to be localizable.
I'm not so sure about "Re: ", mscott tells me it is always "Re: ".

(it was hard coded in 4.x)
Yes, it's *always* 'Re: '. In Outlook Express, 'Re: ' was translated in
localized versions, which has caused tons of problems (e.g. subjects like 'Re:
SV: SV: Re: Aw: Re: Subject').

The latest news standard draft, <URL:
http://www.landfield.com/usefor/drafts/draft-ietf-usefor-article-04.txt >, even
explicitly states this (no doubt because of all the problems OE has caused):

   Followup agents MUST NOT use any other string except "Re: " as a back
   reference. Specifically, a translation of "Re: " into a local
   language or usage MUST NOT be used.

Note that 'MUST NOT' is a requirement.
I agree with Karl - let's have Re: hardcoded.

I once used the swedish version of Outlook, and every time I replied to someone
in a thread - it would break the thread because it used "SV:" (short for "Svar"
-- Reply in swedish) instead of "Re:".

Please look at bug 13025 , bug 29179 and bug 21267 .

Duplicates or merely siblings to this bug? I'll let QA decide.
updating summary.  "Re: " is to remain hard coded.
Summary: remove hardcoded strings in nsMsgDBView.cpp "Re: " and "KB" → don't hardcode "KB" nsMsgDBView.cpp
Target Milestone: --- → Future
There seems to have been some confusion whether there should be a space between
the number and the unit symbol "KB". AFAIK there should be one. I'll give you
some references:

* http://euler9.tripod.com/analysis/si.html
"Always put a space between the numeric value and its following unit symbol (SAE
TSB-003, Sect. 7.3.10; ISO 1000 [4], Sect. 6.1; ASTM SI-10, Sect. 3.5.1.e)."

* http://www.iee.org/EduCareers/ProfDev/Guides/UNITSANDSYMBOLSFORELECTRICAL.doc
"A space is set between the number and its unit symbol (e.g. 240 V, not 240V). 
The decimal multiples and submultiples given below are prefixed, without a
space, to the unit symbols (e.g. 6.6 kV)."

* http://www.microlink.co.uk/units.html
"Unit symbols are placed after the numerical value, leaving a space between the
value and the symbol. For example 5 V not 5V."

I hope this helps.
The proper capitalization of the unit should be "KB", not "kb" or "kB".
- Lowercase 'k' means 1000, uppercase 'K' means 1024.
- Lowercase 'b' means bit, uppercase 'B' means byte.
ref: http://www.poynton.com/PDFs/Writing_SI_units_(USL).pdf
This patch takes the hardcoded "KB" and "MB" from nsMsgDBView.cpp and
nsMsgFolderDataSource.cpp (there were two of them) and places them in the
localizeable file messenger.properties.

From the way the comments were going, the space should be left to the
localization teams to decide.
Attachment #163240 - Flags: review?(neil.parkwaycc.co.uk)
We shouldn't be appending KB on the end, we should be allowing substitution.

In some languages, the KB would be written before the number.
Comment on attachment 163240 [details] [diff] [review]
Patch to allow KB/MB to be localized

>+
>+kiloByteAbbreviation=KB
>+megaByteAbbreviation=MB
Some documentation would be nice.

>+    static const char propertyURL[] = MESSENGER_STRING_URL;
You don't need a static const char for this, the original literal works fine.
Yes, I realize you copied the mistake...

>+  if (mMessengerStringBundle)
>+    res = mMessengerStringBundle->GetStringFromName(aStringName, &ptrv);
>+  
>+  if ( NS_SUCCEEDED(res) && (ptrv) )
>+    return ptrv;
>+  else
>+    return nsCRT::strdup(aStringName);
Well, it's not how I would have implemented it, I didn't like the original in
nsMsgDBView.cpp either, although it's not so bad here because the data source
should be a singleton service.

>     // On OS/2, we have an issue where temporaries get destructed in
>     // conditionals. Solution is to break it out
>     //
>     // XXX todo
>     // can we catch this problem at compile time?
>     // see #179234
This comment is out of date for this code. You can in fact switch this back to
?: because you're safe with PRUnichar* strings.
>     if (sizeInMB)
>-      sizeString.AppendLiteral(" MB");
>+      sizeString.Append(kMegaByteString);
>     else
>-      sizeString.AppendLiteral(" KB");
>+      sizeString.Append(kKiloByteString);
Attachment #163240 - Flags: review?(neil.parkwaycc.co.uk) → review+
A revised patch that incorporates Neil's and Michael's comments, and allows the
localization teams to put the space in if they want (they couldn't before).
Comment on attachment 163747 [details] [diff] [review]
Revised patch to allow any possible localization of KB/MB

Neil, I know if you set review+ and we make minor changes you don't want to
look at it again, but on this patch I've made a couple of what I consider
bigger changes - using a format string to cope with the abbreviation and  a
reworked string bundle.

Do you want to look at it again for r or shall I re-use your existing?
Attachment #163747 - Flags: review?(neil.parkwaycc.co.uk)
Assignee: sspitzer → mark
Comment on attachment 163747 [details] [diff] [review]
Revised patch to allow any possible localization of KB/MB

Cancelling review, minor update coming.
Attachment #163747 - Flags: review?(neil.parkwaycc.co.uk)
Attached patch Minor updates (obsolete) — Splinter Review
Add check for null pointer and add a couple of comments about the localization
as requested by timeless.
Attachment #163747 - Attachment is obsolete: true
Comment on attachment 163755 [details] [diff] [review]
Minor updates

Neil: See notes on previous request, just added a couple of items as requested
by timeless on IRC.
Attachment #163755 - Flags: review?(neil.parkwaycc.co.uk)
Marking assigned, removing helpwanted and updating title to reflect actual
changes. previous title: "don't hardcode "KB" nsMsgDBView.cpp" 
Status: NEW → ASSIGNED
Keywords: helpwanted
Summary: don't hardcode "KB" nsMsgDBView.cpp → don't hardcode "KB"/"MB" in MailNews
Comment on attachment 163747 [details] [diff] [review]
Revised patch to allow any possible localization of KB/MB

>+# LOCALIZATION NOTES(kiloByteAbbreviation): Do not translate %d below, it is the size of the message/folder
>+kiloByteAbbreviation=%dKB
>+# LOCALIZATION NOTES(megaByteAbbreviation): Do not translate %d below, it is the size of the message/folder
>+megaByteAbbreviation=%dMB
Not sure what l10n policy is but it looks odd to duplicate the note!

>+    nsresult res = NS_OK;
>+    if (!mMessengerStringBundle)
>+    {
>+      res = InitStringBundle();
>+    }
This code only runs once so you can inline InitStringBundle using a local
variable.

>+    if (NS_SUCCEEDED(res) && mMessengerStringBundle)
>+    {
>+      mMessengerStringBundle->GetStringFromName(NS_LITERAL_STRING("kiloByteAbbreviation").get(), &kKiloByteString);
>+      mMessengerStringBundle->GetStringFromName(NS_LITERAL_STRING("megaByteAbbreviation").get(), &kMegaByteString);
>+    }
So what if these fail?
Attached patch Revised patch v4 (obsolete) — Splinter Review
Incorporate Neil's comments and cope with failing to get the localized strings
- it displays the localization string name with is what nsMsgDBView.cpp did.
Attachment #163755 - Attachment is obsolete: true
Attachment #163755 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #163973 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 163973 [details] [diff] [review]
Revised patch v4

>-  *aSizeString = ToNewUnicode(formattedSizeString);
>+  if (aSizeString)
>+    *aSizeString = ToNewUnicode(formattedSizeString);
>+  else
>+    return NS_ERROR_OUT_OF_MEMORY;
Stop me if I'm wrong, but aren't you supposed to check the *result* of
ToNewUnicode to see if you ran out of memory?
Comment on attachment 163973 [details] [diff] [review]
Revised patch v4

That'll teach me to do these things when I'm half asleep. New patch coming.
Attachment #163973 - Attachment is obsolete: true
Attachment #163973 - Flags: review?(neil.parkwaycc.co.uk)
Attached patch Revised patch v5 (obsolete) — Splinter Review
Ok, corrected the check for output of ToNewUnicode.
Attachment #164109 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #164109 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #164109 - Flags: superreview?(bienvenu)
Comment on attachment 163240 [details] [diff] [review]
Patch to allow KB/MB to be localized

Obsoleting original patch, now revised one is reviewed.
Attachment #163240 - Attachment is obsolete: true
Comment on attachment 164109 [details] [diff] [review]
Revised patch v5

Neil, shouldn't

 kKiloByteString =
nsCRT::strdup(NS_LITERAL_STRING("kiloByteAbbreviation").get());

be instead:

kKiloByteString = ToNewUnicode(NS_LITERAL_STRING("kiloByteAbbreviation"));

+  if (!*aSizeString)
+    return NS_ERROR_OUT_OF_MEMORY;
+  else
+    return NS_OK;

this can be:

return (*aSizeString) ? NS_OK : NS_ERROR_OUT_OF_MEMORY
Comment on attachment 164109 [details] [diff] [review]
Revised patch v5

in addition to the afore-mentioned change, you need to make a corresponding
change to the free code - it needs to be freed with nsMemory::Free
Attached patch Patch v6Splinter Review
Revised patch with bienview's comments.
Attachment #164109 - Attachment is obsolete: true
Attachment #164109 - Flags: superreview?(bienvenu)
Comment on attachment 164737 [details] [diff] [review]
Patch v6

Neil is happy not to r this patch again, therefore re-using his r.
Now requesting sr.
Attachment #164737 - Flags: superreview?(bienvenu)
Attachment #164737 - Flags: review+
Comment on attachment 164737 [details] [diff] [review]
Patch v6

thx!
Attachment #164737 - Flags: superreview?(bienvenu) → superreview+
Fixed -> Patch checked into truck 2004-11-05 10:08.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago20 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Verified FIXED: we now use kMegaByteString and kKiloByteString to represent MB
and KB hardcoded strings, respectively.  I used LXR for code inspection, and
looked at the various places we use/display them, and we're fine.

SeaMonkey build 2005-07-10-05 on Windows XP.
Status: RESOLVED → VERIFIED
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: