On 8/31/15 5:50 PM, Zibi Braniecki wrote:
Hi all,
I'm working on Intl API v2 and I'm thinking on how to tie those features to
L20n. My approach is to design API that can be used directly from JS (similarly
to how Intl works right now), but in the back of my head I'm thinking on how
we'll expose the same API from within of l20n so that localizers can use it as
well.
One of first things I'd love to see is list formatting. CLDR provides the data
for that and we can add list formatting which would benefit a lot of current
Gaia apps that do it DYI way.
It would look sth like this:
var f = mozIntl.ListFormatter(navigator.languages, {
end: 'word'
});
f.format(['John', 'Mary', 'Nick']); // in en-US it would produce: "John, Mary and
Nick"
--------
Now, when I think about getting it into L20n, one question that pops is how we
handle lists. It feels to me that over last two years we removed the concept of
lists and replaced them with Hashes, which works for values, but not
necessarily for variables.
How can a developer pass a list as a variable, how can he access variable list
elements (no integer, so no $var[0]) and do we want to just support sth like:
<myEntity "You added {{ @cldr.list($namesList) }}">
How does it look to you?
zb.
I guess there are two dimensions here?
How can localizers consume list formatting?
.... and ...
How can localizers implement list formatting?
Is that true?
It'd help me a bunch of we got the problem definition straight to begin
with.
More systemically, I'm still somewhat inclined to differentiate between
macros and filters. Maybe I'm django-infected here a bit more than useful.
I think there's a difference between {{ @cldr.list($nameList) }} and {{
$nameList | @cldr.list }}. To some extent it's just markup. But there's
also a level of "decision-making" between one and the other.
Not sure if it's worth it, though.
In either case, though, I would expect a "good default" handling for
lists, which might just be @cldr.list, independent of the syntax used.
Which, in a way brings us back to "how would a localizer implement
something else?".
Axel
_______________________________________________
tools-l10n mailing list
[email protected]
https://lists.mozilla.org/listinfo/tools-l10n