﻿#### Translating Content in Sitecore Personalize Experiences and Experiments 

If you're tackling this topic, you're likely dealing with the following:

- - Your website utilizes **Sitecore Personalize**,
- - It's **multilingual**,
- - You're tasked with developing an **Experiment** or **Experience**,
- - You aim to present Experiment/Experience results in **the appropriate language** for each user.

It's common for some to create distinct Experiences for different languages. However, this method scatters the data, which undermines the core purpose of Experiments — collecting valuable metrics, meeting goals, and validating hypotheses; and Experiences — to evaluate their effectiveness. Therefore, creating separate versions for each language isn't ideal.

I'll outline a straightforward method employed in a real-world project, demonstrating how this can be achieved directly within **Sitecore Personalize** without relying on third-party services.

For ease of understanding, let’s explore how to translate content for a **Web Experience** *(the same steps apply to an Experiment or Interactive Experience)*. Suppose there's a need for a popup on a webpage that shows text either in English or Arabic based on the site's contextual language:

![Sitecore Personalize - Popup in English](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/offer-ui-en.png)
![Sitecore Personalize -  Popup in Arabic](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/offer-ui-ar.png)

Here's how we handle content translation:

#### 1. Offer Templates

In **Sitecore Personalize**, an *Offer* is an entity similar to a standard Sitecore item, and an *Offer template* is like a Sitecore template. By creating an *Offer template* with necessary fields, we can produce two *Offers* from it - one in English and one in Arabic.

Create a new Offer template:

![Sitecore Personalize - Create new Offer template](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/offer-template.png)

Create a new Offer in English:

![Sitecore Personalize - Create english offer](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/offer-en.png)

Create a new Offer in Arabic:

![Sitecore Personalize  - Create arabian offer](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/offer-ar.png)

The challenge is connecting these *Offers* to a **Web Experience**.

#### 2. Decision Models

A **Decision Model** will link our offers to a **Web Experience**. The workflow is as follows:

- - The **Web Experience** executes the **Decision Model**,
- - The Decision Model **identifies the context language** and provides the **appropriate language Offer**,
- - Values from the Offer **substitute into the popup template**.

Let's set up a **Decision Model** - it’s relatively easy:

![Sitecore Personalize  - Create decision model](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/decision-model.png)

The contextual language in a **Decision Model** can be identified through many options:

- - The current session language,
- - Request parameters,
- - The segment of current URL *(if your site URL consistently has language segments)*.

After determining the contextual language, we select the corresponding language *Offer* in *Decision table*:
 
![Sitecore Personalize  - Decision table](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/decision-model-offers.png)

The last step is to configure the **Web Experience** accordingly.

#### 3. Web Experience

First, we need to connect our **Decision Model** to the **Web Experience**:

![Sitecore Personalize  - Decision model in Web experience](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/web-experience-connect-decision-model.png)

Next we need to configure **Experiment variants**. *API response* of variant should be the following: 

```

{
<#if (offers)??="">
  "decisionOffers": ${toJSON(offers)}
</#if>
}
```

*HTML markup* of variant should be the following *(field names must be the same as offer field names)*: 

```

{{#decisionOffers}}
  {{#attributes}}

<div id="pers-modal_overlay">
  <div id="pers-modal_overlay-content" class="pers-modal_content">
    <h3>[[ SubTitle Text | string | {{SubTitle_Text}} | { required: true, group: Title, groupOrder: 2, order: 1 } ]]</h3>
    <h2>[[Title | string | {{Title_Text}} | {required:true, group: Title, order: 1}]]</h2>
   
    <p class="descriptionText">
       [[ Description Text | text | {{Description_Text}} | {required: true, group: Description, groupOrder: 3, order: 1 }]]
    </p>
    <div class="pers-modal_button-wrapper">
      <a href="/{{lang}}/login" class="pers-modal_button">
      [[ Button title | string | {{Button_Text}} | {required:true, group: Button, groupOrder: 4, order: 1 }]]
      </a>
    </div>
   
  </div>
</div>

    {{/attributes}}
{{/decisionOffers}}
```

And that`s all! If you switch to the preview mode, you should see your experience in  following *"placeholders"* styling:

![Sitecore Personalize  - Decision model in Web experience](https://www.brimit.com/-/media/images/blog/cdp/personalization-translate-content/web-experience-ui-placeholders.png)

#### Conclusion

With globalization, delivering localized content is crucial. **Sitecore Personalize`s** decision models with offers empower businesses to streamline and refine the translation process, ensuring personalized and culturally relevant user experiences. By utilizing data-driven insights and real-time decisions, businesses can bolster their global presence and forge deeper connections with diverse users.

###### Author

[!\[sergey-200\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/sergey-200.jpg?h=197&amp;iar=0&amp;w=200&amp;hash=0D636570F87F1C13C39E06EB19D9DF06)
Sergey Baranov
Sitecore MVP/ Senior Sitecore Developer](https://www.brimit.com/blog/author?authors=Sergey%20Baranov)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=f82478b8-be9b-4961-ab57-1e1f037cef43&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=Sitecore%20Personalize%20-%20Translating%20Content%20in%20Experiences%20and%20Experiments&amp;kw=sitecore%20CDP,%20personalize&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fcdp-personalize-content-translation&amp;r=&amp;lt=492&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=36320)