Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Switch Language User-specific
Switch Language User-specific [message #1552825] Thu, 08 January 2015 05:44 Go to next message
Eclipse UserFriend
Hi all!

I translated my RAP Application in different languages. My problem is switching the language user-specific.

When i try
Locale.setDefault(Locale.ENGLISH);
Messages.reloadMessages();

The language switches for all users.

I also tried
RWT.getUISession().setLocale(Locale.ENGLISH);
but this had no effect.

Please can anyone give me a hint?
Re: Switch Language User-specific [message #1552859 is a reply to message #1552825] Thu, 08 January 2015 06:09 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
using RWT.getUISession().setLocale(Locale.ENGLISH) or
RWT.setLocale(Locale.ENGLISH) is correct. See our demo at [1] and it's
source [2].

[1] http://rap.eclipsesource.com/demo/release/rapdemo/#nls
[2]
http://git.eclipse.org/c/rap/org.eclipse.rap.git/tree/examples/org.eclipse.rap.examples.pages/src/org/eclipse/rap/examples/pages/InternationalizationExamplePage.java
HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Switch Language User-specific [message #1552885 is a reply to message #1552859] Thu, 08 January 2015 06:26 Go to previous messageGo to next message
Eclipse UserFriend
Ivan Furnadjiev wrote on Thu, 08 January 2015 06:09
Hi,
using RWT.getUISession().setLocale(Locale.ENGLISH) or
RWT.setLocale(Locale.ENGLISH) is correct. See our demo at [1] and it's
source [2].


Thanks for quick reply, but unfortunately this has no effect in my application. Sad
Any other ideas?
Re: Switch Language User-specific [message #1552944 is a reply to message #1552885] Thu, 08 January 2015 07:05 Go to previous messageGo to next message
Eclipse UserFriend
HI,
what is your default system locale? Do you have messages_en.properties file?
Regards,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Switch Language User-specific [message #1553036 is a reply to message #1552944] Thu, 08 January 2015 08:12 Go to previous messageGo to next message
Eclipse UserFriend
Yes, I have the messages_de.properties and the messages.properties as default in English.

I checked out this site:
http://eclipse.org/rap/developers-guide/devguide.php?topic=internationalization.html&version=2.0

Now it's the issue that changing language is possible, but when another user changes language, sometimes (!) the language for the other user changes, too.
CRAZY!

My default system language is german.

Another question:
Is it necessary using reset NLS Suffixes like
Field nlSuffixesField = NLS.class.getDeclaredField("nlSuffixes"); //$NON-NLS-1$
nlSuffixesField.setAccessible(true);
nlSuffixesField.set(NLS.class, null);

And reloading Messages with
NLS.initializeMessages(BUNDLE_NAME, Messages.class);

???

[Updated on: Thu, 08 January 2015 08:15] by Moderator

Re: Switch Language User-specific [message #1553100 is a reply to message #1553036] Thu, 08 January 2015 08:52 Go to previous messageGo to next message
Eclipse UserFriend
In fact the RWT.setLocale()-Methode has no effect in my Application.

If i test

ClientInfo clientInfo = RWT.getClient().getService(ClientInfo.class );
System.out.println(clientInfo.getLocale());
RWT.setLocale(Locale.ENGLISH);
clientInfo = RWT.getClient().getService( ClientInfo.class );
System.out.println(clientInfo.getLocale());

Output:
de_DE
de_DE

nothing has changed in the configuration.
Re: Switch Language User-specific [message #1553108 is a reply to message #1553100] Thu, 08 January 2015 08:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
ClientInfo service always returns the locale set in the browser. If you
change the RWT locale programmatically, use RWT.getLocale() to obtain it
back. If locale is not changed programmatically, RWT.getLocale will
return the client browser locale (from ClientInfo service).
HTH,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Switch Language User-specific [message #1553129 is a reply to message #1553108] Thu, 08 January 2015 09:13 Go to previous messageGo to next message
Eclipse UserFriend
Think i got an approach.
The locale of the current uisession reverts its state to german.

Do you have an idea why and when this happens?
I switch the perspective after switching the language.
Re: Switch Language User-specific [message #1601985 is a reply to message #1552825] Thu, 05 February 2015 03:44 Go to previous message
Eclipse UserFriend
Maybe anyone has the same problem, so here the solution:

I thought Locale.ENGLISH would trigger using the messages.properties.
But the right way was Locale.US. And there has to be a messages_en.properties.
So now the right language files are used.

[Updated on: Thu, 05 February 2015 03:51] by Moderator

Previous Topic:Problem with custom Settingstore
Next Topic:Plugins always on top
Goto Forum:
  


Current Time: Sun Jul 13 13:48:31 EDT 2025

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

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

Back to the top