You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Carr <ja...@gmail.com> on 2008/12/18 23:16:01 UTC

[S2] Use i18n with parameters in velocity templates?

Hi All,

We're currently using struts 2 and using velocity in order to include
some existing templates from another project. Everything has been
working great... until we try to use i18n with parameters. I've read
all the pages on the struts 2 site, there's no clear example of what
we're supposed to do to just pass a parameter in for a translatable
component in velocity. In jsp we just use:

<s:text key="foo.prop">
 <s:param name="value">bar</s:param>
</s:text>

with a property file like:
foo.prop=Hi my name is {0}

I posted this before, but am reposting in hopes of making my question
clearer. Is the velocity result type just outright broken? And if it
is, could it be fixed please? I searched the source for the velocity
macro for #stext, but no luck... i only found text.vm which is just a
velocity macro for inputs of type text.

Please give me a hint... I'd rather use the framework rather than
resort to some custom solution to an everyday task. :(

Thanks,
James

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Use i18n with parameters in velocity templates?

Posted by James Carr <ja...@gmail.com>.
Could you guys just tell me where the #stext velocity macro is defined? PLEASE!?

On Thu, Dec 18, 2008 at 4:16 PM, James Carr <ja...@gmail.com> wrote:
> Hi All,
>
> We're currently using struts 2 and using velocity in order to include
> some existing templates from another project. Everything has been
> working great... until we try to use i18n with parameters. I've read
> all the pages on the struts 2 site, there's no clear example of what
> we're supposed to do to just pass a parameter in for a translatable
> component in velocity. In jsp we just use:
>
> <s:text key="foo.prop">
>  <s:param name="value">bar</s:param>
> </s:text>
>
> with a property file like:
> foo.prop=Hi my name is {0}
>
> I posted this before, but am reposting in hopes of making my question
> clearer. Is the velocity result type just outright broken? And if it
> is, could it be fixed please? I searched the source for the velocity
> macro for #stext, but no luck... i only found text.vm which is just a
> velocity macro for inputs of type text.
>
> Please give me a hint... I'd rather use the framework rather than
> resort to some custom solution to an everyday task. :(
>
> Thanks,
> James
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org