Exclusion rules feature is available for all Lokalise Messages integrations from the Start plan and above.
Exclusion rules enable you to choose which messages (or messages parts) should not be translated. Please note that this feature works only for the incoming messages sent by your customers.
To get started, proceed to your Lokalise Messages dashboard and click Exclusion rules:
You'll be presented with the following screen (the UI might slightly vary but the available options will be the same):
Creating exclusion rules
First of all, you'll have to choose one of the translation conditions from the Apply condition dropdown:
Translate only before — if the incoming message contains a string specified in the current rule, only the text before the specified string will be translated. The rest of the message will be left intact.
Translate only after — if the incoming message contains a string specified in the current rule, only the text after the specified string will be translated. The rest of the message will be left intact.
Translate only when not equals — if the incoming message equals the text specified in the rule then the whole message will be ignored. No detection or translation will be triggered.
Next, fill in the When message contains field and specify text to use in the chosen condition. If needed, tick the case-insensitive field to make the entered text case-insensitive.
Once you're ready, click the Add rule button.
Then you'll be able to create additional rules. If you've created multiple rules, these will be applied in the order they appear in the UI.
Previewing and special notes
After the rule is created, you can preview it by entering a message in the Preview field and clicking the Preview button:
Note that the Translation results field does not contain the word "Lokalise" because we've chosen to exclude it.
Please be aware that if after applying all the exclusion rules the translation results become empty, the incoming message will be effectively ignored: Lokalise Messages will not try to perform language detection or translate it: