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

Add 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

Not 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

Add 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 Block New Phrases by Pattern feature to block specific words or phrases in your website from being brought into the Localize dashboard.

Ignore Pages of Your Website

Use one of the Disable Pages features to ignore entire pages of your website for which you won't need translations, or don't want to translate for security purposes.

See What Localize Sees

To see exactly what will be sent to Localize for a specific page, do the following:

  1. Display the developer panel in your browser.
  2. Select the Console tab
  3. 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.

What content will be sent to the Localize back end?

The following table lists the various methods available for blocking or de-duping content and details whether the content will flow from the customer website to the Localize back-end.

FeatureDefined InSent to Back End?
Exclude Phrases by CSS Classes and IDsDashboardNo
Blocked CSS classes and IDsHTML: Initialize callNo
Block New Phrases by PatternDashboardYes (1)
Defined Variable PhrasesDashboardYes (2)
Disable Localize by PageDashboardNo
Disable Phrase Detection By PageDashboardYes (1)
User input fields in a FormHTMLNo
notranslate attributeHTMLNo
<var> tagsHTMLNo

(1) The phrase is detected on the front end and sent to the back end, where it’s rejected.

(2) The initial phrases are sent to the back end before the variable is defined in the dashboard. Once the variable is defined, new phrases won’t be sent from the front end. However, the data for the phrase used to define the variable phrase in the dashboard IS stored in the Localize database.