Internationalizing a Single File

The Internationalize dialog box enables you to replace any hard-coded string in a single file with an internationalized string. If you need to internationalize several Java sources into one or more resource bundles, use the Internationalization wizard.

To automatically internationalize source code:

  1. In the Explorer, right-click the class file you want to internationalize and choose Tools and choose Internationalization and choose Internationalize.

    The Internationalize dialog box displays, showing the .properties file into which the internationalized strings will be saved in the Bundle Name field. The Replace Format field gives you a preview of the internationalized string.

  2. To choose a different .properties file, click Browse. Alternatively, you can click New to create a new properties file in which to save the internationalized strings. The .properties suffix is added to the file name you specify.
  3. Click Format if you want to change the method used to generate the localized string.
  4. Click Arguments if you want to add arguments to the method call. You can only add arguments to the method call if you use the java.text.MessageFormat or org.openide.util.NbBundle.getMessage formats.
  5. Check that the key and value are correct. By default, the Internationalize dialog box gives the key the same name as the string being replaced.
  6. Click Replace to generate the internationalized string.

    The next string to be internationalized is then displayed in the Value text field. Click Skip to skip over any strings you do not want to internationalize. When the last string has been replaced, the dialog box is automatically dismissed.

To get information about the highlighted string in the Source Editor, click Info to see the name of the component containing the string and the property that the string is associated with.

See also
Internationalizing a Set of Files With the Internationalization Wizard
Inserting an Internationalized String Into Source Code
Code Formats for Internationalized Strings
Adding Arguments for Message Formats
Configuring Internationalization Settings
Setting Properties Files

Legal Notices