.. include:: _include.rst .. highlight:: bbcode .. _wpml_support: ############ 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 ********** .. raw:: html

******** Activate ******** Before you can use |asa2|'s WPML features, you have to activate the WPML support in the options section "i18n": .. image:: _static/options_activate_wpml_support.png :height: 137px :width: 635px :scale: 100% :alt: Activate WPML support ******************* 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". .. image:: _static/wpml_string_translation.png :height: 529px :width: 1020px :scale: 100% :alt: WPML String Translation 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. .. image:: _static/wpml_enter_translation.png :height: 593px :width: 846px :scale: 100% :alt: WPML enter translation ************************************************ 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. .. image:: _static/translation_tab.jpg :height: 104px :width: 674px :scale: 100% :alt: translation tab Create as many new translations as you need and use the shown placeholder in your templates, e.g.: .. code:: {{ translate("my_sting") }} Learn more about template translations in chapter :ref:`templates_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. .. image:: _static/wpml_sync_button.png :height: 104px :width: 515px :scale: 100% :alt: WPML sync button ****** 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. .. image:: _static/wpml_result.png :height: 414px :width: 958px :scale: 100% :alt: translated page See a live demo here: https://asa2-demo.de/wpml-support/ ************************************** Known issues ************************************** -------------------------------------- Translations could not be synchronized -------------------------------------- .. image:: _static/wpml_sync_failed.png :height: 159px :width: 515px :scale: 100% :alt: WPML sync failed 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.