How to Translate Widgets or display different widgets per language
WPML is the leading translation plugin and is highly recommended if you are running a multilingual site that allows users to switch languages on the fly. It is a premium plugin, but worth the cost considering Layers is free, and WPML provides dedicated support to help you with translation and setup.
WPML allows you to translate widget titles theme texts via the String Translation extension. The following provides steps on how to locate Layers texts for translations in WPML:
- From the WPML menu click on String Translation
- At the bottom under Auto-Register Strings, select Auto-register strings only when logged in as an administrator
- This option attempts to grab entered data such as widget content, titles and options
- Click Save
- Under the main String Translation area, ensure All Strings and All Contexts is selected. The strings the plugin is able to find and translate will be listed – click one to translate it.
For general advice on translating the theme texts, see How to Translate Layers
Using Widget Control
We apply localization coding techniques to all widgets and text strings in Layers, but sometimes even coding techniques are not enough. Depending on your language and setup, you may need to create one set of widgets for each language with the content entered in each language, the same way you must enter two versions of your post and page content. In these cases, or cases where you are not using WPML or don’t have the string translation extension, using a plugin to setup separate widget displays is the solution.
Both Widget Logic and Dynamic Widgets are plugins that allow controlling where widgets display. You can use them to specify which post types, pages, categories or tags widgets are allowed, including which languages they will display in.
You can evaluate these plugins under→ by searching their names, or directly here:
For example, with Dynamic Widgets, you can setup a single Layers page with two copies of every widget, one in each language. Save your widget setup, then return to the admin and go to→ . Your builder widgets will be listed at top left. Click each one to select the Language. No other filters are necessary since your builder widgets are already tied to a specific page:
For a detailed walkthrough on using Widget Logic, head over to the WPML Support Site
Did you know?
Our friends at Jetpack are doing some incredible work to improve the WordPress experience. Check out Jetpack and improve your site's security, speed and reliability.