Upgrade/Install: Improve localized strings related to plugin/theme installation and activation.

Adds context to strings where applicable to disambiguate them, coherently throughout the admin. Also improves some of the strings introduced in [57545] to ease localization.

Props swissspidy, costdev.
Fixes #60630. See #22316.
Built from https://develop.svn.wordpress.org/trunk@57714


git-svn-id: http://core.svn.wordpress.org/trunk@57215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2024-02-26 20:35:08 +00:00
parent 7173bb9a94
commit 8cdbaf4aeb
14 changed files with 56 additions and 43 deletions

View File

@ -163,7 +163,7 @@ if ( empty( $importers ) ) {
esc_attr( $data[0] ), esc_attr( $data[0] ),
/* translators: %s: Importer name. */ /* translators: %s: Importer name. */
esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $data[0] ) ), esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $data[0] ) ),
__( 'Install Now' ) _x( 'Install Now', 'plugin' )
); );
} else { } else {
$action = sprintf( $action = sprintf(

View File

@ -121,7 +121,7 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
$install_actions['network_activate'] = sprintf( $install_actions['network_activate'] = sprintf(
'<a class="button button-primary" href="%s" target="_parent">%s</a>', '<a class="button button-primary" href="%s" target="_parent">%s</a>',
wp_nonce_url( 'plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ), wp_nonce_url( 'plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ),
__( 'Network Activate' ) _x( 'Network Activate', 'plugin' )
); );
unset( $install_actions['activate_plugin'] ); unset( $install_actions['activate_plugin'] );
} }

View File

@ -138,7 +138,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
'<a href="%s" class="activatelink">' . '<a href="%s" class="activatelink">' .
'<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>', '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
esc_url( $activate_link ), esc_url( $activate_link ),
__( 'Activate' ), _x( 'Activate', 'theme' ),
/* translators: Hidden accessibility text. %s: Theme name. */ /* translators: Hidden accessibility text. %s: Theme name. */
sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $name ) sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $name )
); );

View File

@ -110,7 +110,7 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
'<a href="%s" class="activatelink">' . '<a href="%s" class="activatelink">' .
'<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>', '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
esc_url( $activate_link ), esc_url( $activate_link ),
__( 'Activate' ), _x( 'Activate', 'theme' ),
/* translators: Hidden accessibility text. %s: Theme name. */ /* translators: Hidden accessibility text. %s: Theme name. */
sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $name ) sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $name )
); );

View File

