Internationalization and localization
RubyMine supports various features that help you internationalize and localize Rails applications and plain Ruby projects. You can create or edit locale properties using intention actions right in the editor, run an inspection allowing you to find missing keys, preview localized values, and so on. These capabilities are available for various project file types, including ruby scripts, HTML, ERB, and HAML files.
We’ll use the sample Rails application to show internationalization capabilities of the IDE. You can repeat the steps below by checking out this application.
Manage locale files
Following i18n conventions, RubyMine automatically loads dictionary files (YAML or Ruby) stored in the config/locales directory. When creating a project, the en.yml file is created by default.
Add custom locale folders
You can provide paths to custom locale folders.
Open the Settings dialog Ctrl+Alt+S.
go to the Project Structure page and switch to the I18n tab.
Click the Add icon to open the file browser.
Select the required folder.
Add a dictionary file
Go to config/locales in the Project view.
Click
New File or Directory on the tool window toolbar (Alt+Insert) and select File from the list of file types.
In the New File dialog, specify the name, for example, ger.yml and press Enter.
The new file is created empty. You can create locale properties by adding key-value pairs manually or via the dedicated dialog as described in the procedure below.
Create locale properties
RubyMine provides an inspection for keys that do not exist in any locale. To see this capability in action, do the following:
Open the app/views/static_pages/home.html.erb file and scroll down to the following code:
<h1>Welcome to the Sample App</h1>Replace it with the code below:
<h1><%= t('.welcome') %></h1>Hover over the .welcome key to see a warning:

Click Create Property.
In the invoked dialog, specify the property value:

Use the
button to add translations for other locales.

Then, click OK to create the specified translations in the dictionary files:

You can navigate from the key called within t method to the corresponding keys in the dictionaries.

Extract hard-coded strings
RubyMine enables you to extract hard-coded strings into locale files. To try this capabiltity using the sample Rails application, do the following:
Open the app/views/static_pages/home.html.erb project file and scroll down to the following code:
<%= link_to "Sign up now!", signup_path, class: "btn btn-lg btn-primary" %>Place a caret to the “Sign up now!” string, press Alt+Enter and select the I18nize hard-coded string action. Press Enter.
In the Create Property dialog, specify the key and provide the desired translations:

Click OK. RubyMine will add corresponding properties to the locale files and replace the initial string with the t method called for the created key:
<%= link_to t('.signup'), signup_path, class: "btn btn-lg btn-primary" %>
View locale values
RubyMine provides the ability to display localized values instead of I18n keys. To try this capabiltity using the sample Rails application, do the following:
Place a caret at the required key and press Ctrl+. to fold it:

The preview will show the value from the system default locale.
To use another locale to preview values, press Alt+Enter and select Change preview locale:
