Update/Install: Give context to some more install/update strings to allow for differentiation between theme and plugin translations.

Fixes #39747. See #37290.

git-svn-id: https://develop.svn.wordpress.org/trunk@40034 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2017-01-31 09:26:52 +00:00
parent a52789b8b9
commit b732afec11
3 changed files with 29 additions and 25 deletions

View File

@ -371,11 +371,11 @@
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
$updateRow = $( 'tr[data-plugin="' + args.plugin + '"]' );
$message = $updateRow.find( '.update-message' ).removeClass( 'notice-error' ).addClass( 'updating-message notice-warning' ).find( 'p' );
message = wp.updates.l10n.updatingLabel.replace( '%s', $updateRow.find( '.plugin-title strong' ).text() );
message = wp.updates.l10n.pluginUpdatingLabel.replace( '%s', $updateRow.find( '.plugin-title strong' ).text() );
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
$card = $( '.plugin-card-' + args.slug );
$message = $card.find( '.update-now' ).addClass( 'updating-message' );
message = wp.updates.l10n.updatingLabel.replace( '%s', $message.data( 'name' ) );
message = wp.updates.l10n.pluginUpdatingLabel.replace( '%s', $message.data( 'name' ) );
// Remove previous error messages, if any.
$card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove();
@ -429,8 +429,8 @@
}
$updateMessage
.attr( 'aria-label', wp.updates.l10n.updatedLabel.replace( '%s', response.pluginName ) )
.text( wp.updates.l10n.updated );
.attr( 'aria-label', wp.updates.l10n.pluginUpdatedLabel.replace( '%s', response.pluginName ) )
.text( wp.updates.l10n.pluginUpdated );
wp.a11y.speak( wp.updates.l10n.updatedMsg, 'polite' );
@ -476,7 +476,7 @@
if ( response.pluginName ) {
$message.find( 'p' )
.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
.attr( 'aria-label', wp.updates.l10n.pluginUpdateFailedLabel.replace( '%s', response.pluginName ) );
} else {
$message.find( 'p' ).removeAttr( 'aria-label' );
}
@ -493,7 +493,7 @@
if ( response.pluginName ) {
$card.find( '.update-now' )
.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', response.pluginName ) );
.attr( 'aria-label', wp.updates.l10n.pluginUpdateFailedLabel.replace( '%s', response.pluginName ) );
} else {
$card.find( '.update-now' ).removeAttr( 'aria-label' );
}
@ -580,7 +580,7 @@
.removeClass( 'updating-message' )
.addClass( 'updated-message installed button-disabled' )
.attr( 'aria-label', wp.updates.l10n.pluginInstalledLabel.replace( '%s', response.pluginName ) )
.text( wp.updates.l10n.installed );
.text( wp.updates.l10n.pluginInstalled );
wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
@ -965,7 +965,7 @@
$theme = $( '[data-slug="' + response.slug + '"]' ),
updatedMessage = {
className: 'updated-message notice-success notice-alt',
message: wp.updates.l10n.updated
message: wp.updates.l10n.themeUpdated
},
$notice, newText;
@ -1102,7 +1102,7 @@
.removeClass( 'updating-message' )
.addClass( 'updated-message disabled' )
.attr( 'aria-label', wp.updates.l10n.themeInstalledLabel.replace( '%s', response.themeName ) )
.text( wp.updates.l10n.installed );
.text( wp.updates.l10n.themeInstalled );
wp.a11y.speak( wp.updates.l10n.installedMsg, 'polite' );
@ -1776,9 +1776,9 @@
if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
if ( 'update-plugin' === job.action ) {
$message.attr( 'aria-label', wp.updates.l10n.updateNowLabel.replace( '%s', $message.data( 'name' ) ) );
$message.attr( 'aria-label', wp.updates.l10n.pluginUpdateNowLabel.replace( '%s', $message.data( 'name' ) ) );
} else if ( 'install-plugin' === job.action ) {
$message.attr( 'aria-label', wp.updates.l10n.installNowLabel.replace( '%s', $message.data( 'name' ) ) );
$message.attr( 'aria-label', wp.updates.l10n.pluginInstallNowLabel.replace( '%s', $message.data( 'name' ) ) );
}
}
}

