If your store offers multi-language support, you can adjust the Stamped main widget elements to accommodate various languages. Follow this guide to learn more!
Key Notes
- This guide assists in changing the language of the widget elements only. Your reviews will still appear in the language originally submitted; changing the language of the actual reviews requires integration with a translation app, such as Langify or Weglot
- This feature is only available to Shopify users
In This Guide
Overview
🚨 Our previous variable, {{ shop.locale }}, has been depreciated. If you are still using this variable in your multi-language setup, we encourage you to update it with the new variable below!
In order to change the widget language dynamically, we utilize the liquid variable
{{ request.locale.iso_code }} to set the widget language as per the value returned by this liquid variable. The value returned from this variable is typically a two-letter ISO code from the theme. For example, 'FR' for France and 'JP' for Japan.
Updating the widget for Shopify 2.0 themes
If your main widget was added via the block method (most Shopify 2.0 themes), you'll need to either replace this with a custom liquid block so you can add the code manually (below), or remove the block and add the Stamped code directly to your theme files. Visit our installation guide here for instructions.
Updated attribute: data-widget-language = {{ request.locale.iso_code }}
Here is what your final main widget code will look like with the updated attribute:
<div id="stamped-main-widget" data-widget-style="standard" data-product-id="{{ product.id }}" data-name="{{ product.title | escape }}" data-url="{{ shop.url }}{{ product.url }}" data-image-url="{{ product.featured_image | product_img_url: "large" |replace: '?', '%3F' | replace: '&','%26'}}" data-description="{{ product.description | escape }}" data-product-sku="{{product.handle}}" data-product-type="{{product.type}}" data-widget-language ="{{ request.locale.iso_code }}"> </div>
Updating the widget for Shopify vintage themes
If your main widget was added via code to your theme files, find it and adjust the data-widget-language attribute as seen below to include the variable = {{ request.locale.iso_code }}:
Updated attribute: data-widget-language = {{ request.locale.iso_code }}
Here is what your final main widget code will look like with the updated attribute:
<div id="stamped-main-widget" data-widget-style="standard" data-product-id="{{ product.id }}" data-name="{{ product.title | escape }}" data-url="{{ shop.url }}{{ product.url }}" data-image-url="{{ product.featured_image | product_img_url: "large" |replace: '?', '%3F' | replace: '&','%26'}}" data-description="{{ product.description | escape }}" data-product-sku="{{product.handle}}" data-product-type="{{product.type}}" data-widget-language ="{{ request.locale.iso_code }}"> </div>
Related to