Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Localization of JFace MessageDialog(Localization of JFace Buttons)
Localization of JFace MessageDialog [message #1580382] Fri, 23 January 2015 13:08 Go to next message
Heiko Hollenbach is currently offline Heiko HollenbachFriend
Messages: 5
Registered: December 2014
Junior Member
Hi,

I'm trying to translate the buttons of a JFace MessageDialog. In English they are shown with "OK" and "Cancel". But in German they still are shown with "OK" and "Cancel".

I created the RAP Hello World example.

Added this to
BasicEntryPoint#createContents
MessageDialog.openConfirm(button.getShell(), "Title", "Buttons should be translated");


BasicApplication
public void configure(Application application ) {
    ...
    application.setOperationMode( OperationMode.SWT_COMPATIBILITY );

}


Copied the messages.properties from the org.eclipse.rap.jface... plugin to my plugin under src.org.eclipse.jface and renamed it to messages_de.properties. And did change the strings to
ok=OK
cancel=Abbrechen


build.properties looks like
bin.includes = META-INF/,\
               OSGI-INF/,\
               .,\
               src/org/eclipse/jface/messages_de.properties


PS:
RWT.getLocale() is de_DE

The Cancel Button still has the text "Cancel". What am i missing?

[Updated on: Fri, 23 January 2015 13:23]

Report message to a moderator

Re: Localization of JFace MessageDialog [message #1580407 is a reply to message #1580382] Fri, 23 January 2015 13:28 Go to previous messageGo to next message
Markus Knauer is currently offline Markus KnauerFriend
Messages: 179
Registered: July 2009
Senior Member

First of all, the Eclipse Babel project [1] provides community-managed language packs for various languages, and I invested some time to add the necessary German translations for RAP bundles. You can download the language packs from their website [2].

Depending on your build and runtime enviroment you'll need to update your target definition and make sure that the required fragments with the translations are part of your launch configuration.

Fragments? Bundles? I think here's the error in your setup. If I understand you correctly you were copying property files into your own bundle and translated them there. Unfortunately this is not how Eclipse searches for translations. You'll need to create a fragment that has the corresponding RAP bundle as host and put the language specific property files into this fragment.

But... as I wrote above... the easiest solution is to use the already available language packs from Babel.


[1] http://eclipse.org/babel/
[2] http://eclipse.org/babel/downloads.php


Regards,
Markus



--

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Localization of JFace MessageDialog [message #1580426 is a reply to message #1580407] Fri, 23 January 2015 13:42 Go to previous messageGo to next message
Heiko Hollenbach is currently offline Heiko HollenbachFriend
Messages: 5
Registered: December 2014
Junior Member
Tanks a lot for your quick reply.

A Fragment was the key for the solution.

I created a fragment with org.eclipse.rap.jface as host and added the messages_de.properties there.

I also added this fragment in the launch configuration. And all is done.

Thanks again!

I will look at Babel the next days.
Re: Localization of JFace MessageDialog [message #1580445 is a reply to message #1580426] Fri, 23 January 2015 13:53 Go to previous messageGo to next message
Markus Knauer is currently offline Markus KnauerFriend
Messages: 179
Registered: July 2009
Senior Member

Quote:
I will look at Babel the next days.


It's really worth looking at it because nearly all RAP strings are translated into German.

Have a nice weekend,
Markus
Re: Localization of JFace MessageDialog [message #1601997 is a reply to message #1580445] Thu, 05 February 2015 08:52 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 36
Registered: September 2013
Member
In my case it is exactly the opposite. My own strings are translated correctly in english, when i switch the language.
But the MessageDialog Buttons are always shown in german (my default system language).
Anyone an idea?
Re: Localization of JFace MessageDialog [message #1602049 is a reply to message #1601997] Thu, 05 February 2015 09:35 Go to previous messageGo to next message
Aleksander   is currently offline Aleksander Friend
Messages: 44
Registered: May 2014
Location: France
Member
Are you using Babel?
Re: Localization of JFace MessageDialog [message #1602050 is a reply to message #1602049] Thu, 05 February 2015 09:37 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 36
Registered: September 2013
Member
Yes, I imported the package BabelLanguagePack-rt.rap-de_4.2.0.v20130724060447.
Is there a default package or something like this?
Re: Localization of JFace MessageDialog [message #1602157 is a reply to message #1602050] Thu, 05 February 2015 11:02 Go to previous messageGo to next message
Aleksander   is currently offline Aleksander Friend
Messages: 44
Registered: May 2014
Location: France
Member
You might want try to import the rt.rap language pack into your target through the software site: http://download.eclipse.org/technology/babel/update-site/R0.12.1/luna.

You will have to include these features to your launcher.
Re: Localization of JFace MessageDialog [message #1602200 is a reply to message #1602157] Thu, 05 February 2015 11:37 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 36
Registered: September 2013
Member
I imported the features ending with nl_en_AA, nl_en_AU and nl_en_CA. But the buttons are still shown in german.
Is there a nl_en feature? I think thats whats missing. Because my .properties files are not used until i created the _en.properties files.

I set the locale using RWT.setLocale(Locale.ENGLISH). Maybe there is the mistake?
Re: Localization of JFace MessageDialog [message #1602251 is a reply to message #1602200] Thu, 05 February 2015 12:19 Go to previous messageGo to next message
Nin Pa is currently offline Nin PaFriend
Messages: 36
Registered: September 2013
Member
The only way changing the buttons text is the argument -nl en in the Run Configurations. I thought this would be dynamically, too.
So i solved it, but it is maybe not really fine.
Re: Localization of JFace MessageDialog [message #1602331 is a reply to message #1602251] Thu, 05 February 2015 13:33 Go to previous message
Aleksander   is currently offline Aleksander Friend
Messages: 44
Registered: May 2014
Location: France
Member
By the way I understand it and made it work is that the -nl argument defines what is the default Locale of your Application. You don't need that. Once you added the *nl_* fragments from Babel to your launch config, you can change the language by changing the language of your browser. I believe nothing else is necessary. Unfortunately, I never tried to change the Locale on the run through a widget.
Previous Topic:Row Template crashs in RAP Version 2.3.1
Next Topic:Table/List with custom row elements
Goto Forum:
  


Current Time: Tue Mar 19 03:11:57 GMT 2024

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

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

Back to the top