Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Switch Language User-specific
Switch Language User-specific [message #1552825] Thu, 08 January 2015 10:44 Go to next message
Nin Pa is currently offline Nin PaFriend
Messages: 33
Registered: September 2013
Member
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 11:09 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2334
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 11:26 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 33
Registered: September 2013
Member
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 12:05 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2334
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 13:12 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 33
Registered: September 2013
Member
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 13:15]

Report message to a moderator

Re: Switch Language User-specific [message #1553100 is a reply to message #1553036] Thu, 08 January 2015 13:52 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 33
Registered: September 2013
Member
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 13:59 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2334
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 14:13 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 33
Registered: September 2013
Member
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 08:44 Go to previous message
Nin Pa is currently offline Nin PaFriend
Messages: 33
Registered: September 2013
Member
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 08:51]

Report message to a moderator

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


Current Time: Sat Feb 29 09:33:11 GMT 2020

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

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

Back to the top