Title: Plugin not loading language files
Last modified: August 21, 2016

---

# Plugin not loading language files

 *  Resolved [datainterlock](https://wordpress.org/support/users/datainterlock/)
 * (@datainterlock)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/plugin-not-loading-language-files/)
 * I’m using code from the plugin boilerplate
 *     ```
       public function load_plugin_textdomain() {
       		$domain = $this->plugin_slug;
       		$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
   
       		load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
       		load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
   
       	}
       ```
   
 * I’ve created es_ES.po and .mo files and they look good. Poedit is set to compile
   automatically. I’ve changed the language in my config.php to es_ES. I’ve downloaded
   the WordPress 3.9 es update. I’ve check paths, file names, and I’m about to pull
   out what little hair I have left.
 * 1. It did NOT move my language files when I upgraded WordPress to 3.9 es so the
   load_textdomain isn’t finding them in the new /language/ directory. Why it didn’t
   move them, I have no idea.
 * 2. load_plugin_textdomain does nothing. it’s still constantly in English no matter
   what I do.
 * 3. I’ve read the codex, other websites and a few religious pamphlets and STILL
   can’t get the language to load.
 * any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [datainterlock](https://wordpress.org/support/users/datainterlock/)
 * (@datainterlock)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/plugin-not-loading-language-files/#post-4834556)
 * Just in case someone else runs into this minor nightmare…
 * the .po and .mo files must begin with the exact text domain… EXACT.
 * load_textdomain( $domain ) – the $domain must be the EXACT same as the text domain
 * and finally
 * any __(‘junk’,’text_domain’) the text domain must be EXACTLY the same as all 
   the others. Otherwise, you won’t load.
 * I found this chunk of code to help test it and show me where I went wrong.
 *     ```
       $loaded = load_plugin_textdomain( 'text_domain', FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' );
       	    if ( ! $loaded ){
                      echo "<hr/>";
       			   echo "Error: the mo file was not found! ";
       			   exit();
   
               }else{
   
                      echo "<hr/>Debug info:<br/>";
                      echo "WPLANG: ". WPLANG;
                      echo "<br/>";
                      echo "translate test: ". __('Some text','text_domain');
                      exit();
              }
       ```
   
 *  [Aaron T. Grogg](https://wordpress.org/support/users/aarontgrogg/)
 * (@aarontgrogg)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/plugin-not-loading-language-files/#post-4834567)
 * So… this is resolved, or no?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plugin not loading language files’ is closed to new replies.

## Tags

 * [language files](https://wordpress.org/support/topic-tag/language-files/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [Aaron T. Grogg](https://wordpress.org/support/users/aarontgrogg/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/plugin-not-loading-language-files/#post-4834567)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
