How to prevent specific content being detected by Localize
There may be some content in your application that needs to stay untranslated for various reasons. Preventing this content from coming in to your Localize dashboard will make your implementation even more efficient. If you have email addresses, dates/times, SKUs, counters, or other variables you can use the following methods to tell Localize to ignore this content.
Content that is NOT Detected
For security reasons, Localize will never bring content into your dashboard that is entered by a user into an
<input>
field. This can help to keep PII/PHI from being brought into your dashboard.
Localize features to block specific content
Blocked Classes and/or IDs
You can tell Localize to ignore any content within an HTML element that contains a specific CSS class or ID selector. You can add blocked CSS classes and IDs in your Localize.intialize() call, or by adding them to the Exclude Phrases by CSS Classes & IDs area in your Project Settings.
This will completely prevent this content from ever being sent to Localize.
Watch this short video which shows how to block content using the Exclude Phrases by CSS Classes & IDs feature in the Localize dashboard.
notranslate
attribute
notranslate
attributeAdd a notranslate attribute to tell Localize to ignore content in that HTML element and all of its child elements.
This is useful in those cases where you don't have a specific CSS class or ID you can specify for that element.
<var>
tags
<var>
tagsNot only can you use <var>
tags as a means of wrapping dynamic content for deduplication purposes, anything contained inside a <var>
tag will never be sent to Localize.
For example: "My name is <var>Brandon</var>
" the word "Brandon" won't be sent to Localize.
ignore
attribute
ignore
attributeAdd an ignore
attribute to an HTML element so that Localize will ignore the content of the element while allowing it to be grouped with adjacent text.
Ignore Phrases of Your Website
Use the Ignore Phrases of Your Website feature to block specific words or phrases in your website from being brought into the Localize dashboard.
Ignore Pages of Your Website
Use the Ignore Pages of Your Website feature to ignore entire pages of your website for which you won't be needing translations.
See What Localize Sees
To see exactly what will be sent to Localize for a specific page, do the following:
- Display the developer panel in your browser.
- Select the Console tab
- Enter
Localize.getPhrases(document.body)
into the console
- This will return a list of all phrases on the current page.
- Anything not in the list won't be sent to Localize.
Updated almost 3 years ago