Skip Navigation
Originally written
September 1, 2020
Updated
September 1, 2020

Can’t find strings you’re looking to translate on the String Translation page? Here, we’ll go through some common reasons why, and where you can find them.

Theme or plugin translation files have changed

Themes and plugins usually come with their own translations for the texts you can find in their user interface as well as their front-end output. They store these translations inside translation files.

By default, WPML doesn’t scan or load these translation files into the database. Because of this, you will not be able to find these strings on the String Translation page.

If you want to translate or edit these strings, you first need to scan the translation files of the related theme or a plugin.

Scanning the theme and plugins

  1. Go to WPML → String Translation and try searching for the string.
  2. A drop down called Can’t find the strings you’re looking to translate? will appear. Expand it under Some of the translations have changed, choose the theme or plugins you would like WPML to scan. Then click Scan translation files.
Scanning translation files for strings
  1. After the scan is complete, the page refreshes, and you can now select the related theme or plugin in the Select string within domain dropdown.

Scanning for hard-coded strings

Some themes or plugins have hard-coded strings wrapped in a gettext function. String Translation only scans the MO files for translatable strings so any hard-coded strings will be missed.

To scan for hard-coded strings:

  1. Go to WPML → Theme and Plugins Localization
  2. Select the theme or plugin and click to scan it.
  3. After the scan is done, you should be able to find the strings on the String Translation page.
Scanning for hard-coded strings

Strings aren’t selected for translation

Many themes and plugins store texts in the wp_options table. These strings first need to be registered as translatable and added to String Translation.

To register these strings:

  1. Go to WPML → String Translation and try searching for the string.
  2. Expand the Can’t find the strings you’re looking to translate? drop down and click Choose texts for translation.
Choosing texts for translation
Choosing texts for translation
  1. This will take you to a searchable list of admin strings. Select your string and click Add to String Translation. Then, translate your string as normal on the String Translation page.
Adding admin strings to the String Translation page
Adding admin strings to the String Translation page
  1. Alternatively, you can click Export as a WPML configuration file to generate a code snippet to use in your language configuration file.
Exporting as a WPML configuration file
Exporting as a WPML configuration file

Other advanced String Translation tools

If you still can’t find your strings, WPML has tools that can help you locate them. You can access these from WPML → String Translation.

Track where strings appear on the site

This option helps you identify where strings are used on public pages in the site. When enabled, WPML will keep a record of the PHP source and pages that display each string. This feature can help understand the correct context of strings and how they should be translated.

How to use:

  1. Enable the Track where strings appear on the site option.
  2. Visit the site’s front-end pages.
  3. Switch to a language other than the site’s default language.
  4. WPML will register any string that appears on the page you are viewing. Move from page to page to cover all the strings you need.
Enable / disable string usage Info icons on strings list String in the PHP code String on public page
tracking_strings string-debug-options see-where-string-appears show-on-page
Enable or disable the tracking for where strings appear on public pages. Click on the icons to see where the string appears in the code or on a public page. Static operation, without any additional server load. Dynamic operation, intended for site development, which loads the server.

Please note that this is a database-intense operation. You should only enable it when building the site. When you are done registering strings, don’t forget to return to the String Translation admin page and disable Track where strings appear on the site. Your site’s speed will be significantly lower if you keep this option running in production mode.

Auto-register strings for translation

WPML uses static code analysis to locate strings that require translation in the theme and plugins. In some cases, the static code-scan cannot reliably find all strings. This often happens when strings are generated dynamically using code.

By enabling auto-registration, WPML will register strings that need translation at display-time. The conservative option is to register strings when logged in as an administrator. This means that when a logged-in admin browses the site, WPML registers for translation any strings that are displayed.

This operation may increase a number of database queries while strings are registering for translation.

Synchronizing translation files for sites running on multiple servers

As a default, String Translation only stores MO files on one server. This means that if your site runs on multiple servers, all the requests handled by other servers do not translate the strings. 

As of WPML 4.4.0, you can enable a custom mode to synchronize your MO files across your servers. To do so, add the following to your wp-config file:

define( 'WPML_ST_SYNC_TRANSLATION_FILES', true );

Please note: This synchronization mode will add another layer of logic that may affect your site’s performance. We recommend using it only if required.