Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Bundle Localization
Bundle Localization [message #1063173] Wed, 12 June 2013 14:17 Go to next message
Sascha Gennrich is currently offline Sascha GennrichFriend
Messages: 4
Registered: June 2013
Junior Member
Hi,

I followed the instructions on the RAP internationalization help site to translate my RAP application.

I also created the simple HelloWorld application to verify it's not working as I expected.
There are two properties file in the package 'helloWorld' where also the Messages class resides.
messages.properties and messages_de.properties.
I exptected a client with locale 'de_DE' would be served the messages_de file.
But since it doesn't find a messages_de_DE file it just drops to the default file.

The help site states that it would choose it in the hierachical order I expected.
Is there something I missed?

Sascha
Re: Bundle Localization [message #1063450 is a reply to message #1063173] Thu, 13 June 2013 08:26 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1295
Registered: July 2009
Senior Member

I can't reproduce this with our controls demo and RAP 2.1. I configured
my browser to send this HTTP header:

Accept-Language: de-de,en-us;q=0.7,en;q=0.3

The translation from the NLSTabMessages_de.properties file is chosen as
expected.

Which RAP version do you use?

BTW, I've recently updated the i18n help article [1].

Regards,
Ralf

[1]
http://eclipse.org/rap/developers-guide/devguide.php?topic=internationalization.html&version=2.1

--
Ralf Sternberg

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Bundle Localization [message #1063456 is a reply to message #1063450] Thu, 13 June 2013 08:38 Go to previous messageGo to next message
Sascha Gennrich is currently offline Sascha GennrichFriend
Messages: 4
Registered: June 2013
Junior Member
Sorry for not mentioning it. We still use RAP 1.5
Re: Bundle Localization [message #1063566 is a reply to message #1063456] Thu, 13 June 2013 12:23 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1295
Registered: July 2009
Senior Member

That should be no different with RAP 1.5. Selecting the properties file
is done by the class PropertyResourceBundle [1], not by RAP. What does
RWT.getLocale() give you?

Regards,
Ralf

[1]
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/PropertyResourceBundle.html

--
Ralf Sternberg

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Bundle Localization [message #1064231 is a reply to message #1063566] Tue, 18 June 2013 10:42 Go to previous messageGo to next message
Sascha Gennrich is currently offline Sascha GennrichFriend
Messages: 4
Registered: June 2013
Junior Member
RWT.getLocale() always returns the first entry of the Accept-Language header.

ResourceBundle shows the same behaviour. It always defaults to the current system locale. Since mine is german it choses the de_DE file.
I can circumvent it by passing a "-nl en" parameter to my rap application.

Regards,
Sascha
Re: Bundle Localization [message #1064242 is a reply to message #1064231] Tue, 18 June 2013 11:38 Go to previous message
Sascha Gennrich is currently offline Sascha GennrichFriend
Messages: 4
Registered: June 2013
Junior Member
The ResourceBundle returns the strings in the correct hierarchical order.
The locale 'en_US' is served by the 'messages_en' file.

I would like to use the solution i found at stackoverflow [1] to use an empty 'en' file which then uses the default language file when it does not find the key.
This works for my ResourceBundle test but in RAP i get a java.util.MissingResourceException when the messages_en.properties file doesn't contain the appropriate key.

[1] stackoverflow.com/questions/6739892/problem-with-resourcebundle-in-servlet
Previous Topic:TabFolder button bar background colour/transparent
Next Topic:Can RAP be used to convert/transform web application to desktop application?
Goto Forum:
  


Current Time: Fri Nov 28 16:16:12 GMT 2014

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

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