Closed
Bug 940772
Opened 11 years ago
Closed 10 years ago
Dehardcode plural on Gaia branch
Categories
(Firefox OS Graveyard :: Gaia::L10n, defect, P4)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: zbraniecki, Assigned: stas)
References
Details
Attachments
(1 file, 1 obsolete file)
6.11 KB,
patch
|
zbraniecki
:
review+
|
Details | Diff | Splinter Review |
We currently do several things that hardcode plural macro on Gaia branch.
I'd like to add formFactor support so I need to fix that.
There are two elements:
1) parser hardcodes plural
2) compiler hardcode single arg macro calls
Both should be relatively easy to fix.
Reporter | ||
Comment 1•11 years ago
|
||
Assignee: nobody → gandalf
Reporter | ||
Comment 2•11 years ago
|
||
This is a POC of the compiler work.
Stas: Can you take a look at this POC and review it for me?
Thanks!
Attachment #8334972 -
Flags: feedback?(stas)
Assignee | ||
Comment 3•11 years ago
|
||
Comment on attachment 8334972 [details] [diff] [review]
POC
Review of attachment 8334972 [details] [diff] [review]:
-----------------------------------------------------------------
It looks good, although I didn't have time to test in myself yet. AIUI, the main goal here is to allow for call expressions to not have any arguments, and the approach seems fine.
::: lib/l20n/compiler.js
@@ +402,5 @@
> var callee = Expression(node.callee, entry);
> // support only one argument per callExpr for now
> + var arg = null;
> + if (node.arguments.length) {
> + arg = Expression(node.arguments[0], entry);
I think you shouldn't need to do this here, because the Expression constructor will return null if node.arguments[0] is falsy.
@@ +419,2 @@
>
> + // special cases for zero, one, two if they are defined on the hash
Should we leave those special cases here untouched, or should we make them plural-specific?
I'm fine with leaving them as they are.
Attachment #8334972 -
Flags: feedback?(stas) → feedback+
Assignee | ||
Updated•11 years ago
|
Component: General → Gaia Bindings
Reporter | ||
Updated•11 years ago
|
Component: Gaia Bindings → Gaia::L10n
Product: L20n → Firefox OS
Assignee | ||
Updated•11 years ago
|
Assignee: gandalf → stas
Priority: -- → P3
Reporter | ||
Updated•11 years ago
|
Priority: P3 → P2
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•10 years ago
|
||
The old POC was based on the old branch of l10n.js.
This patch makes it possible to use any kind of expression in the index:
- a macro call with an argument: {[ plural(n) ]}
- a macro call without arguments: {[ macro() ]}
- a string or variable identifier: {[ brandName ]}
I probably need more tests, but the logic in the patch is good to review at this point.
Attachment #8334972 -
Attachment is obsolete: true
Attachment #8446114 -
Flags: review?(gandalf)
Assignee | ||
Updated•10 years ago
|
Priority: P2 → P4
Reporter | ||
Comment 5•10 years ago
|
||
Comment on attachment 8446114 [details] [diff] [review]
Make indexes accept various expressions
Review of attachment 8446114 [details] [diff] [review]:
-----------------------------------------------------------------
Sorry it took me so long Stas! The patch looks good, although I'm not sure how much this will change when we add l20n parser.
Attachment #8446114 -
Flags: review?(gandalf) → review+
Assignee | ||
Comment 6•10 years ago
|
||
These changes will make it easier to add a subset of the l20n syntax, so this should be a change into the right direction. I submitted a pull request, waiting for TBPL before merging:
https://github.com/mozilla-b2g/gaia/pull/23806
https://tbpl.mozilla.org/?rev=70462fa574e5&tree=Gaia-Try
Assignee | ||
Comment 7•10 years ago
|
||
Commit: https://github.com/mozilla-b2g/gaia/commit/b9385cb197f275e43b087ada82dc5fcfe85bcb9d
Master: https://github.com/mozilla-b2g/gaia/commit/5110fc938f26acbee951df8233412b8001cdf357
L20n.js: https://github.com/l20n/l20n.js/commit/6dc19ec1d83ba9ce137b570d569ba5758c0baf71
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•