[wp-trac] [WordPress Trac] #20813: _get_plugin_data_markup_translate fails to load plugin translations with DomainPath

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 1 21:22:18 UTC 2012


#20813: _get_plugin_data_markup_translate fails to load plugin translations with
DomainPath
--------------------------+-----------------------------
 Reporter:  arnee         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  3.4
 Severity:  major         |   Keywords:
--------------------------+-----------------------------
 Example Plugin:

 {{{
 Plugin Name: XYZ
 Text Domain: zzz
 Domain Path: /lang
 }}}

 For showing the translated description,
 _get_plugin_data_markup_translate() will be called.


 {{{
 function _get_plugin_data_markup_translate( $plugin_file, $plugin_data,
 $markup = true, $translate = true ) {

   // Translate fields
   if ( $translate ) {
     if ( $textdomain = $plugin_data['TextDomain'] ) {
       if ( $plugin_data['DomainPath'] )
         load_plugin_textdomain( $textdomain, false, dirname( $plugin_file
 ) . $plugin_data['DomainPath'] );
 }}}

 This will call (replaced vars with values):
 {{{
 load_plugin_textdomain( 'zzz', false, "/full/path/to/plugin/dir/" . "lang"
 );
 }}}

 But load_plugin_textdomain only accepts the subdirectory "lang" as the
 third argument, leading to an incorrect path since WP_PLUGIN_DIR will be
 put in front.

 The fix is to use basename(dirname()) to only get the plugin directory
 instead of the full path.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20813>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list