[wp-trac] [WordPress Trac] #23794: load_plugin_textdomain fails if plugin is loaded from mu-plugins

WordPress Trac noreply at wordpress.org
Thu Apr 4 05:52:44 UTC 2013


#23794: load_plugin_textdomain fails if plugin is loaded from mu-plugins
-------------------------+-----------------------------
 Reporter:  ideag        |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Future Release
Component:  I18N         |     Version:  3.5.1
 Severity:  minor        |  Resolution:
 Keywords:               |
-------------------------+-----------------------------

Comment (by ideag):

 Replying to [comment:5 nacin]:
 > We should probably merge these functions to look in both directories —
 plugins then mu-plugins.

 something like this?


 {{{
 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 );
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23794#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list