IntelliJ IDEA 2019.2 Help

Resource bundles

A resource bundle is a set of properties files with the same base name and a language-specific suffix. For example, if you create file_en.properties and file_de.properties, IntelliJ IDEA will recognize and combine them into a resource bundle.

IntelliJ IDEA marks resource bundles with the icon The resource bundle icon.

Create a new resource bundle

  1. In the Project tool window, select the directory where the new resource bundle should be created.

  2. On the File menu, point to New and click Resource Bundle, or press Alt+Insert and click Resource Bundle.

  3. In the dialog that opens, do the following:

    1. Specify the base name of the resource bundle.

    2. If necessary, select the checkbox Use XML-based properties files.

    3. Add the required locales. To do that, click the Add button and type the comma-separated suffixes of the required locales.

    4. Click OK when ready.

The new node Resource Bundle '<base_name>' appears in the Project Tool Window:

Resource bundle

By default, the bundle contains properties files for all specified locales. You can dissociate it and show only the properties files, without the bundle.

Dissociate a resource bundle

  1. Right-click the resource bundle you want to dissociate.

  2. From the context menu, click Dissociate Resource Bundle <base_name>.

Combine several properties files into a resource bundle

  1. Select the properties files to be combined.

  2. Right-click the selection.

  3. From the context menu, click Combine to Resource Bundle.

  4. Specify the base name of the resource bundle.

Editing resource bundles

Once you create several properties files with the same name, differing by locale suffix, IntelliJ IDEA automatically recognizes them and groups them in the Project view into a resource bundle.

Resource bundle

IntelliJ IDEA includes a Resource Bundle editor for convenient editing of localizable strings in properties files.

To open the Resource Bundle editor, do one of the following:

  • In the Project tool window, right-click a resource bundle and choose Jump to Source.

  • Select a resource bundle in the Project tool window, and press F4.

  • Open a properties file that is a part of a bundle and click the Resource Bundle tab at the bottom of the editor:

    Resource bundle editor tab

Edit property keys

  1. Open a properties file.

  2. Add, change, or delete keys as required. The changes are reflected in the Resource Bundle editor.

Use the Resource Bundle editor to change property values, which will ensure that you edit the entire set of property files simultaneously. IntelliJ IDEA creates respective records in each file of the bundle.

Edit property values

  1. Select the property key in the left pane of the resource bundle editor.

  2. In the target locale frame, edit the value as required. The respective properties file is updated accordingly.

    Resource bundle editor

When editing a resource bundle, keep the following in mind:

  • Properties with no values or that are omitted in one of the properties files are highlighted in red.

  • To convert between escape sequences (for example, \u00df) and unicode literals (corresponding national characters, such as ß) in properties files and in the Resource Bundle editor, select the Transparent native-to-ascii conversion checkbox on the File Encoding page of the Settings/Preferences dialog.

  • It is possible to encode non-ASCII symbols using both uppercase and lowercase hex sequences (for example, \u00E3 and \u00e3). By default, only uppercase sequences are enabled. To use lowercase hex sequences, set the idea.native2ascii.lowercase property in the idea.properties file to true.

    For more information, see Configuring platform properties.

Last modified: 17 October 2019