Sitecore Discover implementing multilingual attributes for product data feed

This post provides a detailed explanation of implementing multilingual attributes using locale-specific values in a feed file.

Recently I had a need for implementing multilingual attributes using locale-specific values in a feed file. For this I created localized attribute values in the product feed file. There are two approaches which we can choose from to specify localized attribute values in the feed file. We can either use locale (a combination of country and language) or we can specify languages. In our case we have used a combination of country and language for name attribute.

Steps for adding and configuring localized attribute values

1> Enable Locale for discover search domain. Locale can be found under Domain settings -> Locale. From here I added the required languages and countries and kept the Locale Identifier format as ${language}_${country}

2> Add the required attribute with placement as locale. According to our need I added
name_locale_en_us , name_locale_en_ca, name_locale_fr_ca
These will map to name attribute.

3> After this, I shared a list of locale specific attributes with Sitecore via a support ticket. This way, they can continue with necessary changes from their end.

4> I specified these localized attribute values in feed file with column name as (these will map to name column)
name_locale_en_us, name_locale_en_ca, name_locale_fr_ca

5> After all these configurations, upload the feed file through SFTP. Verify if the locale attributes have values under the “Feed File Details” in Discover.

Next step is to fetch locale specific text.

To fetch the locale specific text I had to pass locale_country and locale_language (these are required if set up with locale.) in the page object of “/search-rec” end point.

In the above POST query I have passed “ca” in locale_country, “fr” in locale_language to get the fr_ca text for the locale-specific attributes. Since, I have made name_locale_fr_ca as a locale-specific attribute, I got fr_ca text for the name column in the response.

References

https://doc.sitecore.com/discover/en/developers/discover-developer-guide/product-data-feed-specifications.html#locale-attributess

https://doc.sitecore.com/discover/en/developers/discover-developer-guide/the-event-type-and-event-name.html

Hope this will help someone.

Leave a comment