The Content Aware Sidebars plugin lets you create an infinite number of custom sidebars and assign them to widgets based on the language of the contents on the page.
The integration of Content Aware Sidebars with WPML allows you to set different sidebars for content in different languages.
After collaborating with the author of Content Aware Sidebars, we managed to translate all the strings coming from the plugin.
What you will need:
- A recent version of WPML along with String Translation and Translation Management add-ons.
- Content Aware Sidebars (version 3.1.1 or above).
- WPML Widgets
- WPML’s Getting Started Guide will guide you on how to easily setup WPML; you may also want to refer to the WPML Widgets documentation.
- Content Aware Sidebars FAQs will help you with the setup.
Creating different custom sidebars for different languages with Content Aware Sidebars and WPML
Before going into details, a summary of the 7 steps to be followed to translate the Content Aware Sidebar plugin outputs is as follows:
Let us start translating the Content Aware Sidebar plugin output by following the detailed steps shown below:
1- Go to WPML > Translation management > Multilingual Content Setup, scroll down to the Custom posts section, and select the “translate” option for “Condition Groups” and “Sidebars.”
2- Go to Sidebars > Add new
a. Add the sidebar for your primary language, which will be English in this case; note that you can check if your primary language selected from your WordPress admin bar.
b. Chose conditional logic that suits your needs from the drop down menu and click on “Save “changes” and “Publish.”
3 – Go to WPML > Translation management
a. Select Sidebar and Conditional Group.
b. Click on the “Add to translation basket” button.
4 – Go to WPML > Translation management > Translation basket tab.
a. Go to the “Choose translation options” section and choose an option from the drop down menu.
b. Select admin (local) if you are going to do the translation yourself or learn more about setting up a professional translation service; then, click on Send all items for translation.
5 – Go to WPML > Translations
a. Add translations for the Condition Group and Sidebar by clicking on the “Edit” button
b. Fill the title field with the translation of the secondary language and select “This translation is finished” and repeat the same steps for the body field. Scroll down and select “Translation of this document is complete”
c. Click on the “Save translation” button.
6 – Go back to Sidebars
a. Click on the previously created English sidebar.
b. Use the language switcher at the top to change the language to the desired language (secondary language); now you are on the sidebar translation page.
c. Setup your sidebar translation and conditional logic similar to that shown in step 2.
7 – Go to Appearance > Widgets and you should be able to see the newly created sidebars. Add desired widgets to the sidebars and make sure you select the language of appearance in each widget you choose. This option is available through the WPML Widgets plugin.
WPML, Content Aware Sidebars, and WPML Widgets will give you the option to have different sidebar instances for each language. This is done by setting custom posts for translation and then adding a sidebar in the default language, afterwards translating the custom posts and adding the sidebar in the secondary language. Through this, we can assign widgets to the sidebars created based on the language of the page on which the sidebars are to be displayed.
Read more here:: Content Aware Sidebars & WPML