Thiago / Jonathan / Fernando,
   thanks for everyone's input !

Indeed, the asset localization of js does work out OK. Refactoring the code
would certainly get the job done.  I've also used the ${message:foo}
expansions in js that's included in a page, that works OK too.

I guess the issue is that I was trying to package up a component that has
some error messages in a js file. Ideally, all messages would be in message
bundles, and adding a translation would only involve  dealing with bundles
(as that provides the least opportunities for mistakes). I just wanted to
make sure that I'm not missing something obvious in how to handle the issue.


Cheers,

Alex Kotchnev

On Wed, Feb 11, 2009 at 12:52 PM, Fernando Padilla <f...@alum.mit.edu>wrote:

> Not the best option but:
>
> Don't forget that included js files are determined using Tapestry's
> Internationalication/Localization code..
>
> http://tapestry.apache.org/tapestry5/guide/localization.html
>
> so:
>
> include( my.js )
>
> would look up the right js file using the locale of the user:
>
> my_en.js
> my_fr.js
>
>
>
> So you could refactor your js file into two.. one for locale specific
> variables and messages, and another just for code.. Then tapestry will
> choose the correct messages js file using the user's locale...
>
> include( mymessages.js, mycode.js )
>
> mymessages_en.js
> mymessages_fr.js
> mycode.js
>
>
>
> This won't help if you just wanted to leverage the Message bundles that the
> app is already using..  To do that, we would have to cook up some code and
> stuff to transform the js files as they are served up (no support for that
> at the moment ).
>
>
>
>
> Thiago H. de Paula Figueiredo wrote:
>
>> On Wed, Feb 11, 2009 at 7:08 AM, Jonathan O'Connor <ninki...@eircom.net>
>> wrote:
>>
>>> Alex, according to Thiago, you can have string substitution in the
>>> javascript:
>>>
>>
>> Yes, if the Javascript is generated inside the page, not in an external
>> file. ;)
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to