From 8c5083ba2065f03a92beaba3f7b7f70da41bf188 Mon Sep 17 00:00:00 2001 From: Tom McFarlin Date: Tue, 19 Nov 2013 17:20:26 -0500 Subject: [PATCH] updating the localization functions to that `load_textdomain` is called. Removing `load_plugin_textdomain` and leaving only `load_textdomain`. This is standard as per new WordPress practices[0]. Ultimately, it makes language files more portable as they are still accessible via WordPress even if the plugin developer did not include them with the plugin itself. Related #120 [0] https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/commit/d2eb67079b3dd8db76185737a72b5d2efda542ae#commitcomment-4644357 Signed-off-by: Tom McFarlin --- plugin-name/public/class-plugin-name.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugin-name/public/class-plugin-name.php b/plugin-name/public/class-plugin-name.php index 1414c30..a3db272 100644 --- a/plugin-name/public/class-plugin-name.php +++ b/plugin-name/public/class-plugin-name.php @@ -134,7 +134,6 @@ class Plugin_Name { switch_to_blog( $blog_id ); self::single_activate(); - } restore_current_blog(); @@ -257,8 +256,8 @@ class Plugin_Name { $domain = $this->plugin_slug; $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); - load_textdomain( $domain, $domain . '/languages/' . $domain . '-' . $locale . '.mo' ); - load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . '/languages/' ); + load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' ); + load_plugin_textdomain( $domain, FALSE, basename( plugin_dir_path( dirname( __FILE__ ) ) ) . 'languages/' ); }