How to exclude URLs/blocks/words from translation?
In this article, you'll find how to exclude a specific block or paragraph from being translated into your website.
1. Exclude URLs
Using Weglot, you can exclude some pages from the translation. These pages won't be translated at all.
a. Exclude URLs using the Exclusion rules
To exclude a URL, please visit your Project Settings > Translation exclusions
Then add the relative URL of the page that you want to exclude.
For example, if your page is www.mywebsite.com/page1/, then only add its relative URL: /page1/
The URL exclusion can work with different options that you can select by clicking on "Add Rule":
- Contain: It will exclude all the pages that have their slug containing the input
- End with: It will exclude all the pages that have their slug ending with the input.
- Start with: This option will exclude all the pages that have their slug starting with the input.
- Is exactly: It will exclude the page that has its slug identical to the input
- Match regex: It will exclude the page matching the regex input
If you want to exclude more URLs, click on "Add Rule" and repeat the steps.
b. Exclude URLs when deleting the translations
You can also exclude some URLs when deleting the associated translations.
In order to do that, you will have to go into your Weglot dashboard > Translations > URLs
On this page, you'll be able to select one or multiple URLs to be deleted, then select the "bin" icon to delete the URLs and the associated translations.
You will receive the following prompt to validate the deletion.
Click on "Delete" if you want to delete the URLs and all translations associated:
In this popup, you have the possibility to exclude the URLs from the translations to avoid translations being regenerated.
You can activate the option "Exclude URLs from translations":
Once done, you can find the URL exclusion in your Weglot Dashboard > Settings > Translations Exclusions
Note: Weglot doesn't automatically remove the translations related to the excluded pages. Once the pages are excluded, you'll need to delete the translations related to these pages manually. See: How to definitely remove a translation?
2. Exclude blocks
If you want to exclude a specific part of your website, like the header, for example, go to your Project Settings > Translation exclusions > Excluded blocks section
There, you can paste the right CSS selector of the block.
To find the CSS selector:
First, you will need to right-click on the element and select "Inspect" element
Then, you can use the arrow on the top left of the console to target precisely the element you want to exclude
Next, you can right-click on the element and select "Copy" > "Copy selector"
To finish, on your Project Settings > Translation exclusions > Excluded blocks section, paste the selector you copied previously:
You can add as many selectors as you want in this field. Then, the content won't be translated, whatever the language is.
Note that Weglot doesn't automatically remove the translations related to the excluded blocks. Once the blocks are excluded, you'll need to delete the translations related to these blocks manually. See: How to definitely remove a translation?
If you are using WordPress or Shopify, you can also exclude content by blocks and/or URLs directly into your WordPress/Shopify admin:
- On WordPress, you can go to your Dashboard > Weglot :
3. Translations Rules
Translation rules do not exclude the content from being translated. It only forces some words to be translated a certain way on your website.
In this section, you can indicate if you want a word/expression to be translated or translated in a custom way. The rules will be applied to all new translations but won't change existing ones. Please note there is a three-word max limitation per rule.
Then click on "Save," and it's done.
Have any feedback on this article? Let us know!