Skip to content

Instantly share code, notes, and snippets.

@spacedmonkey
Created December 16, 2013 16:31
Show Gist options
  • Save spacedmonkey/7989920 to your computer and use it in GitHub Desktop.
Save spacedmonkey/7989920 to your computer and use it in GitHub Desktop.
Not load plugin text domain unless file found
/**
* Load the plugin text domain for translation.
*
* @since 2.0
*/
public function load_plugin_textdomain() {
$domain = $this->plugin_slug;
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
$file = trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo';
if ( file_exists( $file )){
load_textdomain( $domain, $file );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment