IntelliJ IDEA 2022.3 Help

I18nize Hard-Coded String

Alt+Enter - i18nize hard coded string literal

Use this dialog box to extract a hardcoded string literal to the specified .properties file. This intention action becomes available, when the Hard-Coded Strings inspection is enabled.

Item

Description

Properties file

In this text box, specify the .properties file to store the extracted string literal in. Type the path to the file manually or click Browse the Browse button to open the Choose Properties File dialog, where you can select the desired location using the project tree view or through a search by name. As you type the search string, the suggestion list shrinks to show the matching properties files only.

Update all properties files in resource bundle

Select this checkbox to have all properties files in the target bundle updated.

Property key

By default, this text box displays the suggested key name, based on the value of the string to be extracted. Accept the default name or type the desired one.

Property value

By default, this field displays the value of the string to be extracted. Accept the default value or type the desired one.

Resource bundle expression

By default, this field displays a resource bundle expression from the resource bundle declaration in the source code. If the resource bundle is not declared in the source code, the field shows an invalid value in red. To improve the situation, define the desired expression. Do one of the following:

Edit i18n template

Click this link to open the File and Code Templates dialog box, where you can change the I18nized Expression template to point to the method of a custom utility class that will be used to access a resource bundle.

A changed file template is a global setting that affects all projects. If you want to restore defaults, open the File and Code Templates dialog box, find the I18nized Expression template in the Code tab, and click the Reset button App actions rollback.

Preview

This read-only field displays the results of applying the I18nize hard-coded string literal intention action.

Last modified: 17 March 2022