Hi Igor,
Apologies for such a late response. I've been mostly focused on pushing Firefox
OS'es l10n.js library which will eventually become one with L20n.
> 1. I had some problems with pluralizations. I don't understand global
> "updateData" concept. If I use one parametrized localization key on the
> page several times, what should I do with param? E.g.
>
> <minutes_ago[plural($count)] {
>
> > zero: 'just now',
>
> > one: 'minute ago',
>
> > many: '{{ $count }} minutes ago'
>
> > }>
>
> So if I use (updateData({count: X}) + localizeNode) several times before
> localization file was downloaded, the behaviour becomes unpredictable.
What do you mean by "unpredictable"? The behavior should be fully predictable -
the node should have the value computed based on the latest value of $count.
> It seems like the solution is to have some light data contexts and allow
> localization within it. I've seen L20n.getContext function, but it looks
> pretty heavy and requires locale registration, otherwise it throws 'Context
> not ready' error. So, I think that this is not the context I need.
getContext is just returning a custom context, similar to the "main" one used
by the whole document.
It will not change much how your ctxData works.
So, both should work the same way.
One limitation of the current master's implementation of Contexts is that
they're not linked to language negotiation, so once the user update the
language it will not change in the custom contexts.
We just finished work week where we drafted an update to our API that will link
all contexts to a common language negotiation, and you will not need custom one
for each context.
> 2. I have nodes with non-plain or dynamic contents, like emoji <img> tags
> or triple dots animation, and I need L20n to skip these nodes and not to
> set them empty. E.g:
>
> <msg_forwarded_header "Forwarded message from <a></a>, <span></span>">
>
>
> <div class="im_message_fwd_header" ng-if="historyMessage._ ==
> > 'messageForwarded'" data-l20n="msg_forwarded_header">
> > <a class="im_message_fwd_author"
> > ng-click="openUser(historyMessage.fwd_from_id)"
> > ng-bind-html="historyMessage.fwdUser.rFirstName"></a>
> > <span class="im_message_fwd_date" ng-bind="historyMessage.fwd_date |
> > dateOrTime"></span>
> > </div>
>
>
> Result always looks like "Forwarded message from , ", because l20n sets <a>
> and <span> empty (as is stated in localization file). So I need something
> like new attribute in my html, which will tell l20n not to replace its
> contents, and also not to look inside:
>
> <div class="im_message_fwd_header" ng-if="historyMessage._ ==
> > 'messageForwarded'" data-l20n="msg_forwarded_header">
> > <a class="im_message_fwd_author"
> > ng-click="openUser(historyMessage.fwd_from_id)"
> > ng-bind-html="historyMessage.fwdUser.rFirstName"
> > data-l20n-options="skip"></a>
> > <span class="im_message_fwd_date" ng-bind="historyMessage.fwd_date |
> > dateOrTime" data-l20n-options="skip"></span>
> > </div>
That's an interesting problem. I think that originally we planned not to allow
developers to create nodes that cannot be replaced by the localizer.
But your use case makes sense.
Stas, do you have any opinion on what we should do here?
Greetings,
zb.
_______________________________________________
tools-l10n mailing list
[email protected]
https://lists.mozilla.org/listinfo/tools-l10n