mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
Plugins: Avoid translating empty plugin headers.
This change aims to avoid unnecessarily translating empty strings from plugin headers, by removing empty fields from translation process in `_get_plugin_data_markup_translate()`. Props Chouby, johnbillion, audrasjb. Fixes #54586. git-svn-id: https://develop.svn.wordpress.org/trunk@53181 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1b05b62500
commit
ffa8a414fe
@ -155,8 +155,10 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup
|
||||
}
|
||||
if ( $textdomain ) {
|
||||
foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) {
|
||||
// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
|
||||
$plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
|
||||
if ( ! empty( $plugin_data[ $field ] ) ) {
|
||||
// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
|
||||
$plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user