Closed Bug 416446 Opened 13 years ago Closed 13 years ago

Make PluralForm more useful for extensions and delay importing strings for perf

Categories

(Core :: Internationalization: Localization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta4

People

(Reporter: Mardak, Assigned: Mardak)

Details

(Keywords: dev-doc-complete, perf)

Attachments

(1 file, 1 obsolete file)

Extensions will have troubles using PluralForm because it uses the browser's plural rule, but if the extension isn't localized to the same rule, there'll be issues. So instead, we can provide a "makeGet" method that basically creates a "PluralForm" for an input plural rule. Now extensions can specify their own plural rule number.

Also, we can avoid loading the pluralRule string until we really need to on first access to help perf.
Attached patch v1 (obsolete) — Splinter Review
Plus testcase! :)
Assignee: nobody → edilee
Status: NEW → ASSIGNED
Attachment #302205 - Flags: review?(smontagu)
Attachment #302205 - Flags: review?(l10n)
Keywords: perf
Comment on attachment 302205 [details] [diff] [review]
v1

Not going to get to review this, canceling the request.
Attachment #302205 - Flags: review?(l10n)
Comment on attachment 302205 [details] [diff] [review]
v1

r?sdwilsh as this code was going to be in toolkit/ download stuff originally. So perhaps smontagu can give an official r+ if sdwilsh r+s.
Attachment #302205 - Flags: review?(sdwilsh)
Comment on attachment 302205 [details] [diff] [review]
v1

r=sdwilsh, but how about makeGetter instead?
Attachment #302205 - Flags: review?(sdwilsh) → review+
Attached patch v1.1Splinter Review
(In reply to comment #4)
> (From update of attachment 302205 [details] [diff] [review])
> r=sdwilsh, but how about makeGetter instead?
Sure.

r?smontagu for official review to land

Also reordered the return value to be get then numForms to be more consistent with what the consumer probably wants, so the second thing can be easily dropped off.
Attachment #302205 - Attachment is obsolete: true
Attachment #305292 - Flags: review?(smontagu)
Attachment #305292 - Flags: approval1.9?
Attachment #302205 - Flags: review?(smontagu)
Attachment #305292 - Flags: review?(smontagu) → review+
Comment on attachment 305292 [details] [diff] [review]
v1.1

a1.9+=damons
Attachment #305292 - Flags: approval1.9? → approval1.9+
Checking in intl/locale/src/PluralForm.jsm;
/cvsroot/mozilla/intl/locale/src/PluralForm.jsm,v  <--  PluralForm.jsm
new revision: 1.5; previous revision: 1.4
done
RCS file: /cvsroot/mozilla/intl/locale/tests/unit/test_pluralForm_makeGetter.js,v
done
Checking in intl/locale/tests/unit/test_pluralForm_makeGetter.js;
/cvsroot/mozilla/intl/locale/tests/unit/test_pluralForm_makeGetter.js,v  <--  test_pluralForm_makeGetter.js
initial revision: 1.1
done
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9beta4
You need to log in before you can comment on or make changes to this bug.