Translating GDPR Cookie Consent plugin with Polylang
GDPR Cookie Consent plugin is compatible with some of the most common multilingual plugins like Polylang, WPML, 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 Polylang.
Refer Translating GDPR Cookie consent plugin with WPML to know how the cookie plugin is translated using WPML.
Once the Polylang plugin is installed and activated, you need to first configure it for the desired languages. Once the languages have been set up, navigate to Languages > String Translations as shown below for customizations w.r.t the plugin:
From the String Translation page that opens up, filter the group by selecting webtoffee_gdpr_cookie_consent from the drop down as shown below:
Note: In this case, the language is switched to French prior to translating the strings of GDPR cookie consent plugin.
For instance, let us see how the string on the Accept button is translated into French.
The string on Accept button is changed to Accept in French indicating the translated text in French. On loading the website, the cookie accept button will be as shown below:
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 language will make both categories strictly enabled.