Label captions not displayed

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Label captions not displayed

Postby spackers » Sat Feb 16, 2008 5:45 am

Hi,

I'm using the SWT Designer to maintain some code that was originally hand-crafted; everything works well except where strings for captions/titles/etc are loaded from a properties file corresponding to the users language - in which case SWT shows nothing. It appears that SWT is not able to load any string which is obtained via a method call, even in this example:

Code: Select all
   public String get(String str) {
      return str;
   }
   protected Control createContents(Composite parent) {
      Control contents = super.createContents(parent);
      setTitle(get("hello-world"));


This makes working with the design pretty difficult because you can't see which control is which - is there a better way for me to handle translation that SWT can understand? I don't need to see the translated versions, just the message ID that was passed in would be fine.

Thanks,
John
spackers
 
Posts: 1
Joined: Fri Feb 15, 2008 9:08 am

Re: Label captions not displayed

Postby Eric Clayberg » Mon Feb 18, 2008 10:40 am

SWT Designer supports a variety of string internationalization / localization styles as described here. The style you are using isn't one that is supported by default.

Give the following a try with the latest SWT Designer build...

Code: Select all
/**
* @wbp.eval.method.return str
*/
public String get(String str) {
    return str;
}
protected Control createContents(Composite parent) {
    Control contents = super.createContents(parent);
    setTitle(get("hello-world"));

Note that Designer will then display the input argument to the get() method which is "hello-world" in this case. The get() method is not executed, so no transformation of the input argument will take place.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests