Adding Arguments for Message Formats

See Also 

The java.text.MessageFormat code format lets you use strings that are constructed dynamically at runtime. The dynamically added elements are stored in an array of objects, which is passed as a parameter to java.text.MessageFormat. You can use the Message Format Arguments dialog box to specify the values of these objects.

You can add arguments when you use the org.openide.util.NbBundle.getMessage format. This format is part of the NetBeansTM APIs and is used to build modules for the IDE. Consult the NetBeans API documentation for more information on this format.

To enter substitution parameters for a message format:

  1. In the Internationalize dialog box, click the Format button.
  2. Select the java.text.MessageFormat format or the org.openide.util.NbBundle.getMessage format from the Replace Code Format combo box. Then click OK.
  3. In the Internationalize dialog box, click the Arguments button.
  4. Click the Add button next to the Arguments text field.

    A series of parameters, beginning with 0, is added to the text field.

  5. Type a value for the parameter in the Code field.
  6. Use the Add and Remove buttons to add or remove message parameters. When you are done, click OK to close the dialog box.
  7. Finish entering values for the key and value fields as normal.

The arguments you supply are substituted for the {arguments} wild card in the following format:

java.text.MessageFormat(java.util.ResourceBundle.getBundle("bundle name").getString("key"), new Object[] {arg1, arg2, arg3})

See Also
Internationalizing a Single File
Internationalizing a Set of Files With the Internationalization Wizard
Internationalizing a String With the GUI Builder

Legal Notices