Originally written
May 18, 2015
October 24, 2018

WPML lets you easily translate your Widgets via the String Translation screen. This requires that the WPML String Translation module is installed. The module is available with the Multilingual CMS account type.

See the instructions in the following video, or read the details underneath it.

WordPress ships with a few default widgets and WPML will automatically register them for translation the moment you install WPML String Translation.
Visit the String Translation screen and you will see all the default widgets registered under the context “Widgets” ready for translation.

Widget Translation

Often times themes and plugins 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 register automatically for translation; or perhaps only the widget title registers but not other widget texts.

Widget Titles

Widget titles must go through filters so that WPML can register them for translation
The code will look like this:

function widget( $args, $instance ) {
  $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance );

Other Widget Texts

Often times widgets provide other text fields such as textareas or input fields. There are two ways to let WPML know that these exist and to register them for translation.

Registering widget fields for translation – The coding method

The coding method is described in detail here with examples.

The second non-coding method is described below.

Registering widget fields for translation via String Translation

One of the advance features of String Translation is that is 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 widget also benefit from the feature.

All you need to do is visit String Translation and scroll to the bottom of the settings page. Locate “Translate texts in admin screens” and click on the link.

Translate widget fields

This will open a new screen with a tree of options. Search for your widget and click on it’s name to expand it’s fields.

Register widget texts for translation

Enable the texts you want to register for translation and click “Apply” at the bottom of the screen.

Finally, visit the main String Translation settings page to translate the text.