IntelliJ IDEA 2017.2 Help

I18nize Hard-Coded String

Alt+Enter - i18nize hard coded string literal


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

ItemDescription
Properties fileIn this text box, specify the .properties file to store the extracted string literal in. Type the path to the file manually or click the Browse button browseButton 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 bundleSelect this check box to have all properties files in the target bundle updated.
Property keyBy 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 valueBy default, this field displays the value of the string to be extracted. Accept the default value or type the desired one.
Resource bundle expressionBy 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:

Basic code completion (Ctrl+Space) is available in this field.

Edit i18n templateClick 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 rollback.

PreviewThis read-only field displays the results of applying the I18nize hard-coded string literal intention action.
Last modified: 29 November 2017

See Also