Skip to content Skip to sidebar

Learn how to translate strings from your theme and plugins using WPML’s Translation Dashboard and String Translation panel.

What are Strings?

Strings are pieces of data, appearing in WordPress, which are not part of posts (Posts, Pages, custom post types) and taxonomy (Tags, Categories and custom taxonomies).

For example, the site’s tagline, which you can edit in the WordPress admin via SettingsGeneralTagline is a string. Other strings come from WordPress itself, themes and plugins.

What is WPML’s String Translation?

WPML’s String Translation allows you to translate strings, like you translate any other type of content on your site. It supports all the translation methods that WPML offers.

How can I translate strings?

Translating strings via the Translation Dashboard

Recommended

The easiest and recommended way to translate strings is by using WPML’s Translation Dashboard. It’s the recommended way because from this one screen, you’ll be able to translate any content on your website.

Please note that the Translation Dashboard is only available for the Multilingual CMS and Multilingual Agency accounts.

Use the following steps to translate strings:

  1. In the WordPress admin, click on WPML, or its first sub-item, Translation Dashboard.
  2. Scroll down to the section called Other texts (Strings) and click to expand it. You’ll see a table that lists the strings that WPML found on your site.
  3. If you see a long list and want to narrow it down, use the Filter by options to look for strings according to their text, domain or source (frontend, backend).
  4. Click on the checkbox next to the strings that you want to translate. To select all strings, click on the checkbox at the top of the table.
  5. After selecting the strings you want to translate, scroll down to Step 2 – Translate your content. There, you’ll see a table with the site’s translation-languages and translation options per language.

For the complete reference on translation options, read the Translation Dashboard documentation.

  1. Before you send the strings to translation, you’ll see the word count and the number of credits (in case you’re using automated translation).
  2. Finally, click on the Translate button at the bottom-left of the screen. WPML will take a few seconds to send the strings to translation.

That’s it, you have successfully translated selected strings.

How to Automatically Detect Untranslated Strings

Some strings that appear on the frontend might not display in the Other texts (Strings) table. To detect them and get them listed in the table, find the Detect untranslated strings option at the top of the section and click the Modify link next to it.

This will open a dialog, asking you to choose the setting for Automatically register untranslated strings. You can choose between:

  • Untranslated strings that I encounter on front-end while logged in (recommended)
  • Untranslated strings that all front-end users encounter
  • Disable auto-registration of strings

You can also enable the Also register strings from the website’s back-end option. This is useful if you want to translate all the strings that also appear in the WordPress admin. This will significantly increase the number of strings that you’ll see in the String Translation table.

Translating Strings via WPML’s String Translation Screen

The String Translation screen, available in WPMLString Translation, gives you additional control for translating strings and offers several maintenance options. Use this option if you prefer to translate manually, yourself or when you need to make changes in strings on your site. Normally, the Translation Dashboard is the recommended way to translate strings.

At the top of the String Translation page, you’ll see a filter, where you can search for strings by their translation status, text, domain or priority.

The table shows all the strings that match the search results.

Use the plus / pencil icons in the table to translate yourself.

From this table, you can also do maintenance for strings on your site. First, select the strings that you want to adjust using the checkbox next to them. You can also select all strings using the top-checkbox. After selecting strings, you can:

  • Delete them – click on the Delete selected strings button
  • Change their original language – click on the Change the language of selected strings button
  • Change their translation priority – click on the Change translation priority of selected strings button

Translating Strings Coming from Theme and Plugin JavaScript Files

Some themes and plugins keep certain frontend texts (strings) inside JavaScript files. Most often, this is the case with frontend features that refresh their content without needing to refresh the whole page.

One of the most popular examples of this are the WooCommerce Cart and WooCommerce Checkout blocks. WPML doesn’t see such strings by default so to translate them, you need to enable it in WPML’s settings:

  1. Go to WPMLSettings
  2. Scroll to the String Translation section and enable the Detect strings in JavaScript files option.
  3. On your frontend, visit the page where your JavaScript string appears. This registers the script containing it.
  4. Next, go to WPMLTheme and plugins localization, select the plugin or theme that contains the untranslated strings, and click Scan
  5. Then, go to WPMLString Translation to translate your JavaScript strings.
  6. Finally, this feature loads your server, so after translating your JavaScript strings, go back to WPMLSettings and disable it.

String Translation FAQ

The String Translation screen offers the Utilities section with several tools, located at the bottom of the page. 

How do I control which strings WPML auto-registers?

Click on the Auto register untranslated strings section in the Utilities section. Then, select which strings WPML should detect:

  • Untranslated strings that I encounter on frontend while logged in (recommended) – this lets you find strings yourself and is light on the site’s resources
  • Untranslated strings that all frontend users encounter – this is harder on the site’s resources and should be turned off when you’re done translating missing strings
  • Disable auto-registration of strings

How can I import and export strings and their translations?

From the Utilities section, click on Import / export .po. You’ll see a dialog that lets you upload .po files with their translations and export .po files with translations from your strings.

How can I clean up the String Translation table?

Themes and plugins register strings, but they don’t remove them. If your site had plugins or themes that added many strings and you’ve deactivated them, the strings will remain on your site. You can clear them by clicking on Remove strings by domain in the Utilities section.

Click the Remove strings button and a popup will guide you through the process. You’ll choose the domain, see the number of strings you’ll clean up and confirm before deleting anything.

How can I set the original language of strings?

Usually, WordPress themes and plugins use English as their original language. In some rare cases, plugins and themes use a language other than English. To tell WPML what’s the correct original language of strings coming from these plugins and themes, click on Set the original language of themes and plugins in the Utilities section. 

There, click on the Set the language of text-domains button and WPML will guide you through the process. This action doesn’t delete any strings. It only changes their language.

What to do if you can’t find the strings that you’re looking for?

WPML doesn’t register all the texts in WordPress, to prevent the String Translation table from becoming huge. If you need to include more texts in the String Translation table, click on Not seeing strings that you are looking for? in the Utilities section. There, click the Admin Texts Translation link. Continue reading the instructions for the Admin Texts Translation screen.

How can I translate users’ meta-properties?

WPML allows you to translate user meta information like user name, nickname, biography, and custom fields you add. To do this, click on Translate User properties in the Utilities section and then click the Edit user roles button. Select the user roles you would like to translate (e.g. Administrator) and click Apply.

Use the All domains dropdown at the top of the String Translations page to select the Authors domain and click the Filter button. This will display all selected user meta information in the table and you can translate them as usual.

How can I see where strings are coming from?

If you need to find exactly from which PHP file (e.g. theme, plugins) a specific string is coming from, you can click on Track where strings appear on the site in the Utilities section. There, check the Track where strings appear on the site checkbox and select the color for highlighting the strings in the preview.

Now, the String Translation page will display a new Usage column in the table of strings. Click the eye icon in this column, next to a string you want to track. A popup with a preview of the PHP file with this string will appear. It will show the strings domain, text, and the path and the name of the PHP file. Scroll through the code and your string will appear highlighted.

Do not use this feature on a production site because it may slow it down.