Allow bundled plugin headers to be translated. see #19597.
git-svn-id: https://develop.svn.wordpress.org/trunk@19965 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c82d0d0b72
commit
80b14c9de7
|
@ -109,14 +109,19 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
|
||||||
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) {
|
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true) {
|
||||||
|
|
||||||
//Translate fields
|
//Translate fields
|
||||||
if ( $translate && ! empty($plugin_data['TextDomain']) ) {
|
if ( $translate ) {
|
||||||
|
if ( $textdomain = $plugin_data['TextDomain'] ) {
|
||||||
if ( ! empty( $plugin_data['DomainPath'] ) )
|
if ( ! empty( $plugin_data['DomainPath'] ) )
|
||||||
load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file). $plugin_data['DomainPath']);
|
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
|
||||||
else
|
else
|
||||||
load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file));
|
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 )
|
foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field )
|
||||||
$plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);
|
$plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugins_allowedtags = array(
|
$plugins_allowedtags = array(
|
||||||
|
|
Loading…
Reference in New Issue