Translating the Main Widget Language

  • Updated

If your store offers multi-language support, you will need to adjust the Stamped Main Widget to showcase reviews in various languages. This article covers how to update your widgets to show different languages.

This functionality is only available to Shopify users.


In This Guide


Updating the Widget code

**Note {{ shop.locale }} is being depreciated, this was the prior variable being used. If you have a setup using this variable we encourage you to update it soon as seen below. 

In order to change the widget language dynamically, we utilize a liquid variable in Shopify which is {{ request.locale.iso_code }} and add an extra attribute in the widget code to set the widget language as per the value returned by this liquid variable. The value returned from this variable is actually a two-letter ISO code from the theme. For E.g.- 'FR' for France and 'JP' for Japan.

Note: This attribute will only change the language of the widget's elements. The reviews will still appear in the language originally submitted, changing it would require integration with a translation app, such as Langify or Weglot.

Attribute to update: 

data-widget-language = {{ request.locale.iso_code }}

Final Main widget code:

<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>

Was this article helpful?

1 out of 10 found this helpful

Have more questions? Submit a request