OnApp uses a standard Rails i18n internationalization system. You can add any language to your Control Panel and translate all the interface labels, error messages, and other texts from default language into one or more custom languages.
If you use custom languages on your CP, after the upgrade to OnApp 6.1, import custom languages by following the procedure.
Add Custom Language
You can add custom languages by translating the UI phrases from English into a custom language, using the i18n Customization menu on your CP. To add a custom language and provide translations:
- Go to your Control Panel > Admin > Settings > i18n Customization menu.
- Click the + button, select the required language from the list and click Submit.
- Click the label of the required language. On the page that loads, you will see the following tabs with types of translations:
- Missing translations - lists phrases that are not translated from English into a custom language
- Completed translations - lists phrases that are translated from English into a custom language. This tab is available if there are some phrases translated into a custom language.
- Updated translations - lists phrases that exist in English and are translated into a custom language but which were updated in English since the last translation into a custom language. This tab is available if there are some phrases updated in English.
Static pages - lists phrases that appear on static pages.
4. In all of the above-listed tabs, you can provide translations in the corresponding boxes next to the texts in English.
- For extended texts that include HTML tags, variables, and other special symbols, click the —> button to copy the English variant into a target custom language to preserve the default structure.
- Do not translate the words true and false in a label, preceeding a boolean variable. For example: true (Do not translate -- Enter true or false) - you can translate the label into your custom locale but the words true and false must be in English.
5. Click Apply to save the provided translations.
6. When you are finished with translations, return to the Locales menu and click the Save Changes button.
- If you don't click Save Changes, the translations you provided will not be applied to your custom language.
- You should apply and save at least one translation to be able to make your custom language available on CP.
7. Go to Admin > Settings > Configuration > Interface tab, add your custom language into the Locales box and click the Save Configuration button. If a custom language is not added to the interface configuration, users will not be able to use it in your cloud.
Export English Language
You can export the English language from your Control Panel to a YAML file. The exported file will contain all the user interface labels, messages, and other texts in English. You can then translate them to your custom language and import the file back to Control Panel.
To export the English locale to a YAML file, run the following rake task:
default_dump is the name of the file and
tmp\ is an example of a directory to save the file to.
Import Custom Language
You can also add a custom language to CP by uploading a YAML file with your translations to the config/locales directory. When the file is uploaded to config/locales, your custom language will become available in your cloud. However, in order to be able to edit translations for this language via the i18n Customization menu, you should run the following rake task:
After the rake task is executed, a dump file with you custom translations is automatically created in the locales_dump directory. The onapp:language:import rake task also ensures that after a subsequent upgrade to a newer OnApp version, all new UI labels, texts, and messages in the default language will be available for translation into the custom language at Control Panel > Admin > Settings > Locales > language > Missing translations tab.
If you make any changes in the default English translations, you should run the following rake task for these changes to be applied on CP:
Enable Custom Language for Specific User
Now that you have added one or more custom languages, you can specify which language a particular user will see in their view of the Control Panel.
- Make sure that the required locales are added at Control Panel > Admin > Settings > Configuration > Interface > Locales box.
- Go to Admin > Users menu.
- Click a user's name.
- On the page that appears, click the Edit Profile tab.
- Choose your custom language from the Locales drop-down list.
- Click Save.