Articles on: Frequently Asked Questions (FAQ)

GTranslate - How to translate the consent bar?

If you are using a premium version of the GTranslate app for translation, you will need to do an additional configuration on your end in order to make it work with our Consentmo GDPR app. Below you will find instructions on what exactly you would need to do:

Open Shopify Admin.
Click on Online Store link in the left menubar.
Click on the Actions dropdown button and select Edit Code from there.
A new page will open with a list of files on the left side of the screen. Open the theme.liquid file.
Find the string </head> in there.
When you do, add the following snippet before </head>:

{%- assign privacy\_policy\_text = shop.metafields.consentbar\_text\["privacy\_policy\_text"\] -%}
{%- assign accept\_button\_text = shop.metafields.consentbar\_text\["accept\_button\_text"\] -%}
{%- assign reject\_button\_text = shop.metafields.consentbar\_text\["reject\_button\_text"\] -%}
{%- assign change\_cookies\_text = shop.metafields.consentbar\_text\["change\_cookies\_text"\] -%}
{%- assign text = shop.metafields.consentbar\_text\["text"\] -%}
{%- assign strict\_cookies\_checkbox = shop.metafields.preferences\_text\["strict\_cookies\_checkbox"\] -%}
{%- assign strict\_cookies\_text = shop.metafields.preferences\_text\["strict\_cookies\_text"\] -%}
{%- assign analytics\_cookies\_checkbox = shop.metafields.preferences\_text\["analytics\_cookies\_checkbox"\] -%}
{%- assign analytics\_cookies\_text = shop.metafields.preferences\_text\["analytics\_cookies\_text"\] -%}
{%- assign marketing\_cookies\_checkbox = shop.metafields.preferences\_text\["marketing\_cookies\_checkbox"\] -%}
{%- assign marketing\_cookies\_text = shop.metafields.preferences\_text\["marketing\_cookies\_text"\] -%}
{%- assign functionality\_cookies\_checkbox = shop.metafields.preferences\_text\["functionality\_cookies\_checkbox"\] -%}
{%- assign functionality\_cookies\_text = shop.metafields.preferences\_text\["functionality\_cookies\_text"\] -%}
{%- assign popup\_header = shop.metafields.preferences\_text\["popup\_header"\] -%}
{%- assign dismiss\_button\_text = shop.metafields.preferences\_text\["dismiss\_button\_text"\] -%}
{%- assign accept\_selected\_button\_text = shop.metafields.preferences\_text\["accept\_selected\_button\_text"\] -%}
{%- assign accept\_all\_button\_text = shop.metafields.preferences\_text\["accept\_all\_button\_text"\] -%}
{%- assign reject\_all\_button\_text = shop.metafields.preferences\_text\["reject\_all\_button\_text"\] -%}
{%- assign data\_collection\_text = shop.metafields.preferences\_text\["data\_collection\_text"\] -%}
  <script type="text/javascript">
