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 messages.properties
and we want to define messages for the locale nl
we must create the file messages_nl.properties
. 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 messages.properties
. 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 messages_nl_NL.properties
file. In our Project Navigator we can see the new locale as node for the messages.properties
file: