Closed
Bug 1383562
Opened 7 years ago
Closed 7 years ago
Months in the downloads panel are in nominative instead of genitive
Categories
(Firefox :: Downloads Panel, defect, P3)
Firefox
Downloads Panel
Tracking
()
RESOLVED
FIXED
Firefox 58
Tracking | Status | |
---|---|---|
firefox58 | --- | fixed |
People
(Reporter: piotrdrag, Assigned: hrdktg, Mentored)
Details
(Whiteboard: [good first bug])
Attachments
(2 files, 5 obsolete files)
55.43 KB,
image/png
|
Details | |
2.14 KB,
patch
|
zbraniecki
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170628075643
Steps to reproduce:
Opened the download panel using Polish localization.
Actual results:
"15 lipiec" is displayed ("Months - wide - Standalone" in CLDR.)
Expected results:
"15 lipca" should be displayed ("Months - wide - Formatting" in CLDR.)
Updated•7 years ago
|
Component: Untriaged → pl / Polish
Product: Firefox → Mozilla Localizations
Version: 54 Branch → unspecified
Reporter | ||
Comment 1•7 years ago
|
||
I can’t find anything in localization that could be responsible. It’s more likely to be a bug in tools or incorrect use of ICU data.
Reporter | ||
Updated•7 years ago
|
Component: pl / Polish → Downloads Panel
Product: Mozilla Localizations → Firefox
Status: UNCONFIRMED → NEW
Component: Downloads Panel → JavaScript: Internationalization API
Ever confirmed: true
Product: Firefox → Core
Comment 3•7 years ago
|
||
|new Date(2017, 7-1, 15).toLocaleString("pl", {month: "long", day: "numeric"})| returns "15 lipca" for me (current inbound, but also moz54).
DownloadUtils.jsm computes the standalone month and then concatenates it with the current day [1,2]. Maybe it makes sense to either switch completely to Intl.DateTimeFormat or use Intl.DateTimeFormat.prototype.formatToParts to retrieve the correct month name in a non-standalone context.
[1] http://searchfox.org/mozilla-central/rev/ad093e98f42338effe2e2513e26c3a311dd96422/toolkit/mozapps/downloads/DownloadUtils.jsm#367-369
[2] http://searchfox.org/mozilla-central/rev/ad093e98f42338effe2e2513e26c3a311dd96422/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties#107
Comment 4•7 years ago
|
||
Either way, it's not an issue for the "JavaScript: Internationalization API" component.
Component: JavaScript: Internationalization API → Downloads Panel
Product: Core → Firefox
new Date(2017, 7-1, 15).toLocaleString("pl", {month: "long"}) return:
"lipiec"
Flags: needinfo?(andrebargull)
Comment 6•7 years ago
|
||
(In reply to YF (Yang) from comment #5)
> new Date(2017, 7-1, 15).toLocaleString("pl", {month: "long"}) return:
> "lipiec"
Yes, that looks correct to me. "lipiec" in a stand-alone context, otherwise "lipca".
From CLDR (common/main/pl.xml):
<calendar type="gregorian">
<months>
<monthContext type="format">
<!-- ... -->
<monthWidth type="wide">
<month type="1">stycznia</month>
<month type="2">lutego</month>
<month type="3">marca</month>
<month type="4">kwietnia</month>
<month type="5">maja</month>
<month type="6">czerwca</month>
<month type="7">lipca</month>
<month type="8">sierpnia</month>
<month type="9">września</month>
<month type="10">października</month>
<month type="11">listopada</month>
<month type="12">grudnia</month>
</monthWidth>
</monthContext>
<monthContext type="stand-alone">
<!-- ... -->
<monthWidth type="wide">
<month type="1">styczeń</month>
<month type="2">luty</month>
<month type="3">marzec</month>
<month type="4">kwiecień</month>
<month type="5">maj</month>
<month type="6">czerwiec</month>
<month type="7">lipiec</month>
<month type="8">sierpień</month>
<month type="9">wrzesień</month>
<month type="10">październik</month>
<month type="11">listopad</month>
<month type="12">grudzień</month>
</monthWidth>
</monthContext>
</months>
Flags: needinfo?(andrebargull)
Comment 7•7 years ago
|
||
Yeah, Andre is right, this should be switched to full Intl API:
aDate.getLocaleString(undefined, {
month: "long",
day: "numeric"
});
and remove the entity from .properties
Comment 8•7 years ago
|
||
Thanks gandalf, with the solution already outlined in comment 7 this looks like a good first bug for a new contributor, but anyone should feel free to fix it.
Priority: -- → P3
Whiteboard: [good first bug]
Hello. I'd be happy to help if there's still work to do on this. As far as I know, the fix has to be applied in downloadUtils.jsm, in line #367. I'll wait for feedback.
Comment 11•7 years ago
|
||
OK. so, it has to go from this:
let month = aDate.toLocaleDateString(undefined, {month: "long" });
to:
let dateTimeCompact = Intl.DateTimeFormat(undefined, {month: "long", day: "numeric"}).format(aDate);
and then drop the next two lines. Will this fix the problem? I'm not sure how to check the validity of the code; nodejs in my computer shows a valid string, but I'm still not sure.
Comment 12•7 years ago
|
||
You can build Firefox using Artifact Build - https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds
This will be quite fast and allow you to modify JS code, rebuild and see the result.
Comment 13•7 years ago
|
||
thank you. I'm on it now.
Comment 14•7 years ago
|
||
I got my build to run (had already built it, just forgot how to run it), and the solution is already in the works. Will have to wait until tomorrow to continue and hopefully finish before next weekend. I'll keep you updated. Attempted the change proposed before, but it'll take some more time.
Comment 15•7 years ago
|
||
Is this still being worked on?
Updated•7 years ago
|
Flags: needinfo?(luischa123)
Comment 16•7 years ago
|
||
Seems like this bug is for grabs.
The instruction for anyone interested:
1) Replace the code in http://searchfox.org/mozilla-central/rev/ad093e98f42338effe2e2513e26c3a311dd96422/toolkit/mozapps/downloads/DownloadUtils.jsm#367-369
to use:
aDate.toLocaleString(undefined, {
month: "long",
day: "numeric"
});
2) Remove this line: http://searchfox.org/mozilla-central/rev/ad093e98f42338effe2e2513e26c3a311dd96422/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties#107
Flags: needinfo?(luischa123)
Assignee | ||
Comment 17•7 years ago
|
||
Attachment #8920421 -
Flags: review?(gandalf)
Comment 18•7 years ago
|
||
Comment on attachment 8920421 [details] [diff] [review]
Bugfix#1383562
Review of attachment 8920421 [details] [diff] [review]:
-----------------------------------------------------------------
Thank you for the patch! Looks good!
One more nit and we'll be done I believe :)
::: toolkit/mozapps/downloads/DownloadUtils.jsm
@@ +367,5 @@
> + let curMonthDate = aDate.toLocaleString(undefined, {
> + month: "long",
> + day: "numeric"
> + });
> + dateTimeCompact = gBundle.formatStringFromName(gStr.monthDate, [curMonthDate], 1);
No need for the string: `dateTimeCompact = aDate.toLoclaeString(...);`
Also, you can then remove the `gStr.monthDate` in line 88.
Updated•7 years ago
|
Assignee: nobody → hrdktg
Status: NEW → ASSIGNED
Assignee | ||
Comment 19•7 years ago
|
||
There is a big problem, I did the above changes built the code and ran it. Saw in the downloads panel by changing the dates and it is just blank.
On the original code the download panel shows the Month and date of download.
Is there any proper way of checking the output of this javascript function.
Flags: needinfo?(gandalf)
Comment 20•7 years ago
|
||
Can you update your patch so I can test it?
```
var aDate = new Date();aDate.toLocaleString(undefined, {month: "long",day: "numeric"});
```
in a browser console works for me.
Flags: needinfo?(gandalf)
Assignee | ||
Comment 21•7 years ago
|
||
Problem was on my build. I was doing a silly mistake. Its working good now.
Attachment #8920421 -
Attachment is obsolete: true
Attachment #8920421 -
Flags: review?(gandalf)
Attachment #8920430 -
Flags: review?(gandalf)
Comment 22•7 years ago
|
||
Just one more nit. Can you also remove this line: http://searchfox.org/mozilla-central/source/toolkit/mozapps/downloads/DownloadUtils.jsm#82
Thank you!
Assignee | ||
Comment 23•7 years ago
|
||
Attachment #8920430 -
Attachment is obsolete: true
Attachment #8920430 -
Flags: review?(gandalf)
Attachment #8920431 -
Flags: review?(gandalf)
Comment 24•7 years ago
|
||
That looks good!
Sorry for not mentioning in the previous round - you need to update the bug title to something aligned with our bug naming guidelines.
Instead of `Fixed Bug#1383562` it should be: `Bug 1383562 - Correctly decline date in DownloadUtils.jsm. r=gandalf`
Assignee | ||
Comment 25•7 years ago
|
||
Is "Bug 1383562 - Correctly get Month and date in DownloadUtils.jsm. r=gandalf" fine?
Flags: needinfo?(gandalf)
Assignee | ||
Comment 26•7 years ago
|
||
Attachment #8920431 -
Attachment is obsolete: true
Attachment #8920431 -
Flags: review?(gandalf)
Attachment #8920437 -
Flags: review?(gandalf)
Comment 27•7 years ago
|
||
yes! :) But I think you accidentally removed the hunk that removes the line 88 from the file ;)
Flags: needinfo?(gandalf)
Assignee | ||
Comment 28•7 years ago
|
||
:) Sorry..
Attachment #8920437 -
Attachment is obsolete: true
Attachment #8920437 -
Flags: review?(gandalf)
Attachment #8920438 -
Flags: review?(gandalf)
Comment 29•7 years ago
|
||
Looks good!
Aaand, last request - can you remove the localization comment that is right above the line you removed from the .properties file?
It's not needed once the string is gone :)
Assignee | ||
Comment 30•7 years ago
|
||
Attachment #8920438 -
Attachment is obsolete: true
Attachment #8920438 -
Flags: review?(gandalf)
Attachment #8920530 -
Flags: review?(gandalf)
Comment 31•7 years ago
|
||
Comment on attachment 8920530 [details] [diff] [review]
Bug 1383562 - Correctly get Month and date in DownloadUtils.jsm. r=gandalf
Thank you! Looks great!
Attachment #8920530 -
Flags: review?(gandalf) → review+
Comment 32•7 years ago
|
||
When you're ready to land this - add "checkin-needed" to keywords.
Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
Comment 33•7 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d42c58ea0e83
Correctly get Month and date in DownloadUtils.jsm. r=gandalf
Keywords: checkin-needed
Comment 34•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 58
Comment 35•7 years ago
|
||
Thank you for your contribution hardik!
You need to log in
before you can comment on or make changes to this bug.
Description
•