String Translations in GDPR Cookie Consent Using WordPress Translation Plugins

The Ultimate WordPress Plugin for EU Cookie Law (GDPR) Compliance

Used by 400,000+ WooCommerce Stores

#1 in Customer Satisfaction

WebToffee Guarantee: Get Your Money Back if You Are Not Satisfied With The Product

Buy Now!

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 in 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 it is very easy to translate the contents created by the plugin.

qTranslate X is one such 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 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.

Two languages added for the cookie message

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.

Translating buttons on the cookie bar

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.Website in English

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

Website in German

Leave a Reply

Your email address will not be published. Required fields are marked *