Translating Dynamic Strings with LocoTranslate

Guide to Adding and Translating WPLoyalty Dynamic Strings with Loco Translate

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

Step 1: Understanding Dynamic Strings

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

Step 2: Why the WPLoyalty - Multi-Lingual Compatibility - Dynamic Strings Addon Plugin was Developed

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.

To install the add-on, follow these steps:

  1. Go to your WordPress dashboard -> Plugins -> Add New

  1. Click on the "Upload Plugin" button on the top.

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

  1. Click Install now and Activate plugin.

  2. After activation, you can access the add-on by navigating to WPLoyalty -> Add-ons -> "WPLoyalty - Multi-Lingual Compatibility - Dynamic Strings” add-on plugin.

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

Step 4: Installing and Setting Up LocoTranslate:

To learn about how to install and set up LocoTranslate, please click here.

Step 5: Adding Dynamic Strings to the wp-loyalty-rules.pot File:

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.

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

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.

(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."

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

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:

Example 1: Translating Campaign title "Earn 1 Point for every $10 Spent"

For a detailed step-by-step procedure on creating a Campaign, please refer to the documentation.

  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.

Now, we have successfully translated the campaign title to French.

Example 2: Translating string from Launcher: "Hello {wlr_user_name}"

Search for the string "Hello {wlr_user_name}" in the search bar, enter the transtlated string in French and save it.

Here is the screenshot of Launcher in French:

Now, we have successfully translated one of the Launcher string to French.

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

Note:

Video:

For translating Campaign title:

Still unclear ? Please submit a support request. We are always happy to assist you :)

Last updated