Saltar navegación
0

Introduction

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:

Essential resources:

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:

  1. Set WPML to register custom posts obtained from the Content Aware Sidebars for translation.
  2. Add a new sidebar to the default language.
  3. Add the custom posts to the translation basket.
  4. Choose whether the custom posts are to be translated by a local translator or a professional translation service.
  5. Translate the custom posts (by a local translator).
  6. Add a new sidebar for the secondary language.
  7. Assign widgets to the sidebars created based on the language of the page on which the sidebars are to be displayed.

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.”

Translate condition groups and sidebars

  1. Go to Sidebars > Add new
  1. 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.
  2. Chose conditional logic that suits your needs from the drop down menu and click on “Save “changes” and “Publish.”

Add new sidebar to primary language

Select conditional logic

  1. Go to WPML > Translation management
  1. Select Sidebar and Conditional Group.
  2. Click on the “Add to translation basket” button.

Add to translation basket

  1. Go to WPML > Translation management > Translation basket tab.
  1. Go to the “Choose translation options” section and choose an option from the drop down menu.
  2. 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.

Send items for translation

  1. Go to WPML > Translations
  1. Add translations for the Condition Group and Sidebar by clicking on the “Edit” button
  2. 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
  3. Click on the “Save translation” button.

Add translations for the Condition Group and Sidebar

Save translation

Translation of this document is complete

  1. Go back to Sidebars
  1. Click on the previously created English sidebar.
  2. 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.
  3. Setup your sidebar translation and conditional logic similar to that shown in step 2.

sidebar translation and conditional logic for secondary language

Secondary language sidebar translation

  1. 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.

Add widgets to sidebar

Select language of widget

Conclusion:

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.

How can we make WPML better for you?

Share your thoughts and comments about our plugin, documentation, or videos by booking a Zoom call with Agnes, our Client Advocate. Your feedback matters and helps us improve.

Book a call with Agnes