Phrase provides great support for translations with ICU MessageFormat syntax. Placeholder highlighting, explanation and a preview system.
Activate ICU MessageFormat
To enable ICU MessageFormat support for a project, navigate to its settings, click on the “Advanced” pane and activate the ICU MessageFormat option. After enabling it, you will see ICU MessageFormat support in the translation editor instantly.
ICU MessageFormat support
Enabling ICU MessageFormat support for a project brings powerful features to ensure translation syntax consistency at your fingertips:
When opened in the translation editor, the different parts of your message will be highlighted and displayed along with relevant meta-information such as format type.
You can also apply the individual arguments and formats directly into your target translation and thus avoid errors introduced by typos. Simply click on a placeholder in the list of extracted placeholders or directly onto the part of the source content you want to use in the target translation.
We will validate the correctness of the ICU MessageFormat syntax while translating tell you when something went wrong. This can prevent broken ICU messages in the localization files.
Since ICU MessageFormat syntax can be quite complex, it can be very helpful to see how the translation will look with actual arguments. With the ICU preview built right into the translation editor, you can do exactly that.
Click on the preview button and assign real-world attributes to the ICU message to get an idea if the translation syntax is correct and all possible cases are supported as expected.
Within the preview panel, you can assign test values for the ICU MessageFormat attributes of your translation. We will then show you in real-time how the string looks so you can double-check that the translation works as expected.
You can translate pluralized keys containing the ICU MessageFormat easily just like normal pluralized keys by entering the different plural forms via the dropdown menu. Therefore you only have to switch from the Raw ICU view to the Pluralizations view (see image below). Although you can also edit the translations in the RAW view, we always recommend working with the pluralization view to avoid potential ICU syntax errors.
Hint for the correct setup: Because the ICU MessageFormat natively supports pluralization there is no need to enable pluralization in the key settings first (different to normal pluralized keys).