You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matthieu MARC <ma...@angers.ensam.fr> on 2008/06/05 10:56:43 UTC
Internationalization and EL
Hi everybody,
I'm trying to play with internationalization but I have a small problem.
Here is my code :
<s:iterator value="week.semaine">
<s:label labelposition="top" value="%{displayName}" />
<s:select name="week.semaine[%{index}].am" onchange="countHour();" id="am%{index}" key="timetable.morning" list="heures" value="%{am}" />
<s:select name="week.semaine[%{index}].pm" onchange="countHour();" id="pm%{index}" key="timetable.afternoon" list="heures" value="%{pm}" />
</s:iterator>
My problem is in the label. %{displayName} return monday, tuesday,
wednesday.... and I want to translate the label value.
I tried :
key="%{displayName}"
key="timetable.%{displayName}"
I wrote a package.properties file :
timetable.monday=lundi
monday=lundi
But nothing is working.
Is someone have an idea to help me ?
thank in advance.
Matthieu MARC
--
Matthieu MARC
matthieu.marc@angers.ensam.fr
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Internationalization and EL
Posted by Ralf Fischer <th...@googlemail.com>.
Hi,
when you have the translations in a resource bundle, as you have now
with your package.properties, you cannot simply get the translations
from the stack, but have to invoke the getText method from you
TextProvider.
The TextProvider interface usually is implemented by your action as
soon as you extend ActionSupport. If it doesn't yet, you'll have to
change this, or place a text provider on the stack yourself.
Then just use an expression like %{getText(displayName)}.
Bye,
-Ralf
On Thu, Jun 5, 2008 at 10:56 AM, Matthieu MARC
<ma...@angers.ensam.fr> wrote:
> Hi everybody,
>
> I'm trying to play with internationalization but I have a small problem.
> Here is my code :
>
> <s:iterator value="week.semaine">
>
> <s:label labelposition="top" value="%{displayName}" />
>
> <s:select name="week.semaine[%{index}].am" onchange="countHour();"
> id="am%{index}" key="timetable.morning" list="heures" value="%{am}" />
>
> <s:select name="week.semaine[%{index}].pm" onchange="countHour();"
> id="pm%{index}" key="timetable.afternoon" list="heures" value="%{pm}" />
>
> </s:iterator>
>
>
> My problem is in the label. %{displayName} return monday, tuesday,
> wednesday.... and I want to translate the label value.
>
> I tried :
>
>
> key="%{displayName}"
>
> key="timetable.%{displayName}"
>
>
> I wrote a package.properties file :
>
> timetable.monday=lundi
>
> monday=lundi
>
>
> But nothing is working.
>
> Is someone have an idea to help me ?
>
> thank in advance.
>
> Matthieu MARC
>
> --
> Matthieu MARC
> matthieu.marc@angers.ensam.fr
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org