Make WordPress Core


Ignore:
Timestamp:
09/01/2019 05:12:43 PM (5 years ago)
Author:
SergeyBiryukov
Message:

I18N: Improve translator comments.

  • Add missing translator comments.
  • Fix placement of some translator comments. Translator 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 translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-theme-installer-skin.php

    r43598 r45926  
    4343    public function before() {
    4444        if ( ! empty( $this->api ) ) {
    45             $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version );
     45            $this->upgrader->strings['process_success'] = sprintf(
     46                $this->upgrader->strings['process_success_specific'],
     47                $this->api->name,
     48                $this->api->version
     49            );
    4650        }
    4751    }
     
    7680
    7781        if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
    78             $customize_url               = add_query_arg(
     82            $customize_url = add_query_arg(
    7983                array(
    8084                    'theme'  => urlencode( $stylesheet ),
     
    8387                admin_url( 'customize.php' )
    8488            );
    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>';
     89
     90            $install_actions['preview'] = sprintf(
     91                '<a href="%s" class="hide-if-no-customize load-customize">' .
     92                '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     93                esc_url( $customize_url ),
     94                __( 'Live Preview' ),
     95                /* translators: %s: theme name */
     96                sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name )
     97            );
     98        }
     99
     100        $install_actions['activate'] = sprintf(
     101            '<a href="%s" class="activatelink">' .
     102            '<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     103            esc_url( $activate_link ),
     104            __( 'Activate' ),
    87105            /* translators: %s: theme name */
    88             $install_actions['preview'] .= '<span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
    89         }
    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>';
     106            sprintf( __( 'Activate &#8220;%s&#8221;' ), $name )
     107        );
    94108
    95109        if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) {
    96             $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
     110            $install_actions['network_enable'] = sprintf(
     111                '<a href="%s" target="_parent">%s</a>',
     112                esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ),
     113                __( 'Network Enable' )
     114            );
    97115        }
    98116
    99117        if ( $this->type == 'web' ) {
    100             $install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>';
     118            $install_actions['themes_page'] = sprintf(
     119                '<a href="%s" target="_parent">%s</a>',
     120                self_admin_url( 'theme-install.php' ),
     121                __( 'Return to Theme Installer' )
     122            );
    101123        } elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) {
    102             $install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
     124            $install_actions['themes_page'] = sprintf(
     125                '<a href="%s" target="_parent">%s</a>',
     126                self_admin_url( 'themes.php' ),
     127                __( 'Return to Themes page' )
     128            );
    103129        }
    104130
Note: See TracChangeset for help on using the changeset viewer.