Over a million developers have joined DZone.

A New Proposal How to Reorganize the NetBeans Translation Project

DZone 's Guide to

A New Proposal How to Reorganize the NetBeans Translation Project

· Java Zone ·
Free Resource

In this article, I describe a proposal for how to reorganize the new NetBeans translation project described here:


Also, I will show how to migrate the running project to the new project structure. The new project structure enables the following features the old one does not support:

  1. It is available as a Maven project.
  2. It makes Maven artifacts available for each language. So developers only need to integrate the languages they want.
  3. The translators only need to maintain the translations for one language at one project per language and don't need to maintain the translation within a platform and an ide-project.


The goal of this new structure is to provide a maven artifact that can be easily included within a maven paltform based application as a maven dependency like:


For the development we would have a parent project called "LocalizedResources-parent" and an application project called "LocalizedResources-app" for finding untranslated text and for proving the translations. For each language we would have a simple module whose name consists of "LocalizedResources-" and the language, i.e. "LocalizedResources_de". This projects only contains the translations for the language indicated by the end of the project name.

This project has a "nbm-branding" folder as a resource folder containing all translations in the same way as the branding module holds its branding translations. The only difference is, that the translations are not held as a language specific resource but as the default resources. This way it is possible to force the nbm-maven-plugin to create localized jar files with localized bundles. The only thing to be done to achieve this is to set the branding token to the language id (e.g., de) instead of the default branding token in the nbm-maven-plugin configuration. The following example is copied from a pom.xml file for a "LocalizedResources_de"-Module:


The resources can be maintained by calling the branding tool, started by right clicking on the project using the "Resource Bundles" tab (and not "Internationalization Resource Bundles"), as you can see in the following screen shot:

Attached to this article  you will find a project structure containing a translation project for the German language.

How to migrate an already started translation project

This section describes how to migrate an existing project to a new translation project. It will be explained by using the example of what would need to be done in order to convert the Polish project:

  1. Create a new module by a right click on the modules folder of "LocalizedResources-parent"  and left click on "Create new Module...".

  2. Select the Category Maven and the Project type "NetBeans Module" and click "next".

  3. Change the project name to LocalizedResources_pl.

  4. Click next and then finish.

  5. Open the pom.xml and extend the nbm-maven-plugin configuration by adding branding and cluster elements so the plugin configuration looks as follows:

  6.  Now change to the files view and add a folder "nbm-branding" to "src/main".

  7. Copy the folder "modules" found at the LocalizedNetBeans branding folder to the folder created the previous step.

  8. Delete all bundle files that are not relevant for the Polish translation. For example, in Windows, open the modules folder and search for *.properties within the new folder, mark all files that don't end with "_pl" and delete them.

  9. Now open the archives found at the old pl's project folder "release\modules\locale\" and copy the top package folder of the jar ending with _pl to the folders found at the modules folder.  For example, if you have a jar-archive org-netbeans-core-execution_pl.jar, you would copy/merge the contained org folder to the org-netbeans-core-execution.jar folder in the new project. See screenshot:

    If you are asked if the contents shall be merged, answer "yes". If you are asked what to do with properties files with the same name (there should be only Bundle_de.properties), choose to copy it with another name (Windows 7 would create "Bundle_pl(2).properties").

  10. For all jars that do not have a corresponding jar folder, create the folder and copy the top-level package.

  11. Now identify all "Bundle_pl(2).properties" and merge the content manually with the "Bundle_pl.properties" within the same folder. Usually you just need to add the properties from the smaller file to the larger file. Delete the "Bunde_pl(2).properties".

  12. Search for all "Bundle_pl.properties" files and rename them to "Bundle.properties".

  13. Add a dependency to the LocalizedResource_pl project to LocalizedResources-app, clean the LocalizedResources-parent project and build with dependencies. Once you have started the application in Polish, you will see the translations from the old translation project.

  14. If you want to change some translations, right click the LocalizedResources_pl project and click "branding". Now you need to work on the labels at the "Resource Bundles" tab  (and not "Internationalization Resource Bundles", as before).

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}