WPML Support¶
Since version 1.4.0
ASA 2 is compatible with WPML. WPML is a powerful WordPress plugin to build multilingual websites. You can use WPML to translate ASA 2’s Amazon product templates.
Note
You need the WPML extension “String Translation” installed, to use ASA2’s WPML features.
Screencast¶
Activate¶
Before you can use ASA2’s WPML features, you have to activate the WPML support in the options section “i18n”:
Manage translations¶
After activation, ASA2 will transfer all template translation strings to WPML. You can manage those string with the WPML extension “String Translation”. Switch to section section “WPML / String Translation” and you will see some new strings with domain “ASA 2”.
Click the link “translations” on every string to enter the translations for all the languages configured in your WPML settings. Remember to check “Translation is complete” before you save. Otherwise the translation will not be used.
Adding a new string for custom product templates¶
If you create your own ASA2 templates and need new language strings, head over to section ASA2 / Templates / Translation.
Create as many new translations as you need and use the shown placeholder in your templates, e.g.:
{{ translate("my_sting") }}
Learn more about template translations in chapter Translation.
Every template translation string you create, will automatically be registered for WPML unless you did not activate option “WPML: Disable auto transfer”.
Switch back to “WPML / String Translation” to find it there and enter the missing translations.
Synchronize translations¶
You can manually synchronize all your ASA2 template translations with WPML by clicking the button “Sync with WPML” on the template translations admin page. It will transfer all ASA2 translations to WPML’s String Translation extension if they do not exist there already.
Result¶
Translate a post or page with embedded ASA2 shortcodes. Then use the WPML language switcher on the front-end and switch to another language. You will see that the template strings will be shown in the chosen language if you have maintained its translations in WPML’s “String Translation” extension.
See a live demo here: https://asa2-demo.de/wpml-support/
Known issues¶
Translations could not be synchronized¶
If you receive the message “Translations could not be synchronized with WPML.” after you clicked the button “Sync with WPML” on the template translations admin page, please make sure that WPML and the extension “String Translations” is activated. Otherwise ASA2 is not able to interact with WPML.