View File

@ -637,20 +637,21 @@ function wp_default_scripts( &$scripts ) {
'noPlugins' => __( 'You do not appear to have any plugins available at this time.' ),
'noItemsSelected' => __( 'Please select at least one item to perform this action on.' ),
'updating' => __( 'Updating...' ), // No ellipsis.
'updated' => __( 'Updated!' ),
'pluginUpdated' => _x( 'Updated!', 'plugin' ),
'themeUpdated' => _x( 'Updated!', 'theme' ),
'update' => __( 'Update' ),
'updateNow' => __( 'Update Now' ),
/* translators: %s: Plugin name and version */
'updateNowLabel' => __( 'Update %s now' ),
'pluginUpdateNowLabel' => _x( 'Update %s now', 'plugin' ),
'updateFailedShort' => __( 'Update Failed!' ),
/* translators: %s: Error string for a failed update */
'updateFailed' => __( 'Update Failed: %s' ),
/* translators: %s: Plugin name and version */
'updatingLabel' => __( 'Updating %s...' ), // No ellipsis.
'pluginUpdatingLabel' => _x( 'Updating %s...', 'plugin' ), // No ellipsis.
/* translators: %s: Plugin name and version */
'updatedLabel' => __( '%s updated!' ),
'pluginUpdatedLabel' => _x( '%s updated!', 'plugin' ),
/* translators: %s: Plugin name and version */
'updateFailedLabel' => __( '%s update failed' ),
'pluginUpdateFailedLabel' => _x( '%s update failed', 'plugin' ),
/* translators: Accessibility text */
'updatingMsg' => __( 'Updating... please wait.' ), // No ellipsis.
/* translators: Accessibility text */
@ -660,9 +661,10 @@ function wp_default_scripts( &$scripts ) {
'beforeunload' => __( 'Updates may not complete if you navigate away from this page.' ),
'installNow' => __( 'Install Now' ),
/* translators: %s: Plugin name */
'installNowLabel' => __( 'Install %s now' ),
'pluginInstallNowLabel' => _x( 'Install %s now', 'plugin' ),
'installing' => __( 'Installing...' ),
'installed' => __( 'Installed!' ),
'pluginInstalled' => _x( 'Installed!', 'plugin' ),
'themeInstalled' => _x( 'Installed!', 'theme' ),
'installFailedShort' => __( 'Install Failed!' ),
/* translators: %s: Error string for a failed installation */
'installFailed' => __( 'Installation failed: %s' ),

View File

@ -6,23 +6,25 @@ window._wpUpdatesSettings = {
'noPlugins': 'You do not appear to have any plugins available at this time.',
'noItemsSelected': 'Please select at least one item to perform this action on.',
'updating': 'Updating...',
'updated': 'Updated!',
'pluginUpdated': 'Updated!',
'themeUpdated': 'Updated!',
'update': 'Update',
'updateNow': 'Update Now',
'updateNowLabel': 'Update %s now',
'pluginUpdateNowLabel': 'Update %s now',
'updateFailedShort': 'Update Failed!',
'updateFailed': 'Update Failed: %s',
'updatingLabel': 'Updating %s...',
'updatedLabel': '%s updated!',
'updateFailedLabel': '%s update failed',
'pluginUpdatingLabel': 'Updating %s...',
'pluginUpdatedLabel': '%s updated!',
'pluginUpdateFailedLabel': '%s update failed',
'updatingMsg': 'Updating... please wait.',
'updatedMsg': 'Update completed successfully.',
'updateCancel': 'Update canceled.',
'beforeunload': 'Updates may not complete if you navigate away from this page.',
'installNow': 'Install Now',
'installNowLabel': 'Install %s now',
'pluginInstallNowLabel': 'Install %s now',
'installing': 'Installing...',
'installed': 'Installed!',
'pluginInstalled': 'Installed!',
'themeInstalled': 'Installed!',
'installFailedShort': 'Install Failed!',
'installFailed': 'Installation failed: %s',
'pluginInstallingLabel': 'Installing %s...', // No ellipsis