Documentation/GDPR Cookie Consent/Translating GDPR Cookie Consent Plugin with WPML

Translating GDPR Cookie Consent Plugin with WPML

GDPR Cookie Consent plugin is compatible with some of the most common multilingual plugins like WPML, Polylang, qTranslateX etc. In this article, we will share deep insight into how the GDPR Cookie Consent plugin can be translated into your desired language via WPML.

First of all, install and activate the WPML plugins. Next, configure it for the desired languages. Then, navigate to WPML > String Translations as shown below for customizations w.r.t the plugin:

WPML-String Translation

From the String Translation page that opens up, you will get an option to choose the Select strings with domain drop down. The Select strings with domain drop down consists of two options pertaining to the GDPR Cookie Consent plugin:

  • admin_text_CookieLawInfo-0.9: You can assign translations for all editable text content by selecting this domain.
  • admin_texts_cookielawinfo_privacy_overview_content_settings: To translate the privacy overview text content, you can select this domain.
  • cookie_law_info: You can assign translations for non-editable content like the label, validation messages, pop-up content, etc. by selecting this domain.
Select strings within domain drop down

Case 1: For editable texts

On selecting admin_text_CookieLawInfo-0.9 from the Select strings within domain drop-down, the screen will be as shown below:

List of strings for translating

To translate the string Privacy and Cookie Policy follow the below steps.

  1. Click on the translations link, enter the translation text in respective languages as shown below:
Click on translations

Note: As per the above screenshot, Danish (da), French (fr), and German (de) are the configured languages in WPML.

For example, 

  • Privacy and Cookies Policy-da for danish translation.
  • Privacy and Cookies Policy-fr for french translation. 
  • Privacy and Cookies Policy-de for the german translation.

That is, instead of Privacy and Cookies Policy text, its translated text will be displayed in the GDPR cookie consent plugin.

Once done, tick the Translation is complete checkbox. And then, click on the Save button.

Now switch the language option on your website to see the changes. On switching the language to Danish, you can see that the Privacy and Cookie Policy widget will be as shown below:

Privacy and Cookie Policy in Danish

However, to translate the content of the privacy overview, you will have to select  admin_texts_cookielawinfo_privacy_overview_ content_settings domain from the Select strings within domain drop-down, the screen will be as shown below:

Case 2: For labels, validation messages, pop-up content

On selecting cookie_law_info domain from the Select strings within domain drop-down, the screen will be as shown below:

String translation

Let us see translation steps for Cookie message – Text editor.

  • Click on the translations link, enter the translation text in respective languages as shown below:
Cookie message-text editor translated

Note: As per the above screenshot, Danish (da), French (fr), and German (de) are the configured languages in WPML.

For example, 

  • Cookie message – Text editor (Danish)  for danish translation.
  • Cookie message – Text editor (French) is for french translation
  • Cookie message – Text editor (German) is for the german translation.

This is, instead of Cookie message – Text editor text, its translated text will be displayed in the GDPR cookie consent plugin.

Once done, tick the Translation is complete checkbox. Click on Save button.

On switching the language to Danish, you can see that the Cookie message-text editor will be as shown below:

Cookie message-text editor translated

Note:

  1. Switch the profile language to the desired language for better results.
  2. If you can’t find the string for translation in the select string domain menu, then probably you will have to scan the strings. To scan for the strings, go to WPML > Themes and plugin localization. From the screen, navigate to the section Strings in the plugins. Select the GDPR Cookie consent plugin from the list and click on Scan selected plugins for strings button as shown below.
WPML-Theme and Plugins localization

At the end of scan, all the strings in the plugin will be auto-populated into the String Translation domain, further to which you can make the necessary translations as mentioned at the beginning of this article.

Now that you have set up everything else in the plugin, you will find that in the script blocker settings, you can only select one category and switching to the other one is overwriting the changes you made in first language. To over come this, you need to make the slug of the each category and their translated categories, the same.

Go to the cookie category page, you may switch the language from the language selection above the category list as shown below.

You can use the Quick Edit button in the cookie category listing page to edit the slug and enter the same slug as in the other language. You won’t be able to do it from the All Languages section due to WordPress limitations.

For instance, if necessary is the slug, click on quick edit section and specify the same slug as in the other language.

Once you have specified the slug same, you will need to choose the category in one language only under script blocker. Also, setting the slug as “necessary” in both languages will make both categories strictly enabled.

Refer to know how the cookie plugin is translated using Polylang.

  • Was this article helpful?
  • YesNo