Translate dynamic strings via Loco Translate

Learn how to add dynamic strings of WPLoyalty to the translation table of Loco Translate and how to translate it.
Let’s see what is a dynamic string ?
Dynamic strings are strings that are added dynamically by users.
For example: Campaign Title/ Description.
Since these strings are added dynamically while creating Campaigns/ Rewards, they cannot be found in WPLoyalty plugin .POT file and they won’t be listed in Loco translate -> Translation Table.
Screenshot of Translation Table:
Why we developed WPLoyalty - dynamic string translation addon plugin ?
At first, dynamic strings will be missing from Translation table of Loco Translate.
Since dynamic strings are missing, we can't translate it. To overcome this scenario, we have developed an add-on plugin called Dynamic String Translation.
Using this add-on, we can add Dynamic strings to the string/ translation table of LOCO translate and translate it in just a few clicks. This addon will help you to simplify the process of adding dynamic strings.
Installation of WPLoyalty - dynamic string translation addon plugin:
To install the downloaded Dynamic String Translation add-on:
  1. 1.
    Go to your WordPress dashboard -> Plugins -> Add New
2. Click on the "Upload Plugin" button on the top.
3. Use the Browse option and add the downloaded wp-loyalty-translate addon plugin zip file.
4. Click Install Now.
5. Finally, click the Activate Plugin button.
6. Now, the dynamic translation addon is installed and activated successfully.
7. Once done, you will be able to view the add-on from: WPLoyalty -> Add-ons -> "WPLoyalty - dynamic string translation” add-on plugin.
8. If you click on the “Open” option this will be the dashboard of Dynamic String Translation Add-on plugin.
Setting up Loco Translate:
1. After installation, navigate to Loco translate -> Plugins -> choose the "WPLoyalty - Woocommerce Points, Rewards and Referral plugin".
2. While clicking “New language” you will see a list of languages.
3. From here, select your language you are trying to translate strings to and choose the Location as “System” and click on start translating button.
4. Now, we can see that a .po file “wp-loyalty-rules-fr_FR.po” for French has been created in loco translate.
Adding Dynamic Strings to Translation table using the add on “Dynamic String Translation” :
Let’s see how to add Campaign title to string table via this add-on and translate it.
Campaign title/ name - is the title we are giving while creating Campaign.
Now, the string we are going to add to the translation table is "Earn 1 Point for every $10 Spent"
1. Navigate to Loco translate -> Plugins -> choose the "WPLoyalty - Woocommerce Points, Rewards and Referral plugin".
2. You can find an "Edit Template" option. Click on it.
3. You will be taken to the “wp-loyalty-rules.pot” file. Here click on the “Sync” option. So that the dynamic strings like Campaign title will get added to translation table automatically and save it.
4. After saving it, search for the string "Earn 1 Point for every $10 Spent" in “wp-loyalty-rules.pot” file of loco translate.
As you can see, the dynamic string Campaign title "Earn 1 Point for every $10 Spent" has been added to string table successfully.
Translating the added dynamic string "Earn 1 Point for every $10 Spent" via Loco Translate:
1. Navigate to Loco translate -> Plugins -> choose the "WPLoyalty - Woocommerce Points, Rewards and Referral plugin".
2. You can find an "Edit" option.
(Note: Since we have already translated strings for French by following above steps the below file wp-loyalty-rules-fr_FR.po is showing).
Click on the "Edit" option.
3. Now, you will be taken to the .po file of "wp-loyalty-rules-fr_FR.po" for French. Click "Sync" button here too.
So that the strings from "wp-loyalty-rules.pot" will be added to the "wp-loyalty-rules-fr_FR.po" of loco translate by the add-on Dynamic String Translation.
4. Now, search for the string "Earn 1 Point for every $10 Spent" from the .po file of "wp-loyalty-rules-fr_FR.po"
  • While Syncing and saving strings from wp-loyalty-rules.pot file of Loco translate, all dynamic strings like Campaign Title/ Description, Rewards Title/ Description and Strings from Launcher Widget will get added to wp-loyalty-rules.pot file in an one go.
  • If we change any text from Launcher or from other settings, to find the updated string in translation table of WPLoyalty, you have to again use the "Sync" option from wp-loyalty-rules.pot file
  • Then, to add and translate dynamic strings per language, you have to update the string from wp-loyalty-rules.pot file to wp-loyalty-rules-fr_FR.po using the "Sync" option.
  • This add-on plugin "Dynamic String Translation" will work only if you are an user of WPLoyalty plugin.
  • This "Dynamic String Translation" add-on is completely free for WPLoyalty users.
Still unclear ? Please submit a support request. We are always happy to assist you :)