Skip to content

Instantly share code, notes, and snippets.

@ideag
Created April 4, 2013 05:50
Show Gist options
  • Save ideag/5308138 to your computer and use it in GitHub Desktop.
Save ideag/5308138 to your computer and use it in GitHub Desktop.
<?php
function load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false ) {
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
if ( false !== $plugin_rel_path ) {
$path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
} else if ( false !== $abs_rel_path ) {
_deprecated_argument( __FUNCTION__, '2.7' );
$path = ABSPATH . trim( $abs_rel_path, '/' );
} else {
$path = WP_PLUGIN_DIR;
}
if (!is_readable($path)) {
$path = WPMU_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
}
$mofile = $path . '/'. $domain . '-' . $locale . '.mo';
return load_textdomain( $domain, $mofile );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment