[]
I18N hyperlinking for NetBeans modules
[ mkleint ] 08:36, Monday, 31 March 2008

It's a good practice to have your code internationalized. The coding pattern for doing so in NetBeans modules is following:

org.openide.util.NbBundle.getMessage(FindResultsPanel.class, "FindResultsPanel.btnModify.text")

Here the FindResultsPanel is the class where the text is used, The Bundle.properties file resides in the same package as the class and the getMessage method makes sure it loads properly in an efficient manner. If you are coding a NetBeans module, you should avoid calling java.util.ResourceBundle directly.

However it's been always a pain to edit the text. First you ned to find the I18N token, then find and open the relevant Bundle.properties file and then find the line with the I18N token. The pain has become unbearable for me and I created a simple module that's capable of "hyperlinking" to the correct location in the correct resource bundle file directly from the java source file.

The hyperlink is invoked by pressing Ctrl while pointing to the I18N string. If you wait a bit, a tooltip shows with the actual message text from bundle file.

The module NBM file can be downloaded from here.
Works in Netbeans module projects only (both Ant and Maven based)
It will eventually make it either into the Maven support or the NetBeans module development modules

Enjoy.


Comments

This is really cool, Something that I waiting for while

--Anuradha Gunasekara, March 31, 2008 10:17 AM

Looks great and seems to be very useful.
Definitely the best thing of today (but it is not so hard, there is tax-pay day in Czech republic today ;) )

--Satai, March 31, 2008 12:23 PM

Very useful plugin. Should should add it to the Plugin Portal http://plugins.netbeans.org/PluginPortal/faces/MainPage.jsp.

--Oleg, March 31, 2008 09:56 PM

done.
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=6953

I've added he code to the default netbeans module development module for the version coming after 6.1

--mkleint, April 1, 2008 12:24 PM

Hi,
My name is James Branam and I'm the NetBeans Community Docs Manager. Your blog entry would make a fantastic tips and tricks entry for our Community Docs wiki (http://wiki.netbeans.org/wiki/view/CommunityDocs). Would you be willing to contribute it? If you need any help or have any questions, please contact me at james.branam@sun.com. I look forward to hearing from you.

--James Branam, April 8, 2008 08:19 AM

Could you please provide the source code of this module? I'm very interested in improving the current i18n module in netbeans. Probably your code would be a good starting point.

--Daredevil, June 30, 2008 09:35 AM

check the current hg.netbeans.org/main repository, the apisupport.project project, package org.netbeans.modules.apisupport.project.hyperlink

--Milos Kleint, June 30, 2008 10:01 AM
Post a comment









Remember personal info?