Closed Bug 1034227 Opened 6 years ago Closed 6 years ago

[email] cookie cache DOM not localized on app restart

Categories

(Firefox OS Graveyard :: Gaia::E-Mail, defect)

x86
macOS
defect
Not set
normal

Tracking

(b2g-v2.0 affected, b2g-v2.1 verified)

RESOLVED FIXED
2.0 S5 (4july)
Tracking Status
b2g-v2.0 --- affected
b2g-v2.1 --- verified

People

(Reporter: jrburke, Assigned: jrburke)

References

Details

(Whiteboard: [NO_UPLIFT])

Attachments

(2 files)

46 bytes, text/x-github-pull-request
asuth
: review+
zbraniecki
: review+
Details | Review
4.67 MB, video/mp4
Details
Since the DOM generated by the cookie cache is in the page before l10n.js is loaded, the l10n MutationObserver hooks (the l10n that is on master/2.1) will not see it:

* Load email with one account configured. Assume English as the starting language.
* Change language to Accented English.
* Change the folder to something other than Inbox, like Sent, then go back to Inbox.
* Kill the email app.
* Change the language in Settings app back to English.
* Relaunch email app.

Notice that the Last Sync label and the search text box placeholder at the top of the list of messages is incorrect.

The folder names, like "Inbox" may still be incorrect, but that is being tracked in bug 855198. This is just for the basic UI localization that is not from the backend data.

The fix is in mail_app.js, when it realizes it has a cachedNode, pass it to mozL10n first before starting up the card machinery.
Summary: [email] cookie cache DOM not updated → [email] cookie cache DOM not localized on app restart
Attached file GitHub pull request
In mail_app.js, if it knows a cachedNode will be used for startup, it passes it to mozL10n.translateFragment first. This fixes the root of the issue.

The change in tmpl.js for bug 1005760 is also removed because now the l10n.js MutationObservers translate the nodes on insertion, so it is just doing extra unneeded work to do this in tmpl.js. This can be confirmed by doing the following:

* Load email with one account configured, open Compose, then close it. Assume start language is English.
* Change the Language in Settings app to "Accented English".
* Go back to email and open the Compose card, it is still correctly translated to Accented English.

Asking asuth to review email changes, and :gandalf to confirm that mozL10n.translateFragment is the correct API to use on master for this change.

Since this changeset relies on a master-only l10n.js API and behavior, it should not be auto-backported to any other branch.
Attachment #8450460 - Flags: review?(gandalf)
Attachment #8450460 - Flags: review?(bugmail)
Comment on attachment 8450460 [details] [review]
GitHub pull request

sweet, looks good!
Attachment #8450460 - Flags: review?(gandalf) → review+
Comment on attachment 8450460 [details] [review]
GitHub pull request

Alas, the Hall and Oates song "Private Eyes" does not work quite as well with "Mutation Observers" (so many syllables!), so the reference I was going to use is no good.  But we can all pretend it did.
Attachment #8450460 - Flags: review?(bugmail) → review+
(marking whiteboard so uplift is not considered per https://wiki.mozilla.org/Release_Management/B2G_Landing)
Whiteboard: [NO_UPLIFT]
Merged in master:
https://github.com/mozilla-b2g/gaia/commit/3db3f62cdf3c3255a912d44c288672c9c36a68e9

from pull request:
https://github.com/mozilla-b2g/gaia/pull/21364
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Assignee: nobody → jrburke
Target Milestone: --- → 2.0 S5 (4july)
Duplicate of this bug: 987065
Note that this is being addressed on older versions of FxOS via bug 1008859
See Also: → 1008859
Attached video verify_video.MP4
This issue has been verified successfully on Flame v2.1
See attachment: verify_video.MP4
Reproducing rate: 0/5
Flame 2.1 versions:
Gaia-Rev        5655269098c7e82254e56933f1af05b4abe2a2f3
Gecko-Rev       https://hg.mozilla.org/releases/mozilla-b2g34_v2_1/rev/86608c9389b5
Build-ID        20141204001201
Version         34.0
Device-Name     flame
FW-Release      4.4.2
FW-Incremental  eng.cltbld.20141204.034958
FW-Date         Thu Dec  4 03:50:09 EST 2014
Bootloader      L1TC00011880
You need to log in before you can comment on or make changes to this bug.