Make WordPress Core

Changeset 57714


Ignore:
Timestamp:
02/26/2024 08:33:46 PM (12 months ago)
Author:
swissspidy
Message:

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.

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/updates.js

    r57696 r57714  
    958958
    959959        if ( 'plugins-network' === pagenow ) {
    960             buttonText = _x( 'Network Activate' );
     960            buttonText = _x( 'Network Activate', 'plugin' );
    961961            ariaLabel  = sprintf(
    962962                /* translators: %s: Plugin name. */
     
    10141014    wp.updates.checkPluginDependenciesError = function( response ) {
    10151015        var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
    1016             buttonText = __( 'Activate' ),
     1016            buttonText = _x( 'Activate', 'plugin' ),
    10171017            ariaLabel = sprintf(
    10181018                /* translators: 1: Plugin name, 2. The reason the plugin cannot be activated. */
     
    10881088                    removeClasses: 'installed updated-message button-primary',
    10891089                    addClasses: 'activating-message',
    1090                     text: _x( 'Activating...', 'plugin' ),
     1090                    text: __( 'Activating...' ),
    10911091                    ariaLabel: sprintf(
    10921092                        /* translators: %s: Plugin name. */
     
    13011301                )
    13021302            )
    1303             .text( __( 'Install Now' ) );
     1303            .text( _x( 'Install Now', 'plugin' ) );
    13041304
    13051305        wp.a11y.speak( errorMessage, 'assertive' );
     
    14551455                    sprintf(
    14561456                        /* translators: %s: The remaining number of plugins. */
    1457                         _nx( '%s item', '%s items', 'plugin/plugins', remainingCount ),
     1457                        _nx( '%s item', '%s items', remainingCount, 'plugin/plugins' ),
    14581458                        remainingCount
    14591459                    )
     
    18041804                            )
    18051805                        )
    1806                         .text( __( 'Activate' ) );
     1806                        .text( _x( 'Activate', 'theme' ) );
    18071807                }
    18081808            }
     
    26262626                    $message
    26272627                        .removeClass( 'updating-message' )
    2628                         .text( __( 'Install Now' ) );
     2628                        .text( _x( 'Install Now', 'plugin' ) );
    26292629
    26302630                    wp.a11y.speak( __( 'Update canceled.' ) );
     
    26642664                    )
    26652665                )
    2666                 .text( _x( 'Activating...', 'plugin' ) );
     2666                .text( __( 'Activating...' ) );
    26672667
    26682668            wp.updates.activatePlugin(
     
    27072707                            )
    27082708                        )
    2709                         .text( __( 'Install Now' ) );
     2709                        .text( _x( 'Install Now', 'plugin' ) );
    27102710
    27112711                    wp.a11y.speak( __( 'Update canceled.' ) );
  • trunk/src/wp-admin/import.php

    r56600 r57714  
    164164                        /* translators: %s: Importer name. */
    165165                        esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $data[0] ) ),
    166                         __( 'Install Now' )
     166                        _x( 'Install Now', 'plugin' )
    167167                    );
    168168                } else {
  • trunk/src/wp-admin/includes/class-plugin-installer-skin.php

    r55911 r57714  
    122122                '<a class="button button-primary" href="%s" target="_parent">%s</a>',
    123123                wp_nonce_url( 'plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ),
    124                 __( 'Network Activate' )
     124                _x( 'Network Activate', 'plugin' )
    125125            );
    126126            unset( $install_actions['activate_plugin'] );
  • trunk/src/wp-admin/includes/class-theme-installer-skin.php

    r55911 r57714  
    139139            '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
    140140            esc_url( $activate_link ),
    141             __( 'Activate' ),
     141            _x( 'Activate', 'theme' ),
    142142            /* translators: Hidden accessibility text. %s: Theme name. */
    143143            sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $name )
  • trunk/src/wp-admin/includes/class-theme-upgrader-skin.php

    r55911 r57714  
    111111                    '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
    112112                    esc_url( $activate_link ),
    113                     __( 'Activate' ),
     113                    _x( 'Activate', 'theme' ),
    114114                    /* translators: Hidden accessibility text. %s: Theme name. */
    115115                    sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $name )
  • trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php

    r57644 r57714  
    757757                        )
    758758                    ),
    759                     __( 'Activate' )
     759                    _x( 'Activate', 'site' )
    760760                );
    761761            } else {
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r57620 r57714  
    608608
    609609        if ( 'active' !== $status ) {
    610             $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
     610            $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? _x( 'Network Activate', 'plugin' ) : _x( 'Activate', 'plugin' );
    611611        }
    612612
    613613        if ( 'inactive' !== $status && 'recent' !== $status ) {
    614             $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
     614            $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? _x( 'Network Deactivate', 'plugin' ) : _x( 'Deactivate', 'plugin' );
    615615        }
    616616
     
    821821                                /* translators: %s: Plugin name. */
    822822                                esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ),
    823                                 __( 'Network Deactivate' )
     823                                _x( 'Network Deactivate', 'plugin' )
    824824                            );
    825825                        }
     
    829829                        if ( $compatible_php && $compatible_wp ) {
    830830                            if ( $has_unmet_dependencies ) {
    831                                 $actions['activate'] = __( 'Network Activate' ) .
     831                                $actions['activate'] = _x( 'Network Activate', 'plugin' ) .
    832832                                    '<span class="screen-reader-text">' .
    833833                                    __( 'You cannot activate this plugin as it has unmet requirements.' ) .
     
    846846                                    /* translators: %s: Plugin name. */
    847847                                    esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
    848                                     __( 'Network Activate' )
     848                                    _x( 'Network Activate', 'plugin' )
    849849                                );
    850850                            }
     
    935935                        if ( $compatible_php && $compatible_wp ) {
    936936                            if ( $has_unmet_dependencies ) {
    937                                 $actions['activate'] = __( 'Activate' ) .
     937                                $actions['activate'] = _x( 'Activate', 'plugin' ) .
    938938                                    '<span class="screen-reader-text">' .
    939939                                    __( 'You cannot activate this plugin as it has unmet requirements.' ) .
     
    952952                                    /* translators: %s: Plugin name. */
    953953                                    esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ),
    954                                     __( 'Activate' )
     954                                    _x( 'Activate', 'plugin' )
    955955                                );
    956956                            }
     
    15331533        }
    15341534
    1535         $dependency_note = __( 'Note: this plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.' );
     1535        $dependency_note = __( 'Note: This plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.' );
     1536
     1537        $comma       = wp_get_list_item_separator();
     1538        $required_by = sprintf(
     1539            /* translators: %s: List of dependencies. */
     1540            __( '<strong>Required by:</strong> %s' ),
     1541            implode( $comma, $dependent_names )
     1542        );
     1543
    15361544        printf(
    1537             '<div class="required-by"><p><strong>%1$s</strong> %2$s</p><p>%3$s</p></div>',
    1538             __( 'Required by:' ),
    1539             esc_html( implode( ' | ', $dependent_names ) ),
     1545            '<div class="required-by"><p>%1$s</p><p>%2$s</p></div>',
     1546            $required_by,
    15401547            $dependency_note
    15411548        );
     
    15611568        }
    15621569
    1563         $dependency_note = __( 'Note: this plugin cannot be activated until the plugins that are required by it are activated.' );
     1570        $dependency_note = __( 'Note: This plugin cannot be activated until the plugins that are required by it are activated.' );
     1571
     1572        $comma    = wp_get_list_item_separator();
     1573        $requires = sprintf(
     1574            /* translators: %s: List of dependency names. */
     1575            __( '<strong>Requires:</strong> %s' ),
     1576            implode( $comma, $links )
     1577        );
    15641578
    15651579        printf(
    1566             '<div class="requires"><p><strong>%1$s</strong> %2$s</p><p>%3$s</p></div>',
    1567             __( 'Requires:' ),
    1568             implode( ' | ', $links ),
     1580            '<div class="requires"><p>%1$s</p><p>%2$s</p></div>',
     1581            $requires,
    15691582            $dependency_note
    15701583        );
  • trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php

    r55911 r57714  
    334334                    /* translators: %s: Theme name. */
    335335                    esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
    336                     __( 'Install Now' )
     336                    _x( 'Install Now', 'theme' )
    337337                );
    338338                break;
  • trunk/src/wp-admin/includes/class-wp-themes-list-table.php

    r55732 r57714  
    213213                /* translators: %s: Theme name. */
    214214                esc_attr( sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $title ) ),
    215                 __( 'Activate' )
     215                _x( 'Activate', 'theme' )
    216216            );
    217217
  • trunk/src/wp-admin/includes/plugin-install.php

    r57658 r57714  
    362362        </label>
    363363        <input type="file" id="pluginzip" name="pluginzip" accept=".zip" />
    364         <?php submit_button( __( 'Install Now' ), '', 'install-plugin-submit', false ); ?>
     364        <?php submit_button( _x( 'Install Now', 'plugin' ), '', 'install-plugin-submit', false ); ?>
    365365    </form>
    366366</div>
     
    888888        $button = str_replace( 'class="', 'class="right ', $button );
    889889
    890         if ( ! str_contains( $button, __( 'Activate' ) ) ) {
     890        if ( ! str_contains( $button, _x( 'Activate', 'plugin' ) ) ) {
    891891            $button = str_replace( 'class="', 'id="plugin_install_from_iframe" class="', $button );
    892892        }
     
    955955        esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ),
    956956        esc_attr( $name ),
    957         __( 'Install Now' )
     957        _x( 'Install Now', 'plugin' )
    958958    );
    959959
     
    970970                            esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ),
    971971                            esc_attr( $name ),
    972                             __( 'Install Now' )
     972                            _x( 'Install Now', 'plugin' )
    973973                        );
    974974                    } else {
     
    992992                            esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ),
    993993                            esc_attr( $name ),
    994                             __( 'Update Now' )
     994                            _x( 'Update Now', 'plugin' )
    995995                        );
    996996                    } else {
     
    10121012                } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
    10131013                    if ( $compatible_php && $compatible_wp && $all_plugin_dependencies_active ) {
    1014                         $button_text = __( 'Activate' );
     1014                        $button_text = _x( 'Activate', 'plugin' );
    10151015                        /* translators: %s: Plugin name. */
    10161016                        $button_label = _x( 'Activate %s', 'plugin' );
     
    10251025
    10261026                        if ( is_network_admin() ) {
    1027                             $button_text = __( 'Network Activate' );
     1027                            $button_text = _x( 'Network Activate', 'plugin' );
    10281028                            /* translators: %s: Plugin name. */
    10291029                            $button_label = _x( 'Network Activate %s', 'plugin' );
     
    10431043                        $button = sprintf(
    10441044                            '<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
    1045                             is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate', 'plugin' )
     1045                            is_network_admin() ? _x( 'Network Activate', 'plugin' ) : _x( 'Activate', 'plugin' )
    10461046                        );
    10471047                    }
  • trunk/src/wp-admin/includes/theme-install.php

    r56548 r57714  
    205205    </label>
    206206    <input type="file" id="themezip" name="themezip" accept=".zip" />
    207     <?php submit_button( __( 'Install Now' ), '', 'install-theme-submit', false ); ?>
     207    <?php submit_button( _x( 'Install Now', 'theme' ), '', 'install-theme-submit', false ); ?>
    208208</form>
    209209    <?php
  • trunk/src/wp-admin/press-this.php

    r47198 r57714  
    6161                    esc_url( $url ),
    6262                    esc_attr( $plugin_slug ),
    63                     __( 'Install Now' )
     63                    _x( 'Install Now', 'plugin' )
    6464                );
    6565            } else {
Note: See TracChangeset for help on using the changeset viewer.