March 2008 Archives

I18N hyperlinking for NetBeans modules


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 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 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


About this Archive

This page is an archive of entries from March 2008 listed from newest to oldest.

November 2007 is the previous archive.

April 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.