@ -756,7 +756,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
'activateblog_' . $blog['blog_id'] 'activateblog_' . $blog['blog_id']
) )
), ),
__( 'Activate' ) _x( 'Activate', 'site' )
); );
} else { } else {
$actions['deactivate'] = sprintf( $actions['deactivate'] = sprintf(

View File

@ -607,11 +607,11 @@ class WP_Plugins_List_Table extends WP_List_Table {
$actions = array(); $actions = array();
if ( 'active' !== $status ) { if ( 'active' !== $status ) {
$actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? _x( 'Network Activate', 'plugin' ) : _x( 'Activate', 'plugin' );
} }
if ( 'inactive' !== $status && 'recent' !== $status ) { if ( 'inactive' !== $status && 'recent' !== $status ) {
$actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? _x( 'Network Deactivate', 'plugin' ) : _x( 'Deactivate', 'plugin' );
} }
if ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) { if ( ! is_multisite() || $this->screen->in_admin( 'network' ) ) {
@ -820,7 +820,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
esc_attr( $plugin_id_attr ), esc_attr( $plugin_id_attr ),
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ), esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
__( 'Network Deactivate' ) _x( 'Network Deactivate', 'plugin' )
); );
} }
} }
@ -828,7 +828,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( current_user_can( 'manage_network_plugins' ) ) { if ( current_user_can( 'manage_network_plugins' ) ) {
if ( $compatible_php && $compatible_wp ) { if ( $compatible_php && $compatible_wp ) {
if ( $has_unmet_dependencies ) { if ( $has_unmet_dependencies ) {
$actions['activate'] = __( 'Network Activate' ) . $actions['activate'] = _x( 'Network Activate', 'plugin' ) .
'<span class="screen-reader-text">' . '<span class="screen-reader-text">' .
__( 'You cannot activate this plugin as it has unmet requirements.' ) . __( 'You cannot activate this plugin as it has unmet requirements.' ) .
'</span>'; '</span>';
@ -845,7 +845,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
esc_attr( $plugin_id_attr ), esc_attr( $plugin_id_attr ),
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ), esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
__( 'Network Activate' ) _x( 'Network Activate', 'plugin' )
); );
} }
} else { } else {
@ -934,7 +934,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
if ( current_user_can( 'activate_plugin', $plugin_file ) ) { if ( current_user_can( 'activate_plugin', $plugin_file ) ) {
if ( $compatible_php && $compatible_wp ) { if ( $compatible_php && $compatible_wp ) {
if ( $has_unmet_dependencies ) { if ( $has_unmet_dependencies ) {
$actions['activate'] = __( 'Activate' ) . $actions['activate'] = _x( 'Activate', 'plugin' ) .
'<span class="screen-reader-text">' . '<span class="screen-reader-text">' .
__( 'You cannot activate this plugin as it has unmet requirements.' ) . __( 'You cannot activate this plugin as it has unmet requirements.' ) .
'</span>'; '</span>';
@ -951,7 +951,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
esc_attr( $plugin_id_attr ), esc_attr( $plugin_id_attr ),
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ), esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
__( 'Activate' ) _x( 'Activate', 'plugin' )
); );
} }
} else { } else {
@ -1532,11 +1532,18 @@ class WP_Plugins_List_Table extends WP_List_Table {
return; return;
} }
$dependency_note = __( 'Note: this plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.' ); $dependency_note = __( 'Note: This plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.' );
$comma = wp_get_list_item_separator();
$required_by = sprintf(
/* translators: %s: List of dependencies. */
__( '<strong>Required by:</strong> %s' ),
implode( $comma, $dependent_names )
);
printf( printf(
'<div class="required-by"><p><strong>%1$s</strong> %2$s</p><p>%3$s</p></div>', '<div class="required-by"><p>%1$s</p><p>%2$s</p></div>',
__( 'Required by:' ), $required_by,
esc_html( implode( ' | ', $dependent_names ) ),
$dependency_note $dependency_note
); );
} }
@ -1560,12 +1567,18 @@ class WP_Plugins_List_Table extends WP_List_Table {
$links[] = $this->get_dependency_view_details_link( $name, $slug ); $links[] = $this->get_dependency_view_details_link( $name, $slug );
} }
$dependency_note = __( 'Note: this plugin cannot be activated until the plugins that are required by it are activated.' ); $dependency_note = __( 'Note: This plugin cannot be activated until the plugins that are required by it are activated.' );
$comma = wp_get_list_item_separator();
$requires = sprintf(
/* translators: %s: List of dependency names. */
__( '<strong>Requires:</strong> %s' ),
implode( $comma, $links )
);
printf( printf(
'<div class="requires"><p><strong>%1$s</strong> %2$s</p><p>%3$s</p></div>', '<div class="requires"><p>%1$s</p><p>%2$s</p></div>',
__( 'Requires:' ), $requires,
implode( ' | ', $links ),
$dependency_note $dependency_note
); );
} }

View File

@ -333,7 +333,7 @@ class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ), esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ), esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
__( 'Install Now' ) _x( 'Install Now', 'theme' )
); );
break; break;
} }

View File

