- foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field )
- $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);
+ // Translate fields
+ if ( $translate ) {
+ if ( $textdomain = $plugin_data['TextDomain'] ) {
+ if ( $plugin_data['DomainPath'] )
+ load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
+ else
+ load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
+ } elseif ( in_array( basename( $plugin_file ), array( 'hello.php', 'akismet.php' ) ) ) {
+ $textdomain = 'default';
+ }
+ if ( $textdomain ) {
+ foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field )
+ $plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
+ }