Closed
Bug 580454
Opened 14 years ago
Closed 14 years ago
Localize console timestamps
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(blocking2.0 -)
VERIFIED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | - |
People
(Reporter: pcwalton, Assigned: pcwalton)
References
Details
(Whiteboard: [kd4b6] [strings] [patchclean:0909] [Web-Console-Testday])
Attachments
(3 files, 4 obsolete files)
(deleted),
patch
|
Pike
:
feedback+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
dietrich
:
review+
dietrich
:
approval2.0+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review |
The l10n hazard alluded to in bug 568656 can be fixed with the use of the Date's toLocaleString() method. The attached patch fixes this.
Attachment #458844 -
Flags: review?(ddahl)
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → pwalton
Assignee | ||
Comment 1•14 years ago
|
||
Comment on attachment 458844 [details] [diff] [review]
Patch. Requires patch in bug 578658.
This patch is wrong, because it no longer displays milliseconds.
Attachment #458844 -
Attachment is obsolete: true
Attachment #458844 -
Flags: review?(ddahl)
Assignee | ||
Updated•14 years ago
|
Summary: Use toLocaleString() for Console timestamps → Localize console timestamps
Assignee | ||
Comment 2•14 years ago
|
||
New patch localizes timestamps including milliseconds as best I can, using nsIScriptableDateFormat and massaging the output. A test case is included. Feedback requested.
Attachment #461403 -
Flags: feedback?(ddahl)
Assignee | ||
Comment 3•14 years ago
|
||
Requesting betaN blocking status for this bug because this is a localization issue with the Web Console.
blocking2.0: --- → ?
Updated•14 years ago
|
Whiteboard: [kd4b4]
Comment 4•14 years ago
|
||
Not a blocker - not primary UI, not a major regression, and the feature is not non-functional. Would take a low-risk patch w/ tests.
blocking2.0: ? → -
Comment 5•14 years ago
|
||
This patch looks wrong on many accounts.
Stripping leading zeros sounds wrong. Not sure how the ms are coming into the date. The tests should pass for non-en-US locales.
And I'm not sure what the logic around the last number does.
Maybe just go for a plain localized strings that takes $1$i for hour, minute, second, and ms?
Assignee | ||
Comment 6•14 years ago
|
||
(In reply to comment #5)
> Maybe just go for a plain localized strings that takes $1$i for hour, minute,
> second, and ms?
The problem with this is that it seems difficult to deal with AM/PM and 24-hour time.
Comment 7•14 years ago
|
||
I could totally live with the US all eating 24 hours :-).
If you think you need AM/PM, yeah, I wouldn't know. Not sure how much you tested all the variants that nsIScriptableDateFormat yields on all those platforms.
Assignee | ||
Comment 8•14 years ago
|
||
(In reply to comment #7)
> I could totally live with the US all eating 24 hours :-).
>
> If you think you need AM/PM, yeah, I wouldn't know. Not sure how much you
> tested all the variants that nsIScriptableDateFormat yields on all those
> platforms.
How about two localization strings: one for AM and one for PM? In areas with a 24-hour clock, the localization strings will simply be the same.
Comment 9•14 years ago
|
||
you'd have to pass different hours, though.
Assignee | ||
Comment 10•14 years ago
|
||
(In reply to comment #9)
> you'd have to pass different hours, though.
I was planning on using "%I" in the string to mean "hours (12-hour clock)" and "%H" to mean "hours (24-hour clock)", just as strftime(3) does. The l10n string can just choose the appropriate one.
Comment 11•14 years ago
|
||
our printfs end up in http://mxr.mozilla.org/mozilla-central/source/nsprpub/pr/include/prprf.h#41, which doesn't support I and H :-(.
Assignee | ||
Comment 12•14 years ago
|
||
Well, I'd do the "%I" and "%H" manually from JavaScript. Ugly, but works.
Assignee | ||
Comment 13•14 years ago
|
||
That is, I'd do the search-and-replace on those strings manually from JavaScript.
Comment 14•14 years ago
|
||
I am thinking AM/PM is a followup bug. Sholdn't we just force 24 hour clock in the console until we have more time to deal with it?
Assignee | ||
Comment 15•14 years ago
|
||
(In reply to comment #14)
> I am thinking AM/PM is a followup bug. Sholdn't we just force 24 hour clock in
> the console until we have more time to deal with it?
You're right, let's do that.
Comment 16•14 years ago
|
||
(In reply to comment #14)
FWIW, for locales that don't use AM/PM 12-hour format, we don't care about this to be localized or not, we only use 24-hour format. Sorry if I made noise in this bug for something not relevant.
Assignee | ||
Comment 17•14 years ago
|
||
New patch localizes the timestamps using a simple format string.
Attachment #461403 -
Attachment is obsolete: true
Attachment #462267 -
Flags: feedback?(l10n)
Attachment #461403 -
Flags: feedback?(ddahl)
Comment 18•14 years ago
|
||
Comment on attachment 462267 [details] [diff] [review]
Proposed patch, version 3.
I guess I'd move the padding into the format string. That would allow the persians to even go for full text.
I'm a bit surprised to see the hours padded with '0', fwiw.
Attachment #462267 -
Flags: feedback?(l10n) → feedback-
Assignee | ||
Comment 19•14 years ago
|
||
(In reply to comment #18)
> Comment on attachment 462267 [details] [diff] [review]
> Proposed patch, version 3.
>
> I guess I'd move the padding into the format string. That would allow the
> persians to even go for full text.
What do you mean by full text?
Comment 20•14 years ago
|
||
"12:35 and 72 milliseconds" would be full text.
I guess that "%02d:%02d.%03d" or something should be equivalent.
Assignee | ||
Comment 21•14 years ago
|
||
How do you use %d in locale strings? A quick grep through the tree shows that no .properties file contains a %d.
Comment 22•14 years ago
|
||
You're from js, right? I guess you'll be %S then anyway. I usually end up with trial and error what the code actually does.
Assignee | ||
Comment 23•14 years ago
|
||
New patch makes the padding part of the format string. This way, localizers can choose to omit it if they'd like.
Attachment #462267 -
Attachment is obsolete: true
Attachment #464672 -
Flags: feedback?(l10n)
Updated•14 years ago
|
Whiteboard: [kd4b4] → [kd4b5]
Updated•14 years ago
|
Whiteboard: [kd4b5] → [kd4b5] [patchclean:0817]
Comment 24•14 years ago
|
||
Does this actually still depend on bug 578658? That one is not going to make it in. We should try to do this one without that dependency.
Assignee | ||
Comment 25•14 years ago
|
||
(In reply to comment #24)
> Does this actually still depend on bug 578658? That one is not going to make it
> in. We should try to do this one without that dependency.
No, it doesn't. (But we should still land bug 578658 at some point, at the risk of going off-topic...)
Comment 26•14 years ago
|
||
Comment on attachment 464672 [details] [diff] [review]
Proposed patch, version 4.
<...>
>+# LOCALIZATION NOTE (timestampFormat): %1$S = leading zeroes for hours, %2$S = hours (24-hour clock), %3$S = leading zeroes for minutes, %4$S = minutes, %5$S = leading zeroes for seconds, %6$S = seconds, %7$S = leading zeroes for milliseconds, %8$S = milliseconds
>+timestampFormat=%S%S:%S%S:%S%S.%S%S
Can't you do the padding of zeros wit %02S ? Don't have a build to test locally right now.
Comment 27•14 years ago
|
||
Comment on attachment 464672 [details] [diff] [review]
Proposed patch, version 4.
Noting a feedback- as long as I'm waiting for an answer on comment 26.
Attachment #464672 -
Flags: feedback?(l10n) → feedback-
Assignee | ||
Updated•14 years ago
|
Whiteboard: [kd4b5] [patchclean:0817] → [kd4b5] [patchbitrot]
Assignee | ||
Comment 28•14 years ago
|
||
Sweet! %02S works.
Patch rebased and updated per feedback.
Attachment #464672 -
Attachment is obsolete: true
Attachment #469540 -
Flags: feedback?(l10n)
Assignee | ||
Updated•14 years ago
|
Whiteboard: [kd4b5] [patchbitrot] → [kd4b5] [patchclean:0826]
Comment 29•14 years ago
|
||
Comment on attachment 469540 [details] [diff] [review]
Proposed patch, version 5.
That looks good. I wonder if
timestampFormat=%2S:%02S:%02S.%03S
would be better still, that should pad the hours with ' ', I think.
Anyway, this is good to get real code review by someone, thanks for your questions.
Attachment #469540 -
Flags: feedback?(l10n) → feedback+
Assignee | ||
Updated•14 years ago
|
Attachment #469540 -
Flags: review?(gavin.sharp)
Updated•14 years ago
|
Whiteboard: [kd4b5] [patchclean:0826] → [kd4b6] [patchclean:0826]
Updated•14 years ago
|
Whiteboard: [kd4b6] [patchclean:0826] → [kd4b6] [strings] [patchclean:0826]
Assignee | ||
Updated•14 years ago
|
Whiteboard: [kd4b6] [strings] [patchclean:0826] → [kd4b6] [strings] [patchbitrot]
Updated•14 years ago
|
Blocks: devtools4b7
Assignee | ||
Comment 30•14 years ago
|
||
New patch rebases to trunk and splits out the test into its own file.
Attachment #472836 -
Flags: review?(dietrich)
Assignee | ||
Updated•14 years ago
|
Attachment #469540 -
Flags: review?(gavin.sharp)
Assignee | ||
Updated•14 years ago
|
Whiteboard: [kd4b6] [strings] [patchbitrot] → [kd4b6] [strings] [patchclean:0907]
Updated•14 years ago
|
Attachment #472836 -
Flags: review?(dietrich) → review+
Assignee | ||
Updated•14 years ago
|
Attachment #472836 -
Flags: approval2.0?
Updated•14 years ago
|
Attachment #472836 -
Flags: approval2.0? → approval2.0+
Assignee | ||
Updated•14 years ago
|
Keywords: checkin-needed
Comment 31•14 years ago
|
||
running the HUDService tests with this installed, I get the following error:
TEST-PASS | chrome://mochikit/content/browser/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js | console exists
JavaScript error: , line 0: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIStringBundle.formatStringFromName]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/HUDService.jsm :: HS_getFormatStr :: line 1292" data: no]
TEST-INFO | chrome://mochikit/content/browser/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js | Console message: [JavaScript Error: "uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIStringBundle.formatStringFromName]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/HUDService.jsm :: HS_getFormatStr :: line 1292" data: no]"]
Line 1292 is in HS_getFormatStr(aName, aArray).
Updated•14 years ago
|
Keywords: checkin-needed
Whiteboard: [kd4b6] [strings] [patchclean:0907] → [kd4b6] [strings] [patchclean:0907][test-breakage]
Assignee | ||
Updated•14 years ago
|
Whiteboard: [kd4b6] [strings] [patchclean:0907][test-breakage] → [kd4b6] [strings] [patchclean:0907] [test-breakage]
Assignee | ||
Comment 32•14 years ago
|
||
(In reply to comment #31)
> running the HUDService tests with this installed, I get the following error:
>
> TEST-PASS |
> chrome://mochikit/content/browser/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
> | console exists
> JavaScript error: , line 0: uncaught exception: [Exception... "Component
> returned failure code: 0x80004005 (NS_ERROR_FAILURE)
> [nsIStringBundle.formatStringFromName]" nsresult: "0x80004005
> (NS_ERROR_FAILURE)" location: "JS frame ::
> resource://gre/modules/HUDService.jsm :: HS_getFormatStr :: line 1292" data:
> no]
> TEST-INFO |
> chrome://mochikit/content/browser/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
> | Console message: [JavaScript Error: "uncaught exception: [Exception...
> "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
> [nsIStringBundle.formatStringFromName]" nsresult: "0x80004005
> (NS_ERROR_FAILURE)" location: "JS frame ::
> resource://gre/modules/HUDService.jsm :: HS_getFormatStr :: line 1292" data:
> no]"]
>
> Line 1292 is in HS_getFormatStr(aName, aArray).
Did you rebuild from top level? The standard commands for incremental builds in toolkit/ won't work if there's a string change.
Assignee | ||
Comment 33•14 years ago
|
||
All tests pass for me.
Comment 34•14 years ago
|
||
(In reply to comment #32)
> (In reply to comment #31)
> > Line 1292 is in HS_getFormatStr(aName, aArray).
>
> Did you rebuild from top level? The standard commands for incremental builds in
> toolkit/ won't work if there's a string change.
oh. No I didn't. Sorry for the alarm. I am toolkit nub.
Assignee | ||
Updated•14 years ago
|
Whiteboard: [kd4b6] [strings] [patchclean:0907] [test-breakage] → [kd4b6] [strings] [patchclean:0907]
Assignee | ||
Comment 35•14 years ago
|
||
New version of the patch rebases to trunk.
Assignee | ||
Updated•14 years ago
|
Keywords: checkin-needed
Whiteboard: [kd4b6] [strings] [patchclean:0907] → [kd4b6] [strings] [patchclean:0909]
Comment 36•14 years ago
|
||
Comment on attachment 473890 [details] [diff] [review]
[checked-in] Proposed patch, version 5.2.
http://hg.mozilla.org/mozilla-central/rev/224777dc8afe
Attachment #473890 -
Attachment description: Proposed patch, version 5.2. → [checked-in] Proposed patch, version 5.2.
Updated•14 years ago
|
Keywords: checkin-needed
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Status: RESOLVED → VERIFIED
Whiteboard: [kd4b6] [strings] [patchclean:0909] → [kd4b6] [strings] [patchclean:0909] [Web-Console-Testday]
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•