Skip Navigation
Updated
October 18, 2024

WPML makes it easy to translate your site’s widgets, whether you’re using the Classic Editor and Legacy Widgets or the Block Editor and Site Editing. You can translate your widgets using String Translation or by creating separate widgets for each language.

Getting Started

Start by installing and activating the WPML core plugin and WPML String Translation add-on.

WordPress 5.8 introduced block-based widgets. If you are using this version or later, please be sure you are using WPML 4.4.11 or later to ensure full compatibility.

Registering Widgets as Translatable

In order to translate your widgets, you first have to tell WPML that they can be translated.

WordPress ships with a few default widgets. WPML automatically registers these for translation the moment you install WPML String Translation.

Themes and plugins often also provide custom widgets, or you may be coding your own widgets. If this is the case, you will notice that these widgets may not always show up automatically for translation on the String Translation page; or perhaps only the widget title registers but not other widget texts.

There are two ways to let WPML know that these exist and to register them for translation.

Registering Widget Fields Using Code

For this, please see our detailed documentation about registering widget fields using code.

Registering Widget Fields Using String Translation

One of the advanced features of String Translation is that it allows admins to select texts that are saved in the wp-options database table and register them for translation. Since WordPress widgets save their texts inside the wp-options table, this means that widgets also benefit from the feature.

Follow the steps outlined in our documentation to find and register the widget strings you would like to translate.

Translating Widgets Using String Translation

Once your widget strings have been added to the String Translation page, you can continue with translating them.

Visit WPML → String Translation and select Widgets in the domain selection dropdown. You will see all the default widgets registered available for translation. Or, you can use the search bar to find text from a custom widget.

Finding default widget strings for translation in String Translation

Click the Plus icon to add translations in each language. Clicking outside the translation field automatically saves and publishes the translation.

Creating Widgets in Each Language

You can use this method to manually create widgets in each language, or to display different widgets in different languages.

This feature was inspired by the WPML widgets plugin from Jeroen Sormani.

To use this feature, simply add or edit a widget on the Appearance → Widgets page in the WordPress admin area and choose which language to display it on using the dropdown.

Creating a Classic Widget

Creating a Block-Based Widget

Translating Widget Blocks

Starting with WordPress 5.8, you can add widget blocks to your posts and pages.

Available widget blocks

Content in these blocks is translated along with the rest of the post or page. See our documentation on translating pages, posts, and custom post types for more details.