Permalink
Browse files

Moved load_plugin_textdomain() to an init action

  • Loading branch information...
1 parent fd205a8 commit 06b1df7b52160483c0a029fc6750d5ba378bea36 @pippinsplugins committed Nov 6, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 plugin.php
View
@@ -42,9 +42,6 @@ class Widget_Name extends WP_Widget {
* styles.
*/
public function __construct() {
-
- // TODO be sure to change 'widget-name' to the name of *your* plugin
- load_plugin_textdomain( 'widget-name-locale', false, plugin_dir_path( __FILE__ ) . '/lang/' );
// Manage plugin ativation/deactivation hooks
register_activation_hook( __FILE__, array( $this, 'activate' ) );
@@ -60,6 +57,9 @@ public function __construct() {
'description' => __( 'Short description of the widget goes here.', 'widget-name-locale' )
)
);
+
+ // load plugin text domain
+ add_action( 'init', array( $this, 'textdomain' ) );
// Register admin styles and scripts
add_action( 'admin_print_styles', array( $this, 'register_admin_styles' ) );
@@ -159,6 +159,14 @@ public function deactivate( $network_wide ) {
// TODO define deactivation functionality here
} // end deactivate
+ /**
+ * Load the plugin text domain on "init"
+ */
+ public function textdomain() {
+ // TODO be sure to change 'widget-name' to the name of *your* plugin
+ load_plugin_textdomain( 'widget-name-locale', false, plugin_dir_path( __FILE__ ) . '/lang/' );
+ }
+
/**
* Registers and enqueues admin-specific styles.
*/

0 comments on commit 06b1df7

Please sign in to comment.