Translating Dynamic Strings with LocoTranslate
Guide to Adding and Translating WPLoyalty Dynamic Strings with Loco Translate
Last updated
Guide to Adding and Translating WPLoyalty Dynamic Strings with Loco Translate
Last updated
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:
Go to your WordPress dashboard -> Plugins -> Add New
Click on the "Upload Plugin" button on the top.
Use the Browse option and add the downloaded wp-loyalty-translate addon plugin zip file.
Click Install now and Activate plugin.
After activation, you can access the add-on by navigating to WPLoyalty -> Add-ons -> "WPLoyalty - Multi-Lingual Compatibility - Dynamic Strings” add-on plugin.
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:
Go to LocoTranslate -> Plugins -> select the "WPLoyalty - Woocommerce Points, Rewards and Referral plugin".
Look for the "Edit Template" option and click on it.
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:
Go to Loco Translate -> Plugins and select "WPLoyalty - Woocommerce Points, Rewards and Referral plugin."
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."
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.
Navigate to Loco translate -> Plugins -> choose the "WPLoyalty - Woocommerce Points, Rewards and Referral plugin."
Click on the "Edit" option.
Search for the dynamic string "Earn 1 Point for every $10 Spent" in the search bar.
Click on the translation box next to the string and enter the translated string.
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:
This "Multi-Lingual Compatibility - Dynamic Strings" addon is exclusively available for WPLoyalty users. This add-on is provided at no cost to users of WPLoyalty plugin.
Video:
For translating Campaign title:
Still unclear ? Please submit a support request. We are always happy to assist you :)