users@jersey.java.net

Re: [Jersey] I18N for Jersey's MVC/templating support.

From: Casper Bang <casper_at_jbr.dk>
Date: Thu, 2 Apr 2009 22:39:26 +0200

Thanks guys, the filter idea is not bad except it's a real mess pulling
{language} out from the UriInfo. Realizing I'm already sitting on this
fantastic JSON delivery engine though, I'm using simple markup:

<h1 class="i18n" id="apptitle"></h1>

...along with a jquery script that downloads a "dynamic" JavaScript, which
is a key:value map, used to index into with the id (apptitle in the above).
It has the potential of allowing dynamic language change without a page
refresh, as well as allowing translators to update resources on-the-fly and
without a re-deploy.

It seems to work, though still needs some polishing (bridge to ResorceBundle
etc.). But I have to say, it's a little fun to witness how my, at first,
static REST application is turning out to be delivering a so much more
dynamic experience than any other web application I've ever worked on.

/Casper



On Thu, Apr 2, 2009 at 9:43 AM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:

> Hi Casper,
>
> You might want to send an email to users_at_glassfish.dev.java.net.
>
> I am not knowledgeable enough in this area and would certainly like to know
> if there is a solution. A filter solution as Chris suggests might work e.g.
> it could change the request header value.
>
> Paul.
>
> On Apr 2, 2009, at 12:41 AM, Casper Bang wrote:
>
> I'm happily using the MVC and JSP templating mechanism of Jersey, however
>> I have a problem as to i18n when this is part of an addressable resource
>> i.e. /lang/{language}/. Using the formatting library that's part of JSTL
>> isn't an option, as it relies solely on the language specified in he request
>> header. I tried a few things thus far but can't find a reliable and scalable
>> solution. Only thing i can think of now is to write my own tag handler for
>> some custom tag, but before looking into that I just wanted to hear if the
>> community has any input. Any ideas much appreciated. :)
>>
>> /Casper
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>