@ -212,7 +212,7 @@ class WP_Themes_List_Table extends WP_List_Table {
$activate_link, $activate_link,
/* translators: %s: Theme name. */ /* translators: %s: Theme name. */
esc_attr( sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $title ) ), esc_attr( sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $title ) ),
__( 'Activate' ) _x( 'Activate', 'theme' )
); );
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {

View File

@ -361,7 +361,7 @@ function install_plugins_upload() {
?> ?>
</label> </label>
<input type="file" id="pluginzip" name="pluginzip" accept=".zip" /> <input type="file" id="pluginzip" name="pluginzip" accept=".zip" />
<?php submit_button( __( 'Install Now' ), '', 'install-plugin-submit', false ); ?> <?php submit_button( _x( 'Install Now', 'plugin' ), '', 'install-plugin-submit', false ); ?>
</form> </form>
</div> </div>
<?php <?php
@ -887,7 +887,7 @@ function install_plugin_information() {
$button = wp_get_plugin_action_button( $api->name, $api, $compatible_php, $compatible_wp ); $button = wp_get_plugin_action_button( $api->name, $api, $compatible_php, $compatible_wp );
$button = str_replace( 'class="', 'class="right ', $button ); $button = str_replace( 'class="', 'class="right ', $button );
if ( ! str_contains( $button, __( 'Activate' ) ) ) { if ( ! str_contains( $button, _x( 'Activate', 'plugin' ) ) ) {
$button = str_replace( 'class="', 'id="plugin_install_from_iframe" class="', $button ); $button = str_replace( 'class="', 'id="plugin_install_from_iframe" class="', $button );
} }
@ -954,7 +954,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
/* translators: %s: Plugin name and version. */ /* translators: %s: Plugin name and version. */
esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ), esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ),
esc_attr( $name ), esc_attr( $name ),
__( 'Install Now' ) _x( 'Install Now', 'plugin' )
); );
if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
@ -969,7 +969,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
/* translators: %s: Plugin name and version. */ /* translators: %s: Plugin name and version. */
esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ), esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ),
esc_attr( $name ), esc_attr( $name ),
__( 'Install Now' ) _x( 'Install Now', 'plugin' )
); );
} else { } else {
$button = sprintf( $button = sprintf(
@ -991,7 +991,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
/* translators: %s: Plugin name and version. */ /* translators: %s: Plugin name and version. */
esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ), esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ),
esc_attr( $name ), esc_attr( $name ),
__( 'Update Now' ) _x( 'Update Now', 'plugin' )
); );
} else { } else {
$button = sprintf( $button = sprintf(
@ -1011,7 +1011,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
); );
} elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
if ( $compatible_php && $compatible_wp && $all_plugin_dependencies_active ) { if ( $compatible_php && $compatible_wp && $all_plugin_dependencies_active ) {
$button_text = __( 'Activate' ); $button_text = _x( 'Activate', 'plugin' );
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
$button_label = _x( 'Activate %s', 'plugin' ); $button_label = _x( 'Activate %s', 'plugin' );
$activate_url = add_query_arg( $activate_url = add_query_arg(
@ -1024,7 +1024,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
); );
if ( is_network_admin() ) { if ( is_network_admin() ) {
$button_text = __( 'Network Activate' ); $button_text = _x( 'Network Activate', 'plugin' );
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
$button_label = _x( 'Network Activate %s', 'plugin' ); $button_label = _x( 'Network Activate %s', 'plugin' );
$activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
@ -1042,7 +1042,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible
} else { } else {
$button = sprintf( $button = sprintf(
'<button type="button" class="button button-disabled" disabled="disabled">%s</button>', '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate', 'plugin' ) is_network_admin() ? _x( 'Network Activate', 'plugin' ) : _x( 'Activate', 'plugin' )
); );
} }
} else { } else {

View File

@ -204,7 +204,7 @@ function install_themes_upload() {
?> ?>
</label> </label>
<input type="file" id="themezip" name="themezip" accept=".zip" /> <input type="file" id="themezip" name="themezip" accept=".zip" />
<?php submit_button( __( 'Install Now' ), '', 'install-theme-submit', false ); ?> <?php submit_button( _x( 'Install Now', 'theme' ), '', 'install-theme-submit', false ); ?>
</form> </form>
<?php <?php
} }

View File

