Home > Docs > GDPR Cookie Consent > String Translations in GDPR Cookie Consent Using WordPress Translation Plugins

String Translations in GDPR Cookie Consent Using WordPress Translation Plugins

Last updated on May 8, 2023

GDPR Cookie Consent plugin helps you make your WordPress website easily comply with the Cookie Law. It helps you display a notification bar on the website that notifies the users of the cookies used on a website. The users can then give their consent to the use of the cookies on the website.

The text displayed in the cookie bar by default is in English. This is not ideal for multilingual websites where people visit the pages of the website in multiple languages. Favorably, the GDPR Cookie Consent plugin is compatible with most of the popular translation plugins like the following:

qTranslate X is a popular free WordPress plugin that helps owners with the translation of their website’s content. This article describes how you can change the content of the cookie bar depending on the language of the website. If you have installed and activated the GDPR Cookie Consent plugin and qTranslate plugin on your website, read on to know how to translate the cookie notification bar.

How to translate the cookie message in the notification bar with qTranslate?

To translate the cookie message to be displayed on the front end, go to the admin side of your website and navigate to GDPR Cookie Consent > Cookie Law Settings. From the Cookie Law Settings page, go to the Customise Cookie bar tab.

From the Message text area, add the message of the cookie notice that you want to display. Now to change the message of the cookie according to the selected language of the website, what you need to do is add the translated message in the same text area and encode the message with their corresponding language code.

There are three different ways with which the text can be encoded. They are as given below.

  1. Square bracket encoding '['. For example, [:en]Message text[:]
  2. Swirly bracket encoding '{'. For example, {:en}Message text{:}
  3. Comment encoding '<'. For example, <–:en–>Message text<–:–>

Where ‘en’ is the language code for English.

The below screenshot shows how this is done for a website with two languages – English and German. The cookie message text area contains messages in both languages encoded within corresponding language codes.

Cookie-Bar-Message-String-Translations

To translate the other strings in the cookie bar, the same approach can be used. For example, to translate the Accept button to the selected language, encode the button text within the corresponding language code and the translation as shown in the screenshot below.

Cookie-Bar-Text-String-Translations
Website in English

So when the site is viewed in different languages, the content in the message bar also changes accordingly. The below screenshot shows the website viewed in English and cookie message also in English.

The below screenshot shows the website viewed in German and the cookies bar message also in the selected language.

Website in German

The GDPR Cookie Consent plugin can be found here.

If you have any question/issues regarding the plugin, you can contact our support team here.