Skip to content

Instantly share code, notes, and snippets.

@EnragedSuccubus
Created June 13, 2014 23:49
Show Gist options
  • Save EnragedSuccubus/868e1bda385a9ca4fa0e to your computer and use it in GitHub Desktop.
Save EnragedSuccubus/868e1bda385a9ca4fa0e to your computer and use it in GitHub Desktop.
Standard text domain setup
class My_Awesome_Plugin {
public function __construct() {
add_action( 'init', array( $this, 'setup_textdomain' ) );
}
public static function setup_textdomain() {
$locale = apply_filters( 'plugin_locale', get_locale(), $this->domain );
load_textdomain( $this->domain, WP_LANG_DIR . '/plugin-name/plugin-name-' . $locale . '.mo' );
load_plugin_textdomain( $this->domain, false, $this->plugin_dir . '/languages/' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment