You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Erik Hatcher (JIRA)" <ji...@apache.org> on 2010/08/10 15:33:16 UTC
[jira] Issue Comment Edited: (SOLR-2035) Add Velocity's
ResourceTool to allow for i18n string lookups
[ https://issues.apache.org/jira/browse/SOLR-2035?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896878#action_12896878 ]
Erik Hatcher edited comment on SOLR-2035 at 8/10/10 9:31 AM:
-------------------------------------------------------------
This patch adds a custom ResourceTool subclass to the Velocity context. A custom subclass is needed in order to wire in SolrResourceLoader's ClassLoader facility.
After applying this patch, a *path* needs to be added to SolrResourceLoader via solrconfig.xml, like this:
{code}
<lib path="./conf/velocity"/>
{code}
Then in conf/velocity, add a resources_en_US.properties file (or whatever your system default locale is) in the conf/velocity directory, something like this:
{code}
title=English Title
{code}
Then in a Velocity template, use:
{code}
$resource.title
{code}
See http://velocity.apache.org/tools/releases/2.0/javadoc/org/apache/velocity/tools/generic/ResourceTool.html for more details on how to use Velocity's ResourceTool.
*NOTE* This patch currently only works with the _default system locale_. There's surely some way to allow configurability of the Locale, though nothing totally trivial jumped out at me on how to do it.
was (Author: ehatcher):
This patch adds a custom ResourceTool subclass to the Velocity context. A custom subclass is needed in order to wire in SolrResourceLoader's ClassLoader facility.
After applying this patch, a *path* needs to be added to SolrResourceLoader via solrconfig.xml, like this:
{code}
<lib path="./conf/velocity"/>
{code}
Then in conf/velocity, add a resources_en_US.properties file (or whatever your system default locale is), something like this:
{code}
title=English Title
{code}
Then in a Velocity template, use:
{code}
$resource.title
{code}
See http://velocity.apache.org/tools/releases/2.0/javadoc/org/apache/velocity/tools/generic/ResourceTool.html for more details on how to use Velocity's ResourceTool.
*NOTE* This patch currently only works with the _default system locale_. There's surely some way to allow configurability of the Locale, though nothing totally trivial jumped out at me on how to do it.
> Add Velocity's ResourceTool to allow for i18n string lookups
> ------------------------------------------------------------
>
> Key: SOLR-2035
> URL: https://issues.apache.org/jira/browse/SOLR-2035
> Project: Solr
> Issue Type: Improvement
> Components: Response Writers
> Reporter: Erik Hatcher
> Assignee: Erik Hatcher
> Priority: Minor
> Attachments: SOLR-2035.patch
>
>
> Being able to look up string resources through Java's ResourceBundle facility can be really useful in Velocity templates (through VelocityResponseWriter). Velocity Tools includes a ResourceTool.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org