I can’t translate text in my plugin using a .mo file, load_plugin_textdomain() function is always false

(Revised answer)

The simple answer is because WordPress could not find the MO file, despite the file itself exists (in the plugin’s languages directory).

And here’s why: The MO file needs to be named following this format: {text-domain}-{locale}.mo, and {text-domain}-{locale}.po for the PO file. See Loading Text Domain for further information.

So you’re trying to load the MO file for the survey-plugin domain:

load_plugin_textdomain( 'survey-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' )

Hence for the es_ES locale (Español),

  • The MO file name has to be survey-plugin-es_ES.mo.

  • The PO file name has to be survey-plugin-es_ES.po.

And I think you may not be aware that the POT (translation template) file needs be named like so: {text-domain}.pot? E.g. survey-plugin.pot in your case.

Or was the survey-plugi just a typo? 🙂

But even if so, I hope this answer helps (other developers/readers).