You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Filippov, Andrey" <an...@t-systems.ru> on 2008/04/01 15:40:38 UTC

Struts2 and JavaScript localization

Hello everybody,

 

 

I have a javascript dropdown calendar on one of my struts2 jsp. I have
bi-lingual application. So I need to read bundle files to switch
language. Please, does someone know how to use these files in
javascript.

 

Here is my js snippet:

 

<script language="JavaScript" type="text/JavaScript">

window.onload = function(){bscal.init()}

var bscal = {

    left : 0,

    top  : 0,

    width: 0,

    height: 0,

    format: "%d.%m.%Y",

 

    wds  : new
Array("%{getText('bscal_day1')}","tue","wen","thu","fri","sat","sun"),

...

 

The way like this "%{getText('bscal_day1')} (like on jsp) does not work.

 

I appreciate your help.

 

Best regards, Filippov Andrey


Re: Struts2 and JavaScript localization

Posted by Chris Pratt <th...@gmail.com>.
You'd have to put that expression in a tag that can process it.  Try
something like:

  wds  : new Array('<s:property
value="%{getText('bscal_day1')}"/>',"tue","wen","thu","fri","sat","sun"),

  (*Chris*)


On Tue, Apr 1, 2008 at 6:40 AM, Filippov, Andrey
<an...@t-systems.ru> wrote:
> Hello everybody,
>
>
>
>
>
>  I have a javascript dropdown calendar on one of my struts2 jsp. I have
>  bi-lingual application. So I need to read bundle files to switch
>  language. Please, does someone know how to use these files in
>  javascript.
>
>
>
>  Here is my js snippet:
>
>
>
>  <script language="JavaScript" type="text/JavaScript">
>
>  window.onload = function(){bscal.init()}
>
>  var bscal = {
>
>     left : 0,
>
>     top  : 0,
>
>     width: 0,
>
>     height: 0,
>
>     format: "%d.%m.%Y",
>
>
>
>     wds  : new
>  Array("%{getText('bscal_day1')}","tue","wen","thu","fri","sat","sun"),
>
>  ...
>
>
>
>  The way like this "%{getText('bscal_day1')} (like on jsp) does not work.
>
>
>
>  I appreciate your help.
>
>
>
>  Best regards, Filippov Andrey
>
>

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