Regards,
Witold Szczerba
> --
> You received this message because you are subscribed to the Google Groups "AngularJS" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to angular+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/angular?hl=en.
>
>
Regards,
Witold Szczerba
<i:msg msgid="example">There are {{cats.length}} cats</i:msg>
and then have a table of locales and strings.
example: {
//...
es: 'hay $1 gatos',
//...
}
When angular compiles the contents of the i:msg it's going to transform {{cats.length}} into <span ng:bind="cats.length"></span>, so recursively compile the element, remove all the bare text nodes, and then swap in the components of the translations between the spans matching the positions of the $x place holders, possibly reordering the spans to match the order of the $x placeholders in the translation.
Aliases would also probably help your translators.
<i:msg msgid="example" desc="Number of cats in the page.">There are <i:p desc="count">{{cats.length}}</i:p> cats</i:msg>
//...
es: 'hay $count gatos',
//...
Using a widget also has the advantage that it becomes easy for a server side process, or even a build rule, to create translated templates.
I'd discourage passing only the message id and params and not having the original text in the templates. This makes working with the UI much harder and is a pain for designers. All modern translation libraries keep the original string in there.
I am wondering if all this is a good approach though. See what Igor
said yesterday about this in another thread: "Non trivial
localizations".
Regards,
Witold Szczerba