Make WordPress Core

Changeset 19965


Ignore:
Timestamp:
02/21/2012 03:26:08 PM (14 years ago)
Author:
nacin
Message:

Allow bundled plugin headers to be translated. see #19597.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin.php

    r19712 r19965  
    110110
    111111        //Translate fields
    112         if ( $translate && ! empty($plugin_data['TextDomain']) ) {
    113                 if ( ! empty( $plugin_data['DomainPath'] ) )
    114                         load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file). $plugin_data['DomainPath']);
    115                 else
    116                         load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file));
    117 
    118                 foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field )
    119                         $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);
     112        if ( $translate ) {
     113                if ( $textdomain = $plugin_data['TextDomain'] ) {
     114                        if ( ! empty( $plugin_data['DomainPath'] ) )
     115                                load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
     116                        else
     117                                load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
     118                } elseif ( in_array( basename( $plugin_file ), array( 'hello.php', 'akismet.php' ) ) ) {
     119                        $textdomain = 'default';
     120                }
     121                if ( $textdomain ) {
     122                        foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field )
     123                                $plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
     124                }
    120125        }
    121126
Note: See TracChangeset for help on using the changeset viewer.