Clean up bootstrap mozL10n API use in FTU

RESOLVED FIXED in 2.0 S1 (9may)

Status

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: zbraniecki, Assigned: zbraniecki)

Tracking

unspecified
2.0 S1 (9may)
Dependency tree / graph

Firefox Tracking Flags

(b2g-v2.0 fixed)

Details

Attachments

(1 attachment)

FTU currently initializes two codepaths using mozL10n.ready and manually set document's lang/dir.

It should use mozL10n.once and should not set document's lang/dir manually (l10n.js does that).
Blocks: 993188
Posted file pull request
Assignee: nobody → gandalf
Status: NEW → ASSIGNED
Attachment #8409852 - Flags: review?(fernando.campo)
Actually, I left single mozL10n.ready and a flag since it wasn't cleaner to separate it into mozL10n.ready and mozL10n.once code.

I just renamed the flag to be more self-explanatory and removed manual setting of document's lang/dir.
Comment on attachment 8409852 [details] [review]
pull request

Right, lang and dir are set on translation. Has been any change about this or have we been using this wrong from the beginning?

I'm a little lost with l10n.js after the refactor, but does not function once() wait till isReady flag has been set and then trigger the callback?
Doesn't that make .once() and .ready() do the same?
Attachment #8409852 - Flags: review?(fernando.campo) → review+
(In reply to Fernando Campo (:fcampo) from comment #3)
> Comment on attachment 8409852 [details] [review]
> pull request
> 
> Right, lang and dir are set on translation. Has been any change about this
> or have we been using this wrong from the beginning?

Refactor cleaned this.

> I'm a little lost with l10n.js after the refactor, but does not function
> once() wait till isReady flag has been set and then trigger the callback?
> Doesn't that make .once() and .ready() do the same?

.once will fire once (yay!) and deregister.
.ready will fire once and then on every language change when new language resources are ready.

Use .once for all basic code initialization patterns. Use .ready for code that sets UI using language.
Master: https://github.com/mozilla-b2g/gaia/commit/d8904c5af6152f5d647a93a0c31227171ddecd87
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 2.0 S1 (9may)
Blocks: 1000593
No longer blocks: 993188
You need to log in before you can comment on or make changes to this bug.