Skip to content

Designate an area as a translation block

How to designate an HTML element or a group of elements as a block to allow more precise translations.

If you come across an issue where a paragraph or a section of content is not being properly translated, there is a way to designate an element or a group of elements as a standalone translation block. Here are some issues you may come across that would require this fix:

  • XNUMX showing up in the content
  • Areas that aren’t marked as editable
  • Areas that when altered affect other translations on the same page or other pages. Example: Job titles. In French, titles are masculine and feminine. If 2 people on the same page have the same title, one male, one female, editing one will affect the others.

Here are some options to fix these issues.

Adding the “block-edit-exception” Class

The first option is to add the “block-edit-exception” class to the element to the a group of elements that should be edited as a block. This can be done in the templates or in WordPress depending where the content is.

Define Your Own Class and Update Settings in GTranslate

If the content is within an HTML tag that has a unique name or ID, you can simply add that CSS selector in the GTranslate settings. For example, the team member blocks already have their own unique class called “vc-leadership-team__member”. To get GTranslate to recognize those team member areas as block, you would follow these steps:

1) Log in to GTranslate.

2) Navigate to “Settings” and then click on the “Advanced Settings” tab.

3) Under the “Define HTML Blocks Using CSS” section. Add your CSS selector to the list. Each selector needs to be separated by a comma. You can use any valid CSS selector including a combination of IDs and classes.

***If you are not familiar with CSS selectors, please place a service request with IT. Adding a selector that inadvertently affects more items than it should have could have a negative impact on the translated sites.

4) Click the “Save” button below.

It takes a few minutes for the change to take effect. You may also need to clear your cache. Once GTranslate recognizes the block, you should see a blue square next to a pencil icon. When hovering over that square icon, you should see the entire block highlighted.