var final\_JSON = {
"all\_txt": {
"privacy\_policy\_text": "{{ privacy\_policy\_text | replace: '"' , '\\"' }}",
"accept\_button\_text": "{{ accept\_button\_text | replace: '"' , '\\"' }}",
"reject\_button\_text": "{{ reject\_button\_text | replace: '"' , '\\"' }}",
"change\_cookies\_text": "{{ change\_cookies\_text | replace: '"' , '\\"' }}",
"text": "{{ text | replace: '"' , '\\"' }}",
"strict\_cookies\_checkbox": "{{ strict\_cookies\_checkbox | replace: '"' , '\\"' }}",
"strict\_cookies\_text": "{{ strict\_cookies\_text | replace: '"' , '\\"' }}",
"analytics\_cookies\_checkbox": "{{ analytics\_cookies\_checkbox | replace: '"' , '\\"' }}",
"analytics\_cookies\_text": "{{ analytics\_cookies\_text | replace: '"' , '\\"' }}",
"marketing\_cookies\_checkbox": "{{ marketing\_cookies\_checkbox | replace: '"' , '\\"' }}",
"marketing\_cookies\_text": "{{ marketing\_cookies\_text | replace: '"' , '\\"' }}",
"functionality\_cookies\_checkbox": "{{ functionality\_cookies\_checkbox | replace: '"' , '\\"' }}",
"functionality\_cookies\_text": "{{ functionality\_cookies\_text | replace: '"' , '\\"' }}",
"popup\_header": "{{ popup\_header | replace: '"' , '\\"' }}",
"dismiss\_button\_text": "{{ dismiss\_button\_text | replace: '"' , '\\"' }}",
"accept\_selected\_button\_text": "{{ accept\_selected\_button\_text | replace: '"' , '\\"' }}",
"accept\_all\_button\_text": "{{ accept\_all\_button\_text | replace: '"' , '\\"' }}",
"reject\_all\_button\_text": "{{ reject\_all\_button\_text | replace: '"' , '\\"' }}",
"data\_collection\_text": "{{ data\_collection\_text | replace: '"' , '\\"' }}",
"gt\_translate\_keys":\[{"key":"data\_collection\_text","format":"html"},
"privacy\_policy\_text",
"accept\_button\_text",
"reject\_button\_text",
"change\_cookies\_text",
"text",
"strict\_cookies\_checkbox",
"strict\_cookies\_text",
"analytics\_cookies\_checkbox",
"analytics\_cookies\_text",
"marketing\_cookies\_checkbox",
"marketing\_cookies\_text",
"functionality\_cookies\_checkbox",
"functionality\_cookies\_text",
"popup\_header",
"dismiss\_button\_text","accept\_selected\_button\_text","accept\_all\_button\_text","reject\_all\_button\_text"\]

}
};

window.isense\_gdpr\_privacy\_policy\_text = final\_JSON.all\_txt.privacy\_policy\_text;
window.isense\_gdpr\_accept\_button\_text = final\_JSON.all\_txt.accept\_button\_text;
window.isense\_gdpr\_reject\_button\_text = final\_JSON.all\_txt.reject\_button\_text;
window.isense\_gdpr\_change\_cookies\_text = final\_JSON.all\_txt.change\_cookies\_text;
window.isense\_gdpr\_text = final\_JSON.all\_txt.text;
window.isense\_gdpr\_strict\_cookies\_checkbox = final\_JSON.all\_txt.strict\_cookies\_checkbox;
window.isense\_gdpr\_strict\_cookies\_text = final\_JSON.all\_txt.strict\_cookies\_text;
window.isense\_gdpr\_analytics\_cookies\_checkbox = final\_JSON.all\_txt.analytics\_cookies\_checkbox;
window.isense\_gdpr\_analytics\_cookies\_text = final\_JSON.all\_txt.analytics\_cookies\_text;
window.isense\_gdpr\_marketing\_cookies\_checkbox = final\_JSON.all\_txt.marketing\_cookies\_checkbox;
window.isense\_gdpr\_marketing\_cookies\_text = final\_JSON.all\_txt.marketing\_cookies\_text;
window.isense\_gdpr\_functionality\_cookies\_checkbox = final\_JSON.all\_txt.functionality\_cookies\_checkbox;
window.isense\_gdpr\_functionality\_cookies\_text = final\_JSON.all\_txt.functionality\_cookies\_text;
window.isense\_gdpr\_popup\_header = final\_JSON.all\_txt.popup\_header;
window.isense\_gdpr\_dismiss\_button\_text = final\_JSON.all\_txt.dismiss\_button\_text;
window.isense\_gdpr\_accept\_selected\_button\_text = final\_JSON.all\_txt.accept\_selected\_button\_text;
window.isense\_gdpr\_accept\_all\_button\_text = final\_JSON.all\_txt.accept\_all\_button\_text;
window.isense\_gdpr\_reject\_all\_button\_text = final\_JSON.all\_txt.reject\_all\_button\_text;
window.isense\_gdpr\_data\_collection\_text = final\_JSON.all\_txt.data\_collection\_text;
</script>


Click on the Save button.
That's it!


Once you have added the code, all of the contents of the app should be translatable with the premium version of GTranslate.

Updated on: 12/01/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!