This thread is resolved. Here is a description of the problem and solution.

_x() were not being registered. After changing to __() or _e() the strings were registered.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 9 replies, has 3 voices.

Last updated by erickP-2 5 years, 4 months ago.

Assigned support staff: Robert.

Author Posts
February 3, 2015 at 10:51 pm #553946


I am trying to: Use .mo files to translate strings in my theme files, but as far as I can tell WPML just ignores them.

I used Poedit to create a .pot file of all the translatable strings. That was sent to and we got translations for 40 languages in more .pot files. I took each of these .pot files and saved them as .po and .mo files. Right now I am trying to test the translations out using the Spanish file

First, I should explain that it's confusing as to where the .mo file should go. My theme uses the following for the textdomain:
load_theme_textdomain( 'awr-theme', get_template_directory() . '/languages' );

I noticed that the plugin looks for .mo files in "wp-content/languages" and "/wp-content/themes/awr-theme".

So I put in each of those three directories, taking care to make sure that the relative Search Paths are correct in each file. Now the "Language locale settings" table displays "File exists." for, and an .mo file is in each of these locations:
1. "wp-content/languages/"
2. "wp-content/themes/awr-theme/"
3. "wp-content/themes/awr-theme/languages/"

The website is using the "Language name added as a parameter" option for the URL format. All of the pages have duplicated Spanish version. However, when I view a page with Spanish selected (?lang=es), nothing is translated. I can verify by viewing the source that it's using <html lang="es-US">, so it's set to Spanish but it doesn't translate anything.

Then I tried every combination of checking/unchecking the "Automatically load the theme's .mo file using 'load_theme_textdomain'." option with different path parameters for load_theme_textdomain(). I tried the path parameter with each of those 3 paths I listed above. I also tried it without using load_theme_textdomain() in my functions.php file and still nothing.

I can't seem to find any settings that get the .mo files to work. Translation does work if I use the "Translate by WPML." feature, but only with strings that I enter in manually; it doesn't override strings using the .mo files.

I should note that I did see the translation work once, but when I refreshed the page it no longer worked. As far as I know I didn't change anything in the settings or files.

What can I do to get WPML to use the .mo files?

February 4, 2015 at 6:27 am #554012


Please help. I have this same problem and I am desperate to figure this out. The admin pages won't translate no matter where I put the .mo files. I paid a lot for this plugin, and I'm seriously regretting it. The only thing that translates is the text in the user screen that is from WPML.

I've wasted so many hours here, please help. How can we get these .mo files to be recognized?

February 4, 2015 at 9:51 am #554147


Happy to help, I'll just note a few things:

1. Visit WPML > Theme and plugin localization > select 'Translate using .mo files' > select Automatically load the theme's .mo file using 'load_theme_textdomain'. > Enter textdomain > Save
2. The translations for wordpress and the admin screen are those to be placed in wp-content/languages - Download these files here: hidden link
3. Your theme's language should be put in a themes/awr-theme/languages/ directory
4. Finally the naming of this file must match the language options set on your site. If your using Spanish in it's without changing the locale setting, WPML is associating You can review those options if you visit WPML > Languages > Site Languages > Edit Languages. Attached a screenshot for reference.

@earls, please open an additional ticket if this doesn't help resolve help resolve the issue.

February 4, 2015 at 9:30 pm #554813


Thank you for the clarification on which .mo files go in which languages folder. I actually don't need the admin side to be translated, so I removed all of the files from wp-content/languages/

For the .mo files in awr-theme/languages/, I did check to make sure the filenames match what is listed on that Edit Languages screen. I had to change Spanish to es_US instead of es_ES, but other than that the files matched.

However, the translations still aren't working. I noticed now on the "Theme and plugins localization" screen that all the files listed in the table say "File not found!" (see attached screenshot). Does the plugin know to look in awr-theme/languages, or is it just looking in awr-theme/? Well, it doesn't seem to matter actually, I have an .mo file in both directories and it doesn't work.

February 5, 2015 at 7:33 am #554918


Thanks, just one question. What do I enter for the "textdomain"?

February 5, 2015 at 12:34 pm #555179


Your right, if WPML is point to this location then you would need to put them in the theme folder. Could I take a look at the site and review the issue closer? Could you provide your WP admin and FTP credentials in the private response field below. NOTE: Please make a full back-up of the site.

@earl - I actually checked with our devs and you don't actually need to specify the textdomain. Anyway, you would need to find the textdomain by reviewing the theme files, you'll see text in the theme with a line similar to this __('Read More',"textdomain");

February 6, 2015 at 12:38 pm #555979


So the file that was in the Root folder was named es_US which needed to be changed to es_ES. I made the change and resaved the settings via WPML > Theme and plugin localization and no now the file is found.

A different issue I noticed is that the program custom post type is not actually translated. All of the posts are entered in English which is why the MO file will not load. There needs to be a translation available and the language of the site needs to be switched in order for MO files to be loaded in.

If you visit WPML > Translation options > Custom Post Types > you'll notice that Programs is set to not translate. You would need to set to translate > Save and then change the languages of posts / translate content into different languages.

February 6, 2015 at 3:33 pm #556118


I wanted to use es_US because we're using US Spanish, not necessarily Spain Spanish. Although as long as it translates with the .mo file it doesn't really matter. I had changed the WPML settings to "es_US" and it found the file. You changed it to "es_ES" along with the filename, and from what I can see the plugin does NOT see the file. See the attached screenshot of the FTP view next to the WPML settings.

Sorry about the program post type not being set to translate, I must have duplicated an older version of the website. I have been working on a version on my local MAMP installation where I do have the programs set to translate. I also had duplicated a Spanish version of that Oriya program page which is why I used that as the example.

Anyway, I updated the site at to translate the program posts and I duplicated a Spanish version of the Oriya program again. It still is not translating: hidden link

I copied the .mo/.po files so now there are and Then I tried switching the WPML language settings between the two and neither works. If you look at the source of the page, you'll see the HTML tag looks like

<html lang="es-ES">

so it knows the content is supposed to be in Spanish, it just doesn't seem to find the .mo file.

February 9, 2015 at 12:00 pm #557053


WPML is detecting the MO file correct, and it's listed as file exists on the WPML > Theme and plugin Localization page (screenshot attached). If you wish to use es_US just need to change the Locale file name on Theme and plugins localization.

Then I took a look at the context for

_x('Listen in', 'Listen in <language name> Language selection on a regional program page', 'awr-theme');

And I notice that it does work correct as

_e('Listen in', 'awr-theme');

There is an error in the format of your po/mo file and not with WPML. As this is a custom theme you will need to debug further and possibly reach out to poedit for clarification on your usage.

Perhaps this article will help:
hidden link

February 10, 2015 at 4:29 pm #558244


Well, that fixed it! It's so odd that Poedit picks up on __() and _e() but not _x() since they are all defined in the .pot file properties. I just have to change the theme files to use __() or _e(). Oh well, thank you for you help!