Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT buttons internationalization(How to internationalize SWT internal buttons)
SWT buttons internationalization [message #656698] Mon, 28 February 2011 08:07 Go to next message
Viorel Hojda is currently offline Viorel HojdaFriend
Messages: 10
Registered: July 2009
Junior Member
Hello all !

I've been working on internationalization of an RCP Product. Basically I used fragment plugins and resource files for each Locale/language I want my program to be in. So far everything works fine. The problem is this: how to internationalize SWT buttons like "Yes", "No","Cancel", etc ? Let's say I make a MessageBox with the following code:

MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);

Now, let's say I want to start in app in french. I start the app with the "-nl fr" arguments and in my plugins directory I have all the plugins that I need (that is org.eclipse.swt.nl_fr_3.6.0.v20101211043401.jar). All the app is ok, some internal messages (file menus, etc) and the messages from the resource files are in french, except the "Yes"/"No"/"Cancel" buttons. I want to specifiy that in the org.eclipse.swt.nl_fr_3.6.0.v20101211043401.jar i did found a resouce file SWTMessages_fr.properties with the following values (among others):

SWT_Yes=Oui
SWT_No=Non
SWT_OK=OK
SWT_Cancel=Annuler

So, I think the buttons should be fine, but they aren't. Also, I've tried to change the Locale on the OS in french, but still nothing. If anyone can help me, I would much appreciate it.

Thank you !
Re: SWT buttons internationalization [message #656829 is a reply to message #656698] Mon, 28 February 2011 18:02 Go to previous messageGo to next message
Catalin Gerea is currently offline Catalin GereaFriend
Messages: 89
Registered: July 2009
Location: Bucharest, Romania
Member

If you are on windows:
Start -> ControlPanel -> Regional And language options -> Regional options -> french.
Then you should see the buttons Yes/No/Cancel with text in french.

On linux just do an 'export LANG=fr'.


Time is what you make of it.
Re: SWT buttons internationalization [message #656950 is a reply to message #656829] Tue, 01 March 2011 07:22 Go to previous messageGo to next message
Viorel Hojda is currently offline Viorel HojdaFriend
Messages: 10
Registered: July 2009
Junior Member
First of all, thanks a lot for the reply.

Unfortunately, I doesn't work. I already tried the solution you provided before asking on the forum. Everything is in French except the buttons. My "not so perfect" solution was to completely replace all the SWT "MessageBox"-es with JFace "MessageDialog"-s. The buttons look ok using JFace, but I would really like to be able to use SWT MessageBox -es, just to know that I can and how to do it.

Thanks again, anyway.
Re: SWT buttons internationalization [message #657682 is a reply to message #656950] Thu, 03 March 2011 15:57 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
SWT's MessageBox implementation does not provide the strings that are
displayed on its buttons, these come solely from the OS. So if you're using
an OS install whose language is XXX then the buttons should automatically
reflect this. I'm not sure why you aren't seeing this when you try to
change your machine's locale. When you make this change do the strings in
other apps change? (eg.- run Notepad, go to save a new file, are the native
file dialog's strings like "Save as type:" changed to your specified
locale?).

Grant


"Viorel Hojda" <viorelhojda@yahoo.com> wrote in message
news:iki6fd$fg6$1@news.eclipse.org...
> First of all, thanks a lot for the reply.
>
> Unfortunately, I doesn't work. I already tried the solution you provided
> before asking on the forum. Everything is in French except the buttons. My
> "not so perfect" solution was to completely replace all the SWT
> "MessageBox"-es with JFace "MessageDialog"-s. The buttons look ok using
> JFace, but I would really like to be able to use SWT MessageBox -es, just
> to know that I can and how to do it.
> Thanks again, anyway.
Re: SWT buttons internationalization [message #657687 is a reply to message #657682] Thu, 03 March 2011 16:12 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Well does your answer mean I can't start an application in EN_US if my
operating system is DE_AT?

For the rest of Eclipse I can certainly do this quite easily by starting
with -nl EN_US.

Tom

Am 03.03.11 16:57, schrieb Grant Gayed:
> SWT's MessageBox implementation does not provide the strings that are
> displayed on its buttons, these come solely from the OS. So if you're using
> an OS install whose language is XXX then the buttons should automatically
> reflect this. I'm not sure why you aren't seeing this when you try to
> change your machine's locale. When you make this change do the strings in
> other apps change? (eg.- run Notepad, go to save a new file, are the native
> file dialog's strings like "Save as type:" changed to your specified
> locale?).
>
> Grant
>
>
> "Viorel Hojda" <viorelhojda@yahoo.com> wrote in message
> news:iki6fd$fg6$1@news.eclipse.org...
>> First of all, thanks a lot for the reply.
>>
>> Unfortunately, I doesn't work. I already tried the solution you provided
>> before asking on the forum. Everything is in French except the buttons. My
>> "not so perfect" solution was to completely replace all the SWT
>> "MessageBox"-es with JFace "MessageDialog"-s. The buttons look ok using
>> JFace, but I would really like to be able to use SWT MessageBox -es, just
>> to know that I can and how to do it.
>> Thanks again, anyway.
>
>
Re: SWT buttons internationalization [message #657742 is a reply to message #657687] Thu, 03 March 2011 19:24 Go to previous message
Catalin Gerea is currently offline Catalin GereaFriend
Messages: 89
Registered: July 2009
Location: Bucharest, Romania
Member

In Linux we are using the "export LANG=en" in the start-up script of our RCP application, while the OS language is DE. And works as expected (the export LANG was the solution for the problem described in this thread we were facing also in our application).

I do not know the solution for other OS's since the deployment requirement for our application was Linux only.


Time is what you make of it.
Previous Topic:GUI Resource Estimate
Next Topic:Amount of pixels scrolled with SWT mouseScrolled
Goto Forum:
  


Current Time: Sat Apr 20 03:27:39 GMT 2024

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

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

Back to the top