Translation rules feature is available for all Lokalise Messages integrations from the Lite plan and above. Language-specific translation rules, however, are available only on the Pro plan.
Translation rules enable you to override the default machine translation choice algorithm globally or on a per language basis. Please note that this feature does not affect language detection.
To get started with this feature, open your dashboard and switch to the Translation rules tab:
You'll be presented with the following screen (the UI might slightly vary but the available options will be the same):
General translation rules
Under the General translation rules section you can adjust global translation settings:
Translation provider — this is the default provider that will be used for all translations unless specific translation rules apply.
Fallback provider — if for some reason Lokalise Messages were unable to perform translation using the default provider (because the language pair is not supported or an error happened), the fallback will be used instead. We recommend choosing Google Translate as the fallback as it has the best language coverage.
If the Fallback provider has been specified but the default provider hasn't been chosen, Lokalise Messages will use the fallback provider in all cases (unless specific rules apply).
Click Clear settings to revert to default translation rules.
Specific translation rules
This feature is available only on the Pro plan.
For a more fine-grained control, proceed to the Specific translation rules section. Here you can choose translation providers on a per language pair basis. These rules have higher priority than the global settings covered above.
To get started, click the New rule button:
Choose the languages from the dropdown and then pick one of the providers:
Please note that these rules work in a bidirectional way. In other words, if there's a rule to translate the incoming message from one language into another, the same rule will be applied when translating back.
If for some reason the chosen provider cannot be used with the language pair, we will automatically switch to the default provider and, if needed, to the fallback provider. If an error occurred when using the chosen provider for a specific language pair, Lokalise Messages will revert to the fallback provider.
If you choose a language pair provider while the default and fallback providers are not set, we'll set Google as default provider for both rules.
After a rule has been created, you can find it in the list under the Specific translation rules section:
Click on the "trash bin" icon to delete a rule.
If you would like to update the rule (for example, adjust the formality level for the DeepL provider), you should add a new rule with the same language pair. After this rule is created, it'll overwrite the previously created rule with the same languages.
Note on glossaries
If you would like to use glossary with translation rules, make sure to choose Google Advanced provider. For example, if the Google advanced provider has been chosen for a specific language pair, and there are glossary entries available for this pair, they'll be utilized when performing translations.