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 following icon: .
Create a new resource bundle
In the Project tool window, select the directory where the new resource bundle should be created.
From the main menu, select Resource Bundle.
, or press Alt+Insert and clickIn the dialog that opens, specify the base name of the resource bundle.
If necessary, select the Use XML-based properties files.
To add locales, click and type the comma-separated suffixes of the required locales.
Click OK when ready.
A new node Resource Bundle '<base_name>' appears in the Project tool window:
By default, the bundle contains properties files for all specified locales. You can dissociate it to show only the properties files without the bundle.
Dissociate a resource bundle
Right-click the resource bundle you want to dissociate.
From the context menu, click Dissociate Resource Bundle.
Combine several properties files into a resource bundle
Select the properties files to be combined.
Right-click the selection.
From the context menu, click Combine to Resource Bundle.
Specify the base name of the resource bundle.
Editing resource bundles
Once you create several properties files with the same name and different locale suffixes, IntelliJ IDEA automatically recognizes them and groups them in the Project view into a resource bundle.
IntelliJ IDEA includes a Resource Bundle editor for convenient editing of localizable strings in properties files.
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:
Edit property keys
Open a properties file.
Add, change, or delete keys as required. IntelliJ IDEA reflects the changes 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
Select the property key in the left pane of the resource bundle editor.
In the target locale frame, edit the value as required. IntelliJ IDEA updates the respective properties file accordingly.
When editing a resource bundle, keep the following in mind:
IntelliJ IDEA highlights properties with no values or those omitted in one of the properties files.
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 IDE settings.For more information, see Encoding.
It is possible to encode non-ASCII symbols using both uppercase and lowercase hex sequences (for example,
\u00E3
and\u00e3
). By default, IntelliJ IDEA supports only uppercase sequences. To use lowercase hex sequences, set theidea.native2ascii.lowercase
property in the idea.properties file totrue
.For more information, see Platform properties.
Productivity tips
Copy property keys and values
When editing properties files, you can press Alt+Enter to use the context actions for copying the key or value of the property at the caret to the clipboard.