Problem with internationalization

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

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

Problem with internationalization

Postby mkornatzki » Thu Apr 02, 2009 1:10 am

i like the possibility of internationalization in swing designer.
if one have the resourcebundles only in one project or one resourcebundle per dialog then there is no problem and it really works very well.

Our applications comprises of multiple projects (frameworks) and each framework can have a resourcebundle. A word exist only one time in all the resource-bundles for an application.

I notice/guess that if i use the nls feature of the designer you look for the BUNDLE_NAME and didn't use the Messages.getString(String key) method (where we implement our code to get the string).

Is there a possibility for us to use the nls feature? Maybe you can give me an advice or if it is not possible (i think so) can you think about an extension of the nls feature? (maybe it is possible to implement something like in group-layout. if i add a component you instantiate the component and try to use setText())

I hope you understand my request.

regards,
michael
mkornatzki
 
Posts: 121
Joined: Wed Oct 15, 2008 3:57 am

Re: Problem with internationalization

Postby Eric Clayberg » Mon Apr 06, 2009 4:20 am

Swing Designer directly reads and updates the *.properties files, so it has to know where to find those files via parsing the UI source code.

The tool supports a number of common NLS patterns commonly used in SWT, Swing and GWT apps, but not arbitrary custom patterns.

Is it possible to customize the tool to support some specific one-off pattern? Sure, but there is a charge associated with that type of work.
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

Re: Problem with internationalization

Postby SirMad » Wed Nov 25, 2009 6:23 am

hello

i have the same problem...
isn't their a possibility to use a own ResourceBundle loading...

e.g. instead of
Code: Select all
private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("config.language"); //$NON-NLS-1$


Code: Select all
private static final ResourceBundle BUNDLE = customResourceBundleloading(); //$NON-NLS-1$: config.language
SirMad
 
Posts: 3
Joined: Tue Jun 30, 2009 12:05 am

Re: Problem with internationalization

Postby Eric Clayberg » Thu Nov 26, 2009 8:31 am

The problem with custom resource bundle loading is that Designer does not know where to find the resource files so that it can render the widgets in different languages or edit the resource files when you edit the UI.

The parser has built-in support for the various standard internationalization patterns so it can find resource bundles references using any of those common patterns.

In order to support custom resource bundle loading, we have added support for a new, custom @wbp.nls.resourceBundle JavaDoc tag in the latest build that will tell the parser where to find the resource files. For example...

Code: Select all
/**
* @wbp.nls.resourceBundle test.messages
*/
private static final ResourceBundle m_bundle = MyResourceBundleFactory.getMainBundle();

...where "test.messages" is the name of the resource file for the default locale.
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 Swing Designer

Who is online

Users browsing this forum: Google [Bot] and 1 guest