Geertjan's Blog

  • July 11, 2014

How to Bundle Localized NetBeans Modules with Ant Based NetBeans Platform Applications (Part 1)

Geertjan Wielenga
Product Manager

Let's figure out a solid approach to including localization bundles in our Ant-based NetBeans Platform application. (For Maven, go here.)

  1. Go to https://netbeans.org/downloads. Find the drop-down "IDE Language" at the top right of the page. Choose your language. Click Download under the Download Bundle you need, which is most likely to be "Java SE".

  2. Install the download bundle. If you already have NetBeans IDE 8.0 installed, you'll need to first uninstall it because the download bundle will discover, right at the start of the installation procedure, that NetBeans IDE 8.0 is already installed. So uninstall your NetBeans IDE and then reinstall using the new download bundle.

  3. Start up NetBeans IDE. Open your NetBeans Platform project into it.

  4. For each language for which you want to provide support, create a new module. That's a modular solution, each language in its own module. Switch to the Files window and there, at the same level as 'nbproject' and 'src', create a folder 'release/core/locale' and a folder 'release/modules/locale', containing all the JARs from the download bundle that you'd like to include in the module:

    The above entails that you need to look in your NetBeans IDE installation folder, in the 'locale' folder of the 'platform' folder for the JARs applicable to your language that are relevant to your application. Note that 'core' and 'modules' above match the 'core' and 'modules' subfolder of 'platform' where the JARs above are found:

  5. Continue doing the above until you have all the JARs that you need. Make as many modules as there are languages that you'd like to support for which translated JARs exist.

  6. Bear in mind that if you have a locale like "pt_BR", then this is the way you specify the second part, in the 'run.args.extra' line and/or in the default_options line in the .conf file of the application.

    run.args.extra=--laf Nimbus -J-Duser.language=pt -J-Duser.region=BR 
  7. Run the application and see, for example, the following, i.e., below the fact that org-netbeans-core-ui_pt_BR.jar is included means that the menubar, among other UI pieces, is now in Portuguese (Brazil):

That's it. Interested to know what NetBeans Platform developers out there think of this. It's all pretty nice except for the fact that you need to figure out in which JAR the texts are found that are of interest to your application. In another blog entry I'll suggest some approaches for that, though the simplest approach is to simply include all the localized JARs for your language from the 'platform' folder. They don't contain anything other than properties files, i.e., they're really small.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.