@ -957,7 +957,7 @@
$document.trigger( 'wp-check-plugin-dependencies-success', response ); $document.trigger( 'wp-check-plugin-dependencies-success', response );
if ( 'plugins-network' === pagenow ) { if ( 'plugins-network' === pagenow ) {
buttonText = _x( 'Network Activate' ); buttonText = _x( 'Network Activate', 'plugin' );
ariaLabel = sprintf( ariaLabel = sprintf(
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
_x( 'Network Activate %s', 'plugin' ), _x( 'Network Activate %s', 'plugin' ),
@ -1013,7 +1013,7 @@
*/ */
wp.updates.checkPluginDependenciesError = function( response ) { wp.updates.checkPluginDependenciesError = function( response ) {
var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ), var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
buttonText = __( 'Activate' ), buttonText = _x( 'Activate', 'plugin' ),
ariaLabel = sprintf( ariaLabel = sprintf(
/* translators: 1: Plugin name, 2. The reason the plugin cannot be activated. */ /* translators: 1: Plugin name, 2. The reason the plugin cannot be activated. */
_x( 'Cannot activate %1$s. %2$s', 'plugin' ), _x( 'Cannot activate %1$s. %2$s', 'plugin' ),
@ -1087,7 +1087,7 @@
slug: args.slug, slug: args.slug,
removeClasses: 'installed updated-message button-primary', removeClasses: 'installed updated-message button-primary',
addClasses: 'activating-message', addClasses: 'activating-message',
text: _x( 'Activating...', 'plugin' ), text: __( 'Activating...' ),
ariaLabel: sprintf( ariaLabel: sprintf(
/* translators: %s: Plugin name. */ /* translators: %s: Plugin name. */
_x( 'Activating %s', 'plugin' ), _x( 'Activating %s', 'plugin' ),
@ -1300,7 +1300,7 @@
pluginName pluginName
) )
) )
.text( __( 'Install Now' ) ); .text( _x( 'Install Now', 'plugin' ) );
wp.a11y.speak( errorMessage, 'assertive' ); wp.a11y.speak( errorMessage, 'assertive' );
@ -1454,7 +1454,7 @@
$itemsCount.text( $itemsCount.text(
sprintf( sprintf(
/* translators: %s: The remaining number of plugins. */ /* translators: %s: The remaining number of plugins. */
_nx( '%s item', '%s items', 'plugin/plugins', remainingCount ), _nx( '%s item', '%s items', remainingCount, 'plugin/plugins' ),
remainingCount remainingCount
) )
); );
@ -1803,7 +1803,7 @@
response.themeName response.themeName
) )
) )
.text( __( 'Activate' ) ); .text( _x( 'Activate', 'theme' ) );
} }
} }
@ -2625,7 +2625,7 @@
$message $message
.removeClass( 'updating-message' ) .removeClass( 'updating-message' )
.text( __( 'Install Now' ) ); .text( _x( 'Install Now', 'plugin' ) );
wp.a11y.speak( __( 'Update canceled.' ) ); wp.a11y.speak( __( 'Update canceled.' ) );
} ); } );
@ -2663,7 +2663,7 @@
$activateButton.data( 'name' ) $activateButton.data( 'name' )
) )
) )
.text( _x( 'Activating...', 'plugin' ) ); .text( __( 'Activating...' ) );
wp.updates.activatePlugin( wp.updates.activatePlugin(
{ {
@ -2706,7 +2706,7 @@
pluginName pluginName
) )
) )
.text( __( 'Install Now' ) ); .text( _x( 'Install Now', 'plugin' ) );
wp.a11y.speak( __( 'Update canceled.' ) ); wp.a11y.speak( __( 'Update canceled.' ) );
} ); } );

File diff suppressed because one or more lines are too long

View File

@ -60,7 +60,7 @@ function wp_load_press_this() {
'<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%2$s" aria-label="%3$s">%3$s</a>', '<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%2$s" aria-label="%3$s">%3$s</a>',
esc_url( $url ), esc_url( $url ),
esc_attr( $plugin_slug ), esc_attr( $plugin_slug ),
__( 'Install Now' ) _x( 'Install Now', 'plugin' )
); );
} else { } else {
$action = sprintf( $action = sprintf(

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-beta2-57713'; $wp_version = '6.5-beta2-57714';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.