Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » How to get locale setting for client from scout session?
How to get locale setting for client from scout session? [message #1604173] Fri, 06 February 2015 12:40 Go to next message
Eclipse UserFriend
I have noticed that scout session will have a valid locale setting, however if I use any code that depends on default locale I will get the locale set on server. This holds for RAP server and Scout server components.

The thing is though that I know RAP client (in browser) for example has the correct locale set up so there should be a simple way to fetch and use that, right? I probably just missed something in manual but maybe someone can save me some time. Thanks.
Re: How to get locale setting for client from scout session? [message #1712653 is a reply to message #1604173] Tue, 27 October 2015 04:42 Go to previous messageGo to next message
Eclipse UserFriend
Figured it out - on the client to get client's locale: LocaleThreadLocal.get()

Is there a similar utility function on the server-side (to get client's locale)?

Re: How to get locale setting for client from scout session? [message #1712790 is a reply to message #1712653] Wed, 28 October 2015 05:32 Go to previous messageGo to next message
Eclipse UserFriend
NlsUtility.getDefaultLocale() should work both on server and client side. Its javadoc states:

Quote:
Only use this Locale resolver if the calling code is executed in both, server- and client side. On client side, use Locale.getDefault() whereas on server side use LocaleThreadLocal.get().
Re: How to get locale setting for client from scout session? [message #1712809 is a reply to message #1712790] Wed, 28 October 2015 07:41 Go to previous message
Eclipse UserFriend
I guess they mean "serverside" also on RAP server since Locale.getDefault() return's the JVM's locale.

This works LocaleThreadLocal.get() for RAP server and Scout server (I've just checked) so it seems to be what I need. I guess "client" here refers to rich client only and it makes sense from the technical standpoint. Thanks for the info about the other utility method!
Previous Topic:Properties in PageData (similar to FormData)
Next Topic:[Neon] Tell browser to open downloaded file in new browser window
Goto Forum:
  


Current Time: Wed Jul 16 17:21:55 EDT 2025

Powered by FUDForum. Page generated in 0.24524 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top