Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Using the client locale in a server service
Using the client locale in a server service [message #1236833] Tue, 28 January 2014 07:14 Go to next message
Urs Beeli is currently offline Urs Beeli
Messages: 330
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Some of our databases contain NLS data (i.e. a column for each language) and we want to return the correct text in our LookupServices for those tables.

Is there a mechanism provided by scout to find the locale of the client currently using a server service?

If not, what is the recommended way to pass this information from client to server? I'd prefer a solution that passes this information from client to server once at client startup over a solution that forces me to pass this information on each call to the service.
Re: Using the client locale in a server service [message #1236847 is a reply to message #1236833] Tue, 28 January 2014 07:59 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 702
Registered: October 2011
Senior Member
From what I know/remember, scout does it for you. I think it works with Locale of the thread.

If you use TEXTS.getText(...) in the server scout will set the appropriate language (depending on the locale of the client). [you can confirm this very easily].
If you need to do it by yourself, I imagine you can have a look at how the Text service is solving it.
Re: Using the client locale in a server service [message #1236910 is a reply to message #1236847] Tue, 28 January 2014 11:13 Go to previous message
Urs Beeli is currently offline Urs Beeli
Messages: 330
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks for your answer, Jérémie.

I've had the same idea and traced the TEXTS.get(key) call as far as DynamicNls.getTextInternal() where there is the following line:

if (locale==null) {
locale = getDefaultLocale();
}

which in turn calls NlsUtility.getDefaultLocale();

So in my code I use
Locale locale = NlsUtility.getDefaultLocale();
and then switch on the language.

It's quite embarrassing, but it was a simple bug (comparing a locale against a string) which caused my code to always use the default case Wink Now that I'm comparing the correct fields everything works fine!

Previous Topic:SWT not recognizing changes in focused FormField
Next Topic:No login dialog with BasicSecurityFilter
Goto Forum:
  


Current Time: Sun Sep 21 02:13:16 GMT 2014

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

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