users@jersey.java.net

Re: [Jersey] Re: API Internationalization

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 13 Apr 2010 11:26:29 +0200

On Apr 13, 2010, at 9:11 AM, Alesque wrote:

>
> Because, some of our target audience is French, and to make easy the
> adoption
> we want the API in French too.
>
> In the end there will be 2 versions of the API :
>
> http://acme.com/api/en/owner/1
>
> <owner lastModified="2010-01-31T00:00:00+01:00" id="1">
> <displayName>XXXX XXXX</displayName>
> </owner>
>
>
> http://acme.com/api/fr/proprietaire/1
>
> <proprietaire derniereModification="2010-01-31T00:00:00+01:00" id="1">
> <nomComplet>XXXX XXXX</nomComplet>
> </proprietaire>
>

I agree with Tatu this is unusual. First time i have seen this
requirement. IMHO i would recommend against such an approach to
internationalizing XML element/attribute names. I have not seen any
standardized XML vocabulary take this approach e.g. Atom or Universal
Business language.

Using separate JAXB objects is going to create a lot of work for you.

If you want to do this I recommend picking one language as the
canonical language from which a set of JAXB objects are derived and is
utilized on the server. Then use language specific XSLT documents to
translate the element/attribute names. It should be easy to plug in
XSLT as a response filter.

Paul.