manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Wright (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONNECTORS-420) Velocity support should include a model where there is one template for all languages, and tags that you can use for i18n strings
Date Thu, 01 Mar 2012 11:47:59 GMT

    [ https://issues.apache.org/jira/browse/CONNECTORS-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219970#comment-13219970
] 

Karl Wright commented on CONNECTORS-420:
----------------------------------------

I believe this is part of a broader class of problem in that we really want our Velocity templates
to be able to work with objects, not just strings.  This may include portions of the Configuration
and Specification structures.  In other words, I think we need to generalize our use of Velocity
so that we can properly place important objects in the Velocity context.  This will potentially
include not only structures that are parts of Configuration and Specification, but also ResourceBundles
that allow internationalization.

The issue then becomes how to handle the context-sensitive rendering of resources, etc.  It
is possible to call static class methods from within Velocity as described here:

http://velocity.apache.org/engine/devel/developer-guide.html

Specifically:

{code}
context.put("Math", Math.class);
{code}

This would then allow us to present the encoder class in this way:

{code}
context.put("Encoder", org.apache.manifoldcf.ui.util.Encoder.class);
{code}

... and the template would look something like:

{code}
<input type="hidden" name="foo" value="$Encoder.attributeEscape($foovalue)"/>
{code}

... instead of:

{code}
<input type="hidden" name="foo" value="$foovalue_A"/>
{code}


                
> Velocity support should include a model where there is one template for all languages,
and tags that you can use for i18n strings
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CONNECTORS-420
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-420
>             Project: ManifoldCF
>          Issue Type: Improvement
>          Components: Framework core
>    Affects Versions: ManifoldCF 0.5
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>             Fix For: ManifoldCF 0.5
>
>
> The current way we use Velocity templates is to have a different template for each language.
 That's very wasteful and leads to code duplication.  We need to support a way of having one
template for all languages.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message