Locale support with dwr

View: New views
5 Messages — Rating Filter:   Alert me  

Locale support with dwr

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm interested in hearing people's thoughts on localization

Do you localize dates, messages and numbers clientside? If so, what javascript libraries do you use?
If you localize serverside, do you send through a label and a value so that sorting (eg dates) works in all locales?
If you localize messages client side, how do you handle caching of the message resource bundle? Do you share across pages somehow?


Cheers,
Lance.

Re: Locale support with dwr

by Frank W. Zammetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A while back I wrote a localization mechanism for DWR that in essence
exposed message bundles to your Javascript code (*without* calling the
server each time you looked up a key)... that code has since evolved into
an extremely robust database-driven mechanism that we use internally at
work now... you could probably find the original code in a Google Cache
somewhere, I believe I posted it at one point... that would give you
something to start from.

I haven't yet seen a client-side library that handles this sort of thing
well enough to be useful... Dojo has some stuff in that area, aside from
the internationalization of Dijits I mean, but I don't think it quite
fills the need, which to me means sharing bundles between client and
server seemlessly, hence the reason I wrote that code myself and tied it
to DWR (sort of... it *could* be modified to not need DWR, but it's much
more elegant on top of DWR).

It was just for hardcoded messages though, didn't say anything about
numbers or dates (we do whatever localization is required server-side in
the objects DWR remotes).  Interesting point about labels and values... we
currently only do a minimal amount of internationalization in our apps
(but gearing up for a lot more because our industry is exploding that
way), so it hasn't come up yet.  I'll have to keep that in mind though,
thanks!  And on the subject of caching, yes, our current code is extremely
robust WRT that sort of stuff... it's probably *more* robust than it'll
ever need to be actually :)

Frank

--
Frank W. Zammetti
Author of "Practical DWR 2 Projects"
  and "Practical JavaScript, DOM Scripting and Ajax Projects"
  and "Practical Ajax Projects With Java Technology"
  for info: apress.com/book/search?searchterm=zammetti&act=search
Java Web Parts - javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!
My "look ma, I have a blog too!" blog: zammetti.com/blog

On Tue, July 8, 2008 1:04 pm, Lance Java wrote:

> I'm interested in hearing people's thoughts on localization
>
> Do you localize dates, messages and numbers clientside? If so, what
> javascript libraries do you use?
> If you localize serverside, do you send through a label and a value so
> that
> sorting (eg dates) works in all locales?
> If you localize messages client side, how do you handle caching of the
> message resource bundle? Do you share across pages somehow?
>
>
> Cheers,
> Lance.
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Locale support with dwr

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

For dates you can use longs. For static strings jawr seems to have a powerful and intuitive solution that I pretend to use as soon as I can (for the time being I use an interceptor that translates and ciphers objects on the server)

On Tue, Jul 8, 2008 at 7:04 PM, Lance Java <lance.java@...> wrote:
I'm interested in hearing people's thoughts on localization

Do you localize dates, messages and numbers clientside? If so, what javascript libraries do you use?
If you localize serverside, do you send through a label and a value so that sorting (eg dates) works in all locales?
If you localize messages client side, how do you handle caching of the message resource bundle? Do you share across pages somehow?


Cheers,
Lance.


Re: Locale support with dwr

by Lance Java :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think I've found an elegent(ish) solution.
Put a @Localized annotatation on properties that need to be localized and have a LocalizedBeanConverter to do some magic during serialization.

Cheers,
Lance.

2008/7/9 Jose Noheda <jose.noheda@...>:
For dates you can use longs. For static strings jawr seems to have a powerful and intuitive solution that I pretend to use as soon as I can (for the time being I use an interceptor that translates and ciphers objects on the server)


On Tue, Jul 8, 2008 at 7:04 PM, Lance Java <lance.java@...> wrote:
I'm interested in hearing people's thoughts on localization

Do you localize dates, messages and numbers clientside? If so, what javascript libraries do you use?
If you localize serverside, do you send through a label and a value so that sorting (eg dates) works in all locales?
If you localize messages client side, how do you handle caching of the message resource bundle? Do you share across pages somehow?


Cheers,
Lance.



Re: Locale support with dwr

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yep, that's pretty much what I do but I use AOP instead of a converter

On Wed, Jul 9, 2008 at 10:54 AM, Lance Java <lance.java@...> wrote:
I think I've found an elegent(ish) solution.
Put a @Localized annotatation on properties that need to be localized and have a LocalizedBeanConverter to do some magic during serialization.

Cheers,
Lance.

2008/7/9 Jose Noheda <jose.noheda@...>:

For dates you can use longs. For static strings jawr seems to have a powerful and intuitive solution that I pretend to use as soon as I can (for the time being I use an interceptor that translates and ciphers objects on the server)


On Tue, Jul 8, 2008 at 7:04 PM, Lance Java <lance.java@...> wrote:
I'm interested in hearing people's thoughts on localization

Do you localize dates, messages and numbers clientside? If so, what javascript libraries do you use?
If you localize serverside, do you send through a label and a value so that sorting (eg dates) works in all locales?
If you localize messages client side, how do you handle caching of the message resource bundle? Do you share across pages somehow?


Cheers,
Lance.



LightInTheBox - Buy quality products at wholesale price