Why strings don't appear in "String translation" of WPML? Why strings don't appear in "String translation" of WPML? wordpress wordpress

Why strings don't appear in "String translation" of WPML?


To get strings to appear in String Translation, you first need to go to Theme and plugins localization. Scroll down to the Strings in the theme section and then click the Scan the theme for strings button. WPML will then detect any unregistered or newly added strings that are properly formatted for localization.

If it works, you'll see your theme a-theme listed in the Domain column and the number of detected strings in the Count column. Clicking the View strings that need translation button will take you to String Translation. If any of the strings aren't properly formatted for localization, the count won't be updated.

If you update existing strings or add new ones, you'll need to rescan before WPML adds them to String Translation.

The formatting in your first example looks OK and WPML should detect the strings, but in the second example, you haven't declared a domain. Without a domain, WPML won't pick up the string.

The correct format is

__('Your string', 'yourDomain')or_e('Your string', 'yourDomain')

In this case, the domain should be the name of your theme, 'a_theme'.


Those strings are cached somehow. So, if you added new one (the right way) and it still doesn't appear in String translation go to "Theme and plugin localization" and hit "Scan the theme for strings" button. This will re-index strings and your newly added one should appear (worked for me).


I have same problem, my theme is "bookyourtravel", and plugin "WPML string translation",did not translate these texts:

<?php _e('Accommodations', 'bookyourtravel'); ?><?php _e('Tour', 'bookyourtravel'); ?><?php _e('Accommodation', 'bookyourtravel'); ?>    

No translated!!!

My solution was:

  1. In WPML go to "localization of themes and plugins", check inTranslated by WPML, then clic en Save.
  2. Now in, "Translated string", clic in button: save the settings and rescan strings.

If you use Cache, then Clear all cache in pages.

ready, this worked!!!!!!!

source : https://wpml.org/forums/topic/using-gettext-for-hard-coded-strings-what-else/