# Translating Dynamic Strings with LocoTranslate

In this guide, we will walk through the following steps in detail:

**Step 1:** **Understanding Dynamic Strings**&#x20;

We'll define dynamic strings as strings that are added dynamically by users, such as campaign titles/descriptions and strings from the Launcher widget etc..,&#x20;

**Step 2: Why the WPLoyalty - Multi-Lingual Compatibility - Dynamic Strings Addon Plugin was Developed**&#x20;

Initially, dynamic strings were missing from the translation table of LocoTranslate. To address this issue, we created an add-on plugin called Multi-Lingual Compatibility - Dynamic Strings. With this plugin, adding dynamic strings to the translation table of LocoTranslate is easy, and translation can be done in just a few clicks, streamlining the process.

**Step 3: Installing the WPLoyalty - Multi-Lingual Compatibility - Dynamic Strings Addon Plugin:**

[**Click here to download the Multi-Lingual Compatibility - Dynamic Strings add-on.** ](https://wployalty.net/add-ons/multi-lingual-compatibility/)

To install the add-on, follow these steps:

1. Go to your WordPress dashboard -> Plugins -> Add New&#x20;

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FAjy0LhWfnclGzgJYmqYn%2Fspaces_S9c8SKH3fobHhx7SjaLW_uploads_NS1Vq2CS4NvuwirU5y80_image.webp?alt=media&#x26;token=a8ed212f-82f6-4efe-9d76-0732f61285df" alt=""><figcaption></figcaption></figure>

2. Click on the "Upload Plugin" button on the top.&#x20;

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FI4NRBWDdmvbHe70Ug50Q%2Fspaces_S9c8SKH3fobHhx7SjaLW_uploads_HIGGLLi6e4O4I2MN2ZtE_image.webp?alt=media&#x26;token=43cd8f93-4c4d-49f2-8681-52965d83c352" alt=""><figcaption></figcaption></figure>

3. Use the Browse option and add the downloaded wp-loyalty-translate addon plugin zip file.

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FrnA5dDBbJudotRzCaTvT%2Fscreenshot-localhost-2023.01.18-21_01_50.png?alt=media&#x26;token=ad9374b3-2065-477c-a4fa-198960f7073b" alt=""><figcaption></figcaption></figure>

4. Click Install now and Activate plugin.
5. After activation, you can access the add-on by navigating to WPLoyalty -> Add-ons -> "WPLoyalty - Multi-Lingual Compatibility - Dynamic Strings” add-on plugin.

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FOB5WSwKj3NqBde1pBro9%2Fscreenshot-localhost-2023.08.20-20_35_57.png?alt=media&#x26;token=d5d40c23-48a2-4ffa-a363-00af817a9e5c" alt=""><figcaption></figcaption></figure>

6. If you click on the “**Open**” option this will be the dashboard of Multi-Lingual Compatibility - Dynamic Strings Add-on plugin.

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FYyApsOBceN4OecGQ1I3r%2Fscreenshot-localhost-2023.08.20-20_37_53.png?alt=media&#x26;token=34492d66-adfe-40bf-a844-d81bb145ea2d" alt=""><figcaption></figcaption></figure>

**Step 4: Installing and Setting Up LocoTranslate:**&#x20;

[To learn about how to install and set up LocoTranslate, please click here. ](https://docs.wployalty.net/translating-wployalty/using-locotranslate)

**Step 5: Adding Dynamic Strings to the wp-loyalty-rules.pot File:**&#x20;

After installing LocoTranslate, follow these steps:

1. Go to LocoTranslate -> Plugins -> select the "WPLoyalty - Woocommerce Points, Rewards and Referral plugin".
2. Look for the "Edit Template" option and click on it.

<figure><img src="https://lh4.googleusercontent.com/xYe2vw_HGp6YC42L422cqgBRXH3-K3xZ_7yAN_qA1a3KniLbPRl0gVR5nbAny1iFbK6-HIiuxLf_CxjswEgaI2j7Z25ycxtrvvvPxB_sQ1CCnkQ7twf7jM3UW1Q40GLunvM59dYNueXMDKl96BeH6n42zCjhamhENvkL2XXDGdmSoDeVjdH7C01ZHYKWvQ" alt=""><figcaption></figcaption></figure>

3. You will be directed to the "wp-loyalty-rules.pot" file. Click on the "**Sync**" option to automatically add the dynamic strings to the translation table. Remember to save the changes.

<figure><img src="https://lh6.googleusercontent.com/32JBKXP8g9JgqaKQWFm1jeAQ1_juEmIFLGNR9hAVPLJUFSRL8ccMrJ7cX3ZQTidwZu9Difzam_znmvmdP8LB6Kv3HtKmWyZFyAtjF_SN05meaFjWyRiJVYJ35K-mZdam5vUNz4ITOEhKTTacMSKckrEd9qEwB0cDzRbkVIcmXogyx5-RRvQz5QoNAVTbDg" alt=""><figcaption></figcaption></figure>

**Step 6: Synchronizing strings from wp-loyalty-rules.pot file to wp-loyalty-rules-fr\_FR.po file:**

1. Go to Loco Translate -> Plugins and select "WPLoyalty - Woocommerce Points, Rewards and Referral plugin."
2. Look for the "**Edit**" option.&#x20;

(**Note**: As we have already translated the strings for French by following the above steps, the file "wp-loyalty-rules-fr\_FR.po" is displayed). Click on "Edit."

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FlzEAJ2NTlGAzFAOdZFZs%2Fscreenshot--2023.01.19-17_12_32.png?alt=media&#x26;token=c02942c9-201f-4357-9fe5-df16fdb5c10d" alt=""><figcaption></figcaption></figure>

3. Next, you will be directed to the French .po file. Click on the "**Sync**" button located here as well.

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FS3GOI2geBVahhKl1c4TJ%2Fscreenshot-localhost-2023.01.19-17_22_44.png?alt=media&#x26;token=528e831f-cb15-4480-865a-e4a475584aa6" alt=""><figcaption></figcaption></figure>

After syncing the dynamic strings to the translation table, you can easily search for the strings and begin translating them.

**Step 7: Translating the dynamic strings:**&#x20;

**Example 1: Translating Campaign title "Earn 1 Point for every $10 Spent"**&#x20;

[For a detailed step-by-step procedure on creating a Campaign, please refer to the documentation.](https://docs.wployalty.net/campaign-types/points-for-purchase)

<figure><img src="https://lh3.googleusercontent.com/9JfQaFdxgc7uKyvdfzyLjOWfDC8BXSzl96JiONPT2Y1yaakl7FE7HPHn8s_mAf9UrHDI1YIn399zcq52r7QwyxStyCZ4lqgaEy3NZKnuvhBxBENoPuHUKK0MSXexo2muHmPZY1tsIFscwFzuxb5nfTgeX9opU_aCr_3eU_oIVMonJpypB6XR9_appIUbjw" alt=""><figcaption></figcaption></figure>

1. Navigate to Loco translate -> Plugins -> choose the "WPLoyalty - Woocommerce Points, Rewards and Referral plugin."
2. Click on the "Edit" option.
3. Search for the dynamic string "Earn 1 Point for every $10 Spent" in the search bar.
4. Click on the translation box next to the string and enter the translated string.
5. Click on the "Save" button to save the translated string.

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2F9aV0ZnuFKFnNtqr1B1sv%2Fscreenshot-localhost-2023.01.19-17_52_59.png?alt=media&#x26;token=6c92318e-d9e7-44be-84f9-a0a40b849fd8" alt=""><figcaption></figcaption></figure>

Now, we have successfully translated the campaign title to French.&#x20;

**Example 2: Translating string from Launcher: "Hello {wlr\_user\_name}"** &#x20;

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2FYVenlVHdIXawnFAC7PV0%2Fimage.png?alt=media&#x26;token=571af8f5-9ccb-4415-a8c9-38a567b01cc3" alt=""><figcaption></figcaption></figure>

Search for the string "**Hello {wlr\_user\_name}**" in the search bar, enter the transtlated string in French and save it.&#x20;

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2F5SlodX6OD8EhoYAEqATl%2Fimage.png?alt=media&#x26;token=53961d2d-0e4d-4a1f-9480-7e83eb48b790" alt=""><figcaption></figcaption></figure>

**Here is the screenshot of Launcher in French:**

<figure><img src="https://103140889-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS9c8SKH3fobHhx7SjaLW%2Fuploads%2F5Xm8hOeoUv7J3k0fFjAu%2Fimage.png?alt=media&#x26;token=af3a8b6c-5a72-4cc0-93ad-bd69587a7893" alt=""><figcaption></figcaption></figure>

Now, we have successfully translated one of the Launcher string to French.&#x20;

In the same way, we could search for any variable strings and translate them.

**Note:**&#x20;

* This "[**Multi-Lingual Compatibility - Dynamic Strings**](https://wployalty.net/add-ons/multi-lingual-compatibility/)" addon is exclusively available for WPLoyalty users. This add-on is provided at no cost to users of WPLoyalty plugin. &#x20;

**Video:**&#x20;

**For translating Campaign title:**&#x20;

{% embed url="<https://youtu.be/IuqpAmBVKnU>" %}

Still unclear ?\
Please submit a [support request](https://wployalty.net/support/). We are always happy to assist you :)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wployalty.net/translating-wployalty/translating-dynamic-strings-with-locotranslate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
