Make WordPress Core

Changeset 43598


Ignore:
Timestamp:
08/30/2018 01:35:27 PM (8 years ago)
Author:
jrf
Message:

I18n: Improve translators comments [3].

  • Add missing translators comments.
  • Fix placement of some translators comments. Translators comments should be on the line directly above the line containing the translation function call for optimal compatibility with various .pot file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translators comments.

Includes minor code layout fixes.

Patch 44360-wp-admin-includes-dir.patch of the series.

Props flipkeijzer, alvarogois, michielatyoast
See #44360

Location:
trunk/src/wp-admin/includes
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r43571 r43598  
    391391                                        'in_moderation'        => $counts->moderated,
    392392                                        'i18n_comments_text'   => sprintf(
     393                                                /* translators: %s: number of comments approved */
    393394                                                _n( '%s Comment', '%s Comments', $counts->approved ),
    394395                                                number_format_i18n( $counts->approved )
    395396                                        ),
    396397                                        'i18n_moderation_text' => sprintf(
     398                                                /* translators: %s: number of comments in moderation */
    397399                                                _nx( '%s in moderation', '%s in moderation', $counts->moderated, 'comments' ),
    398400                                                number_format_i18n( $counts->moderated )
     
    453455                                'status'           => $comment ? $comment->comment_approved : '',
    454456                                'postId'           => $comment ? $comment->comment_post_ID : '',
     457                                /* translators: %s: number of comments */
    455458                                'total_items_i18n' => sprintf( _n( '%s item', '%s items', $total ), number_format_i18n( $total ) ),
    456459                                'total_pages'      => ceil( $total / $per_page ),
     
    836839                        array(
    837840                                'what' => 'comment',
     841                                /* translators: %d: comment ID */
    838842                                'id'   => new WP_Error( 'invalid_comment', sprintf( __( 'Comment %d does not exist' ), $id ) ),
    839843                        )
     
    12151219                'in_moderation'        => $counts->moderated,
    12161220                'i18n_comments_text'   => sprintf(
     1221                        /* translators: %s: number of comments approved */
    12171222                        _n( '%s Comment', '%s Comments', $counts->approved ),
    12181223                        number_format_i18n( $counts->approved )
    12191224                ),
    12201225                'i18n_moderation_text' => sprintf(
     1226                        /* translators: %s: number of comments moderated */
    12211227                        _nx( '%s in moderation', '%s in moderation', $counts->moderated, 'comments' ),
    12221228                        number_format_i18n( $counts->moderated )
     
    18141820                $last_user      = get_userdata( $last );
    18151821                $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
    1816                 printf( $_POST['post_type'] == 'page' ? __( 'Saving is disabled: %s is currently editing this page.' ) : __( 'Saving is disabled: %s is currently editing this post.' ), esc_html( $last_user_name ) );
     1822
     1823                /* translators: %s: user who is currently editing the post */
     1824                $msg_template = __( 'Saving is disabled: %s is currently editing this post.' );
     1825                if ( $_POST['post_type'] == 'page' ) {
     1826                        /* translators: %s: user who is currently editing the page */
     1827                        $msg_template = __( 'Saving is disabled: %s is currently editing this page.' );
     1828                }
     1829
     1830                printf( $msg_template, esc_html( $last_user_name ) );
    18171831                wp_die();
    18181832        }
     
    25092523
    25102524        if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) {
    2511                 $last_user   = get_userdata( $last_id );
     2525                $last_user = get_userdata( $last_id );
     2526                /* translators: 1: display_name of last user, 2: date of last edit, 3: time of last edit. */
    25122527                $last_edited = sprintf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), $last_date, $last_time );
    25132528        } else {
     2529                /* translators: 1: date of last edit, 2: time of last edit. */
    25142530                $last_edited = sprintf( __( 'Last edited on %1$s at %2$s' ), $last_date, $last_time );
    25152531        }
     
    33373353                        array(
    33383354                                'type'    => 'not-embeddable',
     3355                                /* translators: %s: URL which cannot be embedded, between code tags */
    33393356                                'message' => sprintf( __( '%s failed to embed.' ), '<code>' . esc_html( $url ) . '</code>' ),
    33403357                        )
  • trunk/src/wp-admin/includes/bookmark.php

    r42871 r43598  
    320320        if ( $really_can_manage_links && current_user_can( 'install_plugins' ) ) {
    321321                $link = network_admin_url( 'plugin-install.php?tab=search&amp;s=Link+Manager' );
     322                /* translators: %s: URL of link manager plugin */
    322323                wp_die( sprintf( __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager</a> plugin.' ), $link ) );
    323324        }
  • trunk/src/wp-admin/includes/class-bulk-plugin-upgrader-skin.php

    r42873 r43598  
    2121        public function add_strings() {
    2222                parent::add_strings();
     23                /* translators: 1: name of plugin being updated, 2: number of updating plugin, 3: total number of plugins being updated */
    2324                $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)' );
    2425        }
  • trunk/src/wp-admin/includes/class-bulk-theme-upgrader-skin.php

    r42871 r43598  
    2121        public function add_strings() {
    2222                parent::add_strings();
     23                /* translators: 1: name of theme being updated, 2: number of updating themes, 3: total number of themes being updated */
    2324                $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Theme %1$s (%2$d/%3$d)' );
    2425        }
  • trunk/src/wp-admin/includes/class-language-pack-upgrader-skin.php

    r42871 r43598  
    4848                echo '<div class="update-messages lp-show-latest">';
    4949
     50                /* translators: 1: name of project, 2: language */
    5051                printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
    5152        }
  • trunk/src/wp-admin/includes/class-language-pack-upgrader.php

    r43571 r43598  
    344344                                'incompatible_archive_pomo',
    345345                                $this->strings['incompatible_archive'],
    346                                 /* translators: 1: .po, 2: .mo */
    347346                                sprintf(
     347                                        /* translators: 1: .po, 2: .mo */
    348348                                        __( 'The language pack is missing either the %1$s or %2$s files.' ),
    349349                                        '<code>.po</code>',
  • trunk/src/wp-admin/includes/class-plugin-installer-skin.php

    r42871 r43598  
    4343        public function before() {
    4444                if ( ! empty( $this->api ) ) {
     45                        /* translators: 1: name of API, 2: version of API */
    4546                        $this->upgrader->strings['process_success'] = sprintf( __( 'Successfully installed the plugin <strong>%1$s %2$s</strong>.' ), $this->api->name, $this->api->version );
    4647                }
  • trunk/src/wp-admin/includes/class-theme-installer-skin.php

    r43571 r43598  
    7676
    7777                if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
    78                         $customize_url              = add_query_arg(
     78                        $customize_url               = add_query_arg(
    7979                                array(
    8080                                        'theme'  => urlencode( $stylesheet ),
     
    8383                                admin_url( 'customize.php' )
    8484                        );
    85                         $install_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
     85                        $install_actions['preview']  = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize">';
     86                        $install_actions['preview'] .= '<span aria-hidden="true">' . __( 'Live Preview' ) . '</span>';
     87                        /* translators: %s: theme name */
     88                        $install_actions['preview'] .= '<span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
    8689                }
    87                 $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
     90                $install_actions['activate']  = '<a href="' . esc_url( $activate_link ) . '" class="activatelink">';
     91                $install_actions['activate'] .= '<span aria-hidden="true">' . __( 'Activate' ) . '</span>';
     92                /* translators: %s: theme name */
     93                $install_actions['activate'] .= '<span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
    8894
    8995                if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) {
  • trunk/src/wp-admin/includes/class-theme-upgrader-skin.php

    r43571 r43598  
    6666                        if ( get_stylesheet() == $stylesheet ) {
    6767                                if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
    68                                         $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>';
     68                                        $update_actions['preview']  = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize">';
     69                                        $update_actions['preview'] .= '<span aria-hidden="true">' . __( 'Customize' ) . '</span>';
     70                                        /* translators: %s: theme name */
     71                                        $update_actions['preview'] .= '<span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>';
    6972                                }
    7073                        } elseif ( current_user_can( 'switch_themes' ) ) {
    7174                                if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
    72                                         $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
     75                                        $update_actions['preview']  = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize">';
     76                                        $update_actions['preview'] .= '<span aria-hidden="true">' . __( 'Live Preview' ) . '</span>';
     77                                        /* translators: %s: theme name */
     78                                        $update_actions['preview'] .= '<span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
    7379                                }
    74                                 $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
     80                                $update_actions['activate']  = '<a href="' . esc_url( $activate_link ) . '" class="activatelink">';
     81                                $update_actions['activate'] .= '<span aria-hidden="true">' . __( 'Activate' ) . '</span>';
     82                                /* translators: %s: theme name */
     83                                $update_actions['activate'] .= '<span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
    7584                        }
    7685
  • trunk/src/wp-admin/includes/class-theme-upgrader.php

    r43571 r43598  
    474474                                'incompatible_archive_theme_no_style',
    475475                                $this->strings['incompatible_archive'],
    476                                 /* translators: %s: style.css */
    477476                                sprintf(
     477                                        /* translators: %s: style.css */
    478478                                        __( 'The theme is missing the %s stylesheet.' ),
    479479                                        '<code>style.css</code>'
     
    494494                                'incompatible_archive_theme_no_name',
    495495                                $this->strings['incompatible_archive'],
    496                                 /* translators: %s: style.css */
    497496                                sprintf(
     497                                        /* translators: %s: style.css */
    498498                                        __( 'The %s stylesheet doesn&#8217;t contain a valid theme header.' ),
    499499                                        '<code>style.css</code>'
     
    507507                                'incompatible_archive_theme_no_index',
    508508                                $this->strings['incompatible_archive'],
    509                                 /* translators: %s: index.php */
    510509                                sprintf(
     510                                        /* translators: %s: index.php */
    511511                                        __( 'The theme is missing the %s file.' ),
    512512                                        '<code>index.php</code>'
  • trunk/src/wp-admin/includes/class-walker-nav-menu-checklist.php

    r42343 r43598  
    9696                        $title = apply_filters( 'the_title', $item->post_title, $item->ID );
    9797                        if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) {
     98                                /* translators: %s: front page title */
    9899                                $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title );
    99100                        }
  • trunk/src/wp-admin/includes/class-walker-nav-menu-edit.php

    r43571 r43598  
    218218                                        <?php if ( 'custom' != $item->type && $original_title !== false ) : ?>
    219219                                                <p class="link-to-original">
    220                                                         <?php printf( __( 'Original: %s' ), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
     220                                                        <?php
     221                                                        /* translators: %s: original title */
     222                                                        printf( __( 'Original: %s' ), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' );
     223                                                        ?>
    221224                                                </p>
    222225                                        <?php endif; ?>
  • trunk/src/wp-admin/includes/class-wp-automatic-updater.php

    r43571 r43598  
    308308                switch ( $type ) {
    309309                        case 'core':
     310                                /* translators: %s: WordPress version */
    310311                                $skin->feedback( __( 'Updating to WordPress %s' ), $item->version );
     312                                /* translators: %s: WordPress version */
    311313                                $item_name = sprintf( __( 'WordPress %s' ), $item->version );
    312314                                break;
     
    315317                                $theme         = wp_get_theme( $upgrader_item );
    316318                                $item_name     = $theme->Get( 'Name' );
     319                                /* translators: %s: Theme name */
    317320                                $skin->feedback( __( 'Updating theme: %s' ), $item_name );
    318321                                break;
     
    321324                                $plugin_data   = get_plugin_data( $context . '/' . $upgrader_item );
    322325                                $item_name     = $plugin_data['Name'];
     326                                /* translators: %s: Plugin name */
    323327                                $skin->feedback( __( 'Updating plugin: %s' ), $item_name );
    324328                                break;
    325329                        case 'translation':
    326330                                $language_item_name = $upgrader->get_name_for_update( $item );
    327                                 $item_name          = sprintf( __( 'Translations for %s' ), $language_item_name );
     331                                /* translators: %s: Name of language item */
     332                                $item_name = sprintf( __( 'Translations for %s' ), $language_item_name );
     333                                /* translators: 1: Name of language item, 2: Language */
    328334                                $skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)&#8230;' ), $language_item_name, $item->language ) );
    329335                                break;
     
    663669                switch ( $type ) {
    664670                        case 'success':
     671                                /* translators: 1: Home URL, 2: WordPress version */
    665672                                $body .= sprintf( __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ), home_url(), $core_update->current );
    666673                                $body .= "\n\n";
     
    671678                                // Can only reference the About screen if their update was successful.
    672679                                list( $about_version ) = explode( '-', $core_update->current, 2 );
    673                                 $body                 .= sprintf( __( 'For more on version %s, see the About WordPress screen:' ), $about_version );
    674                                 $body                 .= "\n" . admin_url( 'about.php' );
     680                                /* translators: %s: WordPress core version */
     681                                $body .= sprintf( __( 'For more on version %s, see the About WordPress screen:' ), $about_version );
     682                                $body .= "\n" . admin_url( 'about.php' );
    675683
    676684                                if ( $newer_version_available ) {
     685                                        /* translators: %s: WordPress core latest version */
    677686                                        $body .= "\n\n" . sprintf( __( 'WordPress %s is also now available.' ), $next_user_core_update->current ) . ' ';
    678687                                        $body .= __( 'Updating is easy and only takes a few moments:' );
     
    684693                        case 'fail':
    685694                        case 'manual':
     695                                /* translators: 1: Home URL, 2: WordPress core latest version */
    686696                                $body .= sprintf( __( 'Please update your site at %1$s to WordPress %2$s.' ), home_url(), $next_user_core_update->current );
    687697
     
    700710                        case 'critical':
    701711                                if ( $newer_version_available ) {
     712                                        /* translators: 1: Home URL, 2: WordPress core latest version */
    702713                                        $body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), home_url(), $core_update->current );
    703714                                } else {
     715                                        /* translators: 1: Home URL, 2: Core update version */
    704716                                        $body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), home_url(), $core_update->current );
    705717                                }
     
    715727                if ( $critical_support ) {
    716728                        // Support offer if available.
     729                        /* translators: %s: Support e-mail */
    717730                        $body .= "\n\n" . sprintf( __( 'The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working.' ), $core_update->support_email );
    718731                } else {
     
    741754                if ( 'critical' == $type && is_wp_error( $result ) ) {
    742755                        $body .= "\n***\n\n";
     756                        /* translators: %s: WordPress version */
    743757                        $body .= sprintf( __( 'Your site was running version %s.' ), get_bloginfo( 'version' ) );
    744758                        $body .= ' ' . __( 'We have some data that describes the error your site encountered.' );
     
    758772                                }
    759773                                $error_code = $error->get_error_code();
    760                                 $body      .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code );
     774                                /* translators: %s: Error code */
     775                                $body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code );
    761776                                if ( 'rollback_was_required' == $error_code ) {
    762777                                        continue;
     
    816831                $failures = 0;
    817832
     833                /* translators: %s: Network home URL */
    818834                $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );
    819835
     
    822838                        $result = $this->update_results['core'][0];
    823839                        if ( $result->result && ! is_wp_error( $result->result ) ) {
     840                                /* translators: %s: WordPress core version */
    824841                                $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name );
    825842                        } else {
     843                                /* translators: %s: WordPress core version */
    826844                                $body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name );
    827845                                $failures++;
     
    845863                                $body[] = $messages[ $type ];
    846864                                foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) {
     865                                        /* translators: %s: name of plugin / theme / translations */
    847866                                        $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name );
    848867                                }
     
    859878                                foreach ( $this->update_results[ $type ] as $item ) {
    860879                                        if ( ! $item->result || is_wp_error( $item->result ) ) {
     880                                                /* translators: %s: name of plugin / theme / translations */
    861881                                                $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name );
    862882                                                $failures++;
     
    885905                        $body[] = '';
    886906
     907                        /* translators: %s: site title */
    887908                        $subject = sprintf( __( '[%s] There were failures during background updates' ), $site_title );
    888909                } else {
     910                        /* translators: %s: site title */
    889911                        $subject = sprintf( __( '[%s] Background updates have finished' ), $site_title );
    890912                }
Note: See TracChangeset for help on using the changeset viewer.