> > At this point, it is simplified my having 'translate' be an included
> > type formatter. If it could grab a language option from the context,
> > it could use that to include greeting_en or greeting_es, for example.
> > So in the complex case of in-place substitutions, we just use other
> > json-template files. In my experience, these type of cases represent
> > only 5% of all translations, so it seems a reasonable course.
>
> OK good, but it is nice to keep multiple strings in a single file,
> rather than having a file per fragment.
That goes back to the idea of blocks -- named sections or whatever you
want to call it. Something I'd like to see as it is nice to have one
template have a placeholder when it does not yet know what to include
there. Such is the concept of master pages, et al.
> {.block greeting} # This identifies a template fragment
> Hello {name}
> {.end}
Which I see you thought about too. ;)
> {.block|translate} # This defers expansion of {name} until after the
> 'translate' formatter is applied
> Hello {name}
> {.end}
This is used in other template languages too to deal with translation.
> {.block foo}
> {.block bar}
> nested
> {.end}
> {.end}
>
> ?
I'll have to think about that. I'd guess that the inside block would
be available to be used for a placeholder inside the same block:
{.block foo}
{.placeholder bar}{.end}
other stuff
{.block bar}
nested
{.end}
{.end}
> > So what I think would be best would be {[Hello]} for translation of
> > simple strings.
>
> > Here are the changes I propose:
>
> > 1. Formatters get a way to look at options (through the context
> > object?) so that they can know the language.
>
> Formatters can already look at the context object (in the spec and in
> Python, needs to be ported to all languages).
Yes, but how and where do we store the language? Originally I though
that it should be in the options, when the template is compiled. But
I've added server side caching of the compiled template, so now I'd
rather have it be a runtime setting. I guess it can just go in the
json data...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---