Closed
Bug 1208369
Opened 10 years ago
Closed 10 years ago
Add mock_l20n.js
Categories
(Firefox OS Graveyard :: Gaia::L10n, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: stas, Unassigned)
References
Details
Attachments
(1 file)
As we port more and more apps to l20n.js, a corresponding mock would be helpful.
Comment 1•10 years ago
|
||
Reporter | ||
Updated•10 years ago
|
Reporter | ||
Comment 2•10 years ago
|
||
I changed the way the stringify function works compared to mock_l10n. I wanted to make it consistent between formatValue and formatValues. The new behavior stringifies to a simple string if only an identifier was passed, and to a serialized array otherwise. A few examples should illustrate this nicely (the output is what the returned promise resolves to):
> MockL10n.formatValue('hello')
'hello'
> MockL10n.formatValue('hello', {name: 'Mary'})
'["hello",{"name":"Mary"}]'
> MockL10n.formatValues('hello')
['hello']
> MockL10n.formatValues(['hello', {name: 'Mary'}])
['["hello",{"name":"Mary"}]']
> MockL10n.formatValue(['hello', {name: 'Mary'}], 'welcome')
['["hello",{"name":"Mary"}]', 'welcome']
Reporter | ||
Comment 3•10 years ago
|
||
Comment on attachment 8665843 [details] [review]
[gaia] stasm:1208369-mock_l20n > mozilla-b2g:master
Zibi, what do you think?
Attachment #8665843 -
Flags: review?(gandalf)
Comment 4•10 years ago
|
||
Comment on attachment 8665843 [details] [review]
[gaia] stasm:1208369-mock_l20n > mozilla-b2g:master
sweet.
You may also want to put l10nAssert in it for parity.
Attachment #8665843 -
Flags: review?(gandalf) → review+
Reporter | ||
Comment 5•10 years ago
|
||
Added l10nAssert and landed https://github.com/mozilla-b2g/gaia/commit/3b42b4977273587fa86bc95afda471087eeeb545. Thanks!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•