Closed Bug 719456 Opened 12 years ago Closed 12 years ago

Use PluralForm.jsm for feed import messages, to allow proper localization and translation

Categories

(MailNews Core :: Feed Reader, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 13.0

People

(Reporter: p.franc, Assigned: aceman)

References

Details

(Keywords: intl)

Attachments

(1 file, 4 obsolete files)

In bug 307629, there were introduced few messages containing numbers but using only plural form. Use PluralForm.jsm to allow singular and multiple plural forms.
I'll look into this. The code spot in which this is is not very interesting (users encounter it very rarely, most users never).
But I will learn how to use the PluralForm module (for future more important changes).
Severity: normal → minor
Keywords: intl
Summary: Use PluralForm.jsm for feed import messages → Use PluralForm.jsm for feed import messages, to allow proper localization and translation
Version: unspecified → Trunk
aceman: see https://developer.mozilla.org/en/Localization_and_Plurals for more info about PluralForm.
Attached patch patch (obsolete) — Splinter Review
Also convert to Services.prompt while at it (per hints in bug 224831).
Attachment #589987 - Flags: review?(iann_bugzilla)
Status: NEW → ASSIGNED
Comment on attachment 589987 [details] [diff] [review]
patch

>+++ b/mailnews/extensions/newsblog/content/feed-subscriptions.js
>+Components.utils.import("resource://gre/modules/Services.jsm");
>+Components.utils.import("resource://gre/modules/PluralForm.jsm");
>+
>+const promptService = Services.prompt;
I think this should be a var rather than a const (looking at code elsewhere in the tree).

r=me with that addressed, you will still need a review from the TB side.
Attachment #589987 - Flags: review?(iann_bugzilla) → review+
Comment on attachment 589987 [details] [diff] [review]
patch

Why can't it be const if it isn't changed anywhere? Also notice, there is already another service defined const. What are the considerations here?
Attachment #589987 - Flags: review?(myk)
(In reply to :aceman from comment #5)
> Comment on attachment 589987 [details] [diff] [review]
> patch
> 
> Why can't it be const if it isn't changed anywhere? Also notice, there is
> already another service defined const. What are the considerations here?

As I said, everywhere else seems to use the likes of var ps = Services.prompt;
http://mxr.mozilla.org/comm-central/search?string=%3D+Services.prompt%3B&find=&findi=&filter=^[^\0]*%24&hitlimit=&tree=comm-central
Attached patch patch v2 (obsolete) — Splinter Review
OK, I just removed the variable after advice from standard8. Carrying over r=ian neal.
Attachment #589987 - Attachment is obsolete: true
Attachment #589987 - Flags: review?(myk)
Attachment #590793 - Flags: review?(myk)
It would be nice to get this in before the next repo migration (that is, before tomorrow).
Comment on attachment 590793 [details] [diff] [review]
patch v2

That is true, but we need a review from somebody from Thunderbird.
Attachment #590793 - Flags: review?(mbanner)
Blocks: 721517
Comment on attachment 590793 [details] [diff] [review]
patch v2

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

I'm not sure we should generally do other changes in these specific bug fixing, however as Ian has already given his r+ I'll let it go this time.

::: mail/locales/en-US/chrome/messenger-newsblog/newsblog.properties
@@ +15,5 @@
>  subscribe-OPMLImportInvalidFile=The file %S does not seem to be a valid OPML file.
> +## LOCALIZATION NOTE(subscribe-OPMLImportNewFeeds): Semi-colon list of plural forms.
> +## See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
> +## #1 is the count of new imported entries.
> +subscribe-OPMLImportNewFeeds=Imported #1 new feed.;Imported #1 new feeds.

You need to change the names of the string, else they won't be noticed by l10n.

@@ +20,5 @@
> +## LOCALIZATION NOTE(subscribe-OPMLImportUniqueFeeds): Semi-colon list of plural forms.
> +## There is a space at the end of the sentence, because the string
> +## subscribe-OPMLImportFoundFeeds will be appended to it.
> +## #1 is the count of new imported entries
> +subscribe-OPMLImportUniqueFeeds=Imported #1 new feed to which you aren't already subscribed ;Imported #1 new feeds to which you aren't already subscribed ;

I don't think this wants a ; on the end (your other ones don't).

::: mailnews/extensions/newsblog/content/feed-subscriptions.js
@@ +82,3 @@
>        var newsBlogBundle = document.getElementById("bundle_newsblog");
> +      dismissDialog = !(Services.prompt.confirmEx(window,
> +                                        newsBlogBundle.getString('subscribe-cancelSubscriptionTitle'),

nit: The indententation should either be:

dismissDialog = !(Services.prompt.confirmEx(window,
                                            newsBlogBundle.getString('subscribe-cancelSubscription'),

or:

dismissDialog = !(Services.prompt.confirmEx(window,
  newsBlogBundle.getString('subscribe-cancelSubscription'),

@@ +968,5 @@
>            feedsAdded++;
>        }
>  
>        if (outlines.length > feedsAdded)
> +        statusReport = PluralForm.get(feedsAdded, this.mBundle.getString("subscribe-OPMLImportUniqueFeeds")).replace("#1", feedsAdded)+

nit: space after ) and before +.

I think you should consider wrapping these lines as well.
Attachment #590793 - Flags: review?(myk)
Attachment #590793 - Flags: review?(mbanner)
Attachment #590793 - Flags: review-
(In reply to Mark Banner (:standard8) from comment #10)
> Comment on attachment 590793 [details] [diff] [review]
> patch v2
> ::: mail/locales/en-US/chrome/messenger-newsblog/newsblog.properties
> @@ +15,5 @@
> >  subscribe-OPMLImportInvalidFile=The file %S does not seem to be a valid OPML file.
> > +## LOCALIZATION NOTE(subscribe-OPMLImportNewFeeds): Semi-colon list of plural forms.
> > +## See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
> > +## #1 is the count of new imported entries.
> > +subscribe-OPMLImportNewFeeds=Imported #1 new feed.;Imported #1 new feeds.
> 
> You need to change the names of the string, else they won't be noticed by
> l10n.
Sorry, I think I went a bit cross-eyed whilst checking that, as I remember checking the other lines had changed their names.
(In reply to Mark Banner (:standard8) from comment #10)
> @@ +20,5 @@
> > +## LOCALIZATION NOTE(subscribe-OPMLImportUniqueFeeds): Semi-colon list of plural forms.
> > +## There is a space at the end of the sentence, because the string
> > +## subscribe-OPMLImportFoundFeeds will be appended to it.
> > +## #1 is the count of new imported entries
> > +subscribe-OPMLImportUniqueFeeds=Imported #1 new feed to which you aren't already subscribed ;Imported #1 new feeds to which you aren't already subscribed ;
> 
> I don't think this wants a ; on the end (your other ones don't).

It seems it works regardless of the trailing semicolon.
I left that ; intentionally there to make the trailing space very visible. Should I still remove it?
(In reply to Ian Neal from comment #11)
> (In reply to Mark Banner (:standard8) from comment #10)
> > Comment on attachment 590793 [details] [diff] [review]
> > patch v2
> > ::: mail/locales/en-US/chrome/messenger-newsblog/newsblog.properties
> > @@ +15,5 @@
> > >  subscribe-OPMLImportInvalidFile=The file %S does not seem to be a valid OPML file.
> > > +## LOCALIZATION NOTE(subscribe-OPMLImportNewFeeds): Semi-colon list of plural forms.
> > > +## See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
> > > +## #1 is the count of new imported entries.
> > > +subscribe-OPMLImportNewFeeds=Imported #1 new feed.;Imported #1 new feeds.
> > 
> > You need to change the names of the string, else they won't be noticed by
> > l10n.
> Sorry, I think I went a bit cross-eyed whilst checking that, as I remember
> checking the other lines had changed their names.

Yes the other changed but I left this one thinking it already changed in this cycle (TB12) so localizers have not yet picked it up, so this new version will be the only one they see when they jump on Aurora 12. But I can change it too if needed. Probably thinking too much :)
Attached patch patch v3 (obsolete) — Splinter Review
Attachment #590793 - Attachment is obsolete: true
Attachment #592738 - Flags: review?(mbanner)
(In reply to :aceman from comment #12)
> (In reply to Mark Banner (:standard8) from comment #10)
> > @@ +20,5 @@
> > > +## LOCALIZATION NOTE(subscribe-OPMLImportUniqueFeeds): Semi-colon list of plural forms.
> > > +## There is a space at the end of the sentence, because the string
> > > +## subscribe-OPMLImportFoundFeeds will be appended to it.
> > > +## #1 is the count of new imported entries
> > > +subscribe-OPMLImportUniqueFeeds=Imported #1 new feed to which you aren't already subscribed ;Imported #1 new feeds to which you aren't already subscribed ;
> > 
> > I don't think this wants a ; on the end (your other ones don't).
> 
> It seems it works regardless of the trailing semicolon.
> I left that ; intentionally there to make the trailing space very visible.
> Should I still remove it?

Hang on, if we're relying on trailing spaces, then that isn't good. Which then makes me realise that we're stringing these two plural strings together.

So to do this in a way that will satisfy rtl locales, we need to do a compositor entity and the two entities we have now, ending up with something like this:

http://hg.mozilla.org/comm-central/annotate/ed69c6a773d6/mail/locales/en-US/chrome/messenger/glodaFacetView.properties#l145
Attachment #592738 - Flags: review?(mbanner) → review-
I thought about making it that way but we haven't done it that way in bug 346306 so I thought it is not really needed.
So I'll rework it.
Attached patch patch v4 (obsolete) — Splinter Review
Attachment #592738 - Attachment is obsolete: true
Attachment #593095 - Flags: review?(mbanner)
(In reply to :aceman from comment #16)
> I thought about making it that way but we haven't done it that way in bug
> 346306 so I thought it is not really needed.

Bug 346306 didn't use plural forms...
Comment on attachment 593095 [details] [diff] [review]
patch v4

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

::: mailnews/extensions/newsblog/content/feed-subscriptions.js
@@ +977,5 @@
>            feedsAdded++;
>        }
>  
>        if (outlines.length > feedsAdded)
> +        statusReport = this.mBundle.getFormattedString("subscribe-OPMLImportStatus",

nit: slightly wrong indentation in this block. Should be:

statusReport = this.mBundle.getFormattedString("subscribe-OPMLImportStatus",
  [PluralForm.get(feedsAdded,
                  this.mBundle.getString("subscribe-OPMLImportUniqueFeeds"))
             .replace("#1", feedsAdded),
   PluralForm.get(outlines.length,
                  this.mBundle.getString("subscribe-OPMLImportFoundFeeds"))
             .replace("#1", outlines.length)]);

So basically, align the dots. Make sure the second attribute starts under the letter after the opening bracket of the function, and similarly with the second value in the array.
Attachment #593095 - Flags: review?(mbanner) → review+
(In reply to Mark Banner (:standard8) from comment #18)
> (In reply to :aceman from comment #16)
> > I thought about making it that way but we haven't done it that way in bug
> > 346306 so I thought it is not really needed.
> 
> Bug 346306 didn't use plural forms...

But it now has hardcoded concatenation of strings via space:
- suffix="&haveSmtp1.suffix2;">*</description>
+ suffix="&haveSmtp1.suffix3; &modifyOutgoing.suffix;">*</description>

That is what you are objecting to in comment 15.
Yeah and let's start all over thanks to bug 716706...
Depends on: 716706
Attached patch patch v5Splinter Review
So I dropped everything except the real string changes.
Attachment #593095 - Attachment is obsolete: true
Attachment #600575 - Flags: review?(mbanner)
Attachment #600575 - Flags: review?(mbanner) → review+
Checked in: http://hg.mozilla.org/comm-central/rev/9dad12835d44
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 13.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: