May 18, 2009

Create new locale properties files with NetBeans

Developing an application with localized messages is something I need to do now and then. Most of the time the messages are defined in a properties file. For each locale we need to create a properties files with the messages. For example if we have a main properties file and we want to define messages for the locale nl we must create the file NetBeans supports this scenario with simple commands to quickly create new properties files for different locales.

Suppose we have created a main locale properties file We right-click on the file and select Add | Locale... from the pop-up menu:

NetBeans opens a new dialog window. Here we can select a locale from the list of locales or fill in the correct values ourselves.

When we click the OK button we have a new file. In our Project Navigator we can see the new locale as node for the file: