Closed
Bug 1029944
Opened 10 years ago
Closed 10 years ago
Switch ModalDialog and AppModalDialog from using strings to using l10nIds
Categories
(Firefox OS Graveyard :: Gaia::System, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: zbraniecki, Assigned: yifan, Mentored)
References
Details
(Whiteboard: [good first bug])
Attachments
(1 file)
Currently both ModalDialog and AppModalDialog API's rely on passing strings that are injected into DOM.
This is overly complicated and limits the localizability of the dialogs.
Currently the code calls mozL10n.get(l10nId) and passes the value to ModalDialog's config yesText, noText and title which uses textContent or innerHTML to inject it.
Instead, the code should pass the l10nId and ModalDialog should just set node.setAttribute('data-l10n-id', l10nId).
This bug is part of an ongoing effort to increase the localizability of Firefox OS UI by moving as much l10n as possible to go through declarative l10nId/l10nArgs (bug 1020138).
Reporter | ||
Comment 1•10 years ago
|
||
I confirmed that no use cases rely on escapeHTML so it's mostly about this function: https://github.com/mozilla-b2g/gaia/blob/669bb17a487e53b2c62d628d0e1d1e94968da919/apps/system/js/modal_dialog.js#L156-L227
and all its use cases. We need to switch the title and message to be l10nId's or null and yesText and noText to be l10nId's as well.
It's fairly easy and I'll be happy to mentor if anyone wants to give it a try.
Mentor: gandalf
Whiteboard: [good first bug]
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → yliao
Assignee | ||
Comment 2•10 years ago
|
||
Replaced mozL10n.get(l10nId) calls with node.setAttribute('data-l10n-id', l10nId) in ModalDialog and its use cases.
Attachment #8465993 -
Flags: review?(gandalf)
Reporter | ||
Comment 3•10 years ago
|
||
Comment on attachment 8465993 [details]
pull request
That looks good! Thanks a lot :)
Attachment #8465993 -
Flags: review?(gandalf) → review+
Assignee | ||
Comment 5•10 years ago
|
||
Comment on attachment 8465993 [details]
pull request
Thank you! I later found out the test failed.
Test code of ModalDialog is updated. Changed comparisons of innerHtml and textContent to 'data-l10-id' attribute. Please see if the change conflicts anything.
Attachment #8465993 -
Flags: review+ → review?(gandalf)
Reporter | ||
Comment 6•10 years ago
|
||
Comment on attachment 8465993 [details]
pull request
r+!
Attachment #8465993 -
Flags: review?(gandalf) → review+
Assignee | ||
Comment 7•10 years ago
|
||
Thank you!
Merged in master:
https://github.com/mozilla-b2g/gaia/pull/22387
TBPL:
https://tbpl.mozilla.org/?rev=6205a92411686ae41a8343462ce5264a34c0423e&tree=Gaia-Try
Reporter | ||
Comment 8•10 years ago
|
||
Can we close this bug now?
Assignee | ||
Comment 9•10 years ago
|
||
Yes, forgot that, sorry about it.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Depends on: 1058745
Depends on: 1058795
You need to log in
before you can comment on or make changes to this bug.
Description
•