> How do other template languages handle this? I don't have much
> experience in this area.
Well, what I currently have going is: {[Hello]} to translate Hello
using meta of {}. That would be the same as {.translate}Hello{.end}
The option where the ordering may change is generally handled by
sprintf(text,var1,var2) type thing, and like your option 1, a lot of
people use sprintf(gettranslation("Hello %s"),name).
{.if num singluar}
{[There is one book]}
{.or}
{.translate}There are {num} books{.end}
{.end}
The user would be required to provide a formatter by the special name
of 'translate'. The json-template would pass the text in the singular
area as the data param, the language (the value of which would be from
the options), and a blank param. In the second case, the block
execution would call the formatter with params as well. Either way
translate gets called with a data object that has
{text:...,language:...,params[]} as its json node.
This could be done with everything there now if you made special make-
translate-node and translate formatters.
{.if num singluar}
{@|make-translate-node "There is one book"|translate}
{.or}
{@|make-translate-node "There are %s books" : num|translate}}
{.end}
Though you would miss out on formatters for the num like here:
{.if num zero}
{[You have no money]}
{.or}
{.translate}You have {num|currency} to your name{.end}
{.end}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---