In this section:
- Internationalization and Localization Support
- Creating and Editing Properties Files
- Extracting Hard-Coded String Literals
- Creating Property Keys and Values
I18N support with RubyMine falls into the following major aspects:
- Internationalization, which involves extracting strings out of your source code and presenting them as properties that are further referenced in the source code.
- Localization, which means translating these properties into the target languages.
RubyMine extends i18n support to both Rails applications, and plain Ruby projects.
Following the Rails i18n conventions, RubyMine stores dictionaries under the config\locales directory of a project. However, you can configure additional directories, where dictionaries will be stored. This is done in the I18n Folders page of the Project Structure.
There are two ways of representing dictionaries:
- YML files with locale record and key-value pairs.
- Ruby files with Ruby hashes.
The locale files are recognized as the properties files and are marked with icon. So doing, all locales are logically merged into a single dictionary.
RubyMine provides helpful features that simplify working on software internationalization and localization issues. These features are:
- Dedicated storage location and automatic recognition of locales.
- Code inspections that help detect i18n-related issues.
- Quick fixes to extract hard-coded strings and create property keys.
- Code completion Ctrl+SpaceCtrl+SpaceCtrl+SpaceCtrl+SpaceAlt+SlashCtrl+SpaceCtrl+Space or Ctrl+Back SlashCtrl+SpaceCtrl+SpaceControl SpaceControl SpaceControl SpaceControl Space, Alt Escape or Shift Space in t() method.
- Navigation to declaration of a locale key Ctrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+Alt+G, Escape, Period, Alt+Period or Ctrl+Button1 ClickF12, Shift+F2, Ctrl+B, Ctrl+Button1 Click or Button2 ClickCtrl+B, Ctrl+Button1 Click or Button2 ClickF3 or Ctrl+Button1 ClickMeta+B, Meta+Button1 Click or Button2 ClickCommand B, Command Button1 Click or Button2 ClickCommand B, Command Button1 Click or Button2 ClickF3 or Control Button1 ClickCommand B, Command Button1 Click or Button2 Click.