Making WordPress.org

Changeset 6164


Ignore:
Timestamp:
11/23/2017 11:46:23 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Plugin Directory, Author Card: Make strings translatable, for consistency with the rest of the plugin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-author-card.php

    r6162 r6164  
    5858                                <?php
    5959                                        $author_links = array(
    60                                                 '<a href="//make.wordpress.org/pluginrepo/?s=' . urlencode( esc_attr( $author->user_nicename ) ) . '" title="Click to search Pluginrepo P2 for mention of this author">P2</a>',
    61                                                 '<a href="https://supportpress.wordpress.org/plugins/?q=' . urlencode( esc_attr( $author->user_nicename ) ) . '&status=&todo=Search+%C2%BB" title="Click to search Pluginrepo SupportPress for mention of this author">SP</a>',
     60                                                sprintf( '<a href="//make.wordpress.org/pluginrepo/?s=%s" title="%s">P2</a>',
     61                                                        urlencode( esc_attr( $author->user_nicename ) ),
     62                                                        esc_attr__( 'Click to search Pluginrepo P2 for mentions of this author', 'wporg-plugins' )
     63                                                ),
     64                                                sprintf( '<a href="https://supportpress.wordpress.org/plugins/?q=%s&status=&todo=Search+%%C2%%BB" title="%s">SP</a>',
     65                                                        urlencode( esc_attr( $author->user_nicename ) ),
     66                                                        esc_attr__( 'Click to search Pluginrepo SupportPress for mentions of this author', 'wporg-plugins' )
     67                                                ),
    6268                                        );
    6369                                        vprintf( '<span class="profile-sp-link">[ %s | %s ]</span>', $author_links );
    … …  
    6571
    6672                                <span class="profile-links">
    67                                         <a href="//profiles.wordpress.org/<?php echo $author->user_nicename; ?>">profile</a> |
    68                                         <a href="//wordpress.org/support/users/<?php echo $author->user_nicename; ?>">support</a>
     73                                        <a href="//profiles.wordpress.org/<?php echo $author->user_nicename; ?>"><?php _e( 'profile', 'wporg-plugins' ); ?></a> |
     74                                        <a href="//wordpress.org/support/users/<?php echo $author->user_nicename; ?>"><?php _e( 'support', 'wporg-plugins' ); ?></a>
    6975                                </span>
    7076                                <div class="profile-email">
    7177                                        &lt;<?php echo $author->user_email; ?>&gt;
    72                                         <span class="profile-sp-link">[ <a href="https://supportpress.wordpress.org/plugins/?sender=<?php echo esc_attr( $author->user_email ); ?>&status=&todo=Search" title="Click to search Pluginrepo SupportPress for emails sent to/from this email address">SP</a> ]</span>
     78                                        <span class="profile-sp-link"><?php
     79                                                printf( '[ <a href="https://supportpress.wordpress.org/plugins/?sender=%s&status=&todo=Search" title="%s">SP</a> ]',
     80                                                        esc_attr( $author->user_email ),
     81                                                        esc_attr__( 'Click to search Pluginrepo SupportPress for emails sent to/from this email address', 'wporg-plugins' )
     82                                                );
     83                                        ?></span>
    7384                                </div>
    74                                 <div class="profile-join">
    75                                         Joined <?php echo human_time_diff( strtotime( $author->user_registered ) ); ?> ago (<?php echo date( 'Y-M-d', strtotime( $author->user_registered ) ); ?>)
    76                                 </div>
     85                                <div class="profile-join"><?php
     86                                        /* translators: 1: time ago, 2: registration date */
     87                                        printf( __( 'Joined %1$s ago (%2$s)', 'wporg-plugins' ),
     88                                                human_time_diff( strtotime( $author->user_registered ) ),
     89                                                date( 'Y-M-d', strtotime( $author->user_registered ) )
     90                                        );
     91                                ?></div>
    7792                        </div>
    7893                </div>
     94
    7995                <?php if ( ! empty( $author->user_url ) ) : ?>
    8096                        <p class="profile-url">
    81                                 Author URL: <a href="http://href.li?<?php echo esc_url( $author->user_url ); ?>"><?php echo esc_html( $author->user_url ); ?></a>
     97                                <?php _e( 'Author URL:', 'wporg-plugins' ); ?>
     98                                <a href="http://href.li?<?php echo esc_url( $author->user_url ); ?>"><?php echo esc_html( $author->user_url ); ?></a>
    8299                        </p>
     100                <?php endif; ?>
     101
    83102                <?php
    84                         endif;
    85 
    86103                if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) ) {
    87104                        $user = new \WP_User( $author, '', WPORG_SUPPORT_FORUMS_BLOGID );
    … …  
    89106
    90107                        if ( ! empty( $user->allcaps['bbp_blocked'] ) ) {
    91                                 $statuses['banned'] = __( 'User is banned from logging into WordPress.org', 'wporg-plugins' );
     108                                $statuses[] = array(
     109                                        'text' => __( 'banned', 'wporg-plugins' ),
     110                                        'desc' => __( 'User is banned from logging into WordPress.org', 'wporg-plugins' ),
     111                                );
    92112                        }
    93113
    94114                        if ( (bool) get_user_meta( $user->ID, 'is_bozo', true ) ) {
    95                                 $statuses['flagged'] = __( 'User is flagged in the support forums', 'wporg-plugins' );
     115                                $statuses[] = array(
     116                                        'text' => __( 'flagged', 'wporg-plugins' ),
     117                                        'desc' => __( 'User is flagged in the support forums', 'wporg-plugins' ),
     118                                );
    96119                        }
    97120
    98121                        if ( $statuses ) {
    99122                                $labels = array();
    100                                 foreach ( $statuses as $status => $desc ) {
    101                                         $labels[] = sprintf( '<strong><span title="%s">%s</span></strong>', esc_attr( $desc ), $status );
     123                                foreach ( $statuses as $status ) {
     124                                        $labels[] = sprintf( '<strong><span title="%s">%s</span></strong>',
     125                                                esc_attr( $status['desc'] ),
     126                                                $status['text']
     127                                        );
    102128                                }
    103                                 /* translators: %s: Comma-separated list of negative user status labels */
     129                                /* translators: %s: comma-separated list of negative user status labels */
    104130                                echo '<p>' . sprintf( __( 'This user is: %s', 'wporg-plugins' ), implode( ', ', $labels ) ) . '</p>';
    105131                        }
    … …  
    122148                        sort( $user_ips, SORT_NUMERIC );
    123149
    124                         printf( '<p>IPs : %s</p>', implode( ', ', array_map( array( __NAMESPACE__ . '\Author_Card', 'link_ip' ), $user_ips ) ) );
     150                        /* translators: %s: comma-separated list of plugin author's IP addresses */
     151                        printf( '<p>' . __( 'IPs : %s', 'wporg-plugins' ) . '</p>',
     152                                implode( ', ', array_map( array( __NAMESPACE__ . '\Author_Card', 'link_ip' ), $user_ips ) )
     153                        );
    125154                endif;
    126 
    127                 if ( $author->user_pass == '~~~' ) : ?>
    128                         <p><strong>Has not logged in since we reset passwords in June 2011</strong></p>
     155                ?>
     156
     157                <?php if ( $author->user_pass == '~~~' ) : ?>
     158                        <p><strong><?php _e( 'Has not logged in since we reset passwords in June 2011', 'wporg-plugins' ); ?></strong></p>
    129159                <?php endif; ?>
     160
    130161                <div class="profile-plugins">
    131162                        <?php
    132163                        if ( empty( $author_commit ) && empty( $author_plugins ) ) {
    133                                 echo 'Not a developer on any plugin.';
     164                                _e( 'Not a developer on any plugin.', 'wporg-plugins' );
    134165                        } else {
    135166                                echo '<strong>' . sprintf( _n( '%d plugin:', '%d plugins:', count( $all_plugins ), 'wporg-plugins' ), count( $all_plugins ) ) . '</strong>';
    … …  
    144175
    145176                                        if ( in_array( $plugin->post_name, wp_list_pluck( $author_plugins, 'post_name' ) ) ) {
    146                                                 $tooltips[] = 'This user submitted this plugin.';
     177                                                $tooltips[] = __( 'This user submitted this plugin.', 'wporg-plugins ' );
    147178                                                $classes[]  = 'plugin-owner';
    148179                                                if ( ! in_array( $plugin->post_name, $author_commit ) ) {
    149180                                                        $note       = true;
    150                                                         $tooltips[] = 'The user is not a current committer.';
     181                                                        $tooltips[] = __( 'The user is not a current committer.', 'wporg-plugins' );
    151182                                                }
    152183                                        }
    … …  
    154185                                        $plugin_slug = $plugin->post_name;
    155186                                        if ( in_array( $plugin->post_status, array( 'new', 'pending' ) ) ) {
    156                                                 $extra .= sprintf( '(requested %s ago)', human_time_diff( strtotime( $last_updated ) ) );
    157                                                 $tooltips[] = 'Requested, remains unapproved.';
     187                                                /* translators: %s: time ago */
     188                                                $extra .= sprintf( __( '(requested %s ago)', 'wporg-plugins' ),
     189                                                        human_time_diff( strtotime( $last_updated ) )
     190                                                );
     191                                                $tooltips[] = __( 'Requested, remains unapproved.', 'wporg-plugins' );
    158192                                                $classes[]  = 'profile-plugin-requested';
    159193
    160194                                        } elseif ( 'rejected' === $plugin->post_status ) {
    161                                                 $tooltips[]  = 'Plugin was rejected.';
     195                                                $tooltips[]  = __( 'Plugin was rejected.', 'wporg-plugins' );
    162196                                                $classes[]   = 'profile-plugin-rejected';
    163197                                                $plugin_slug = substr( $plugin_slug, 9, - 9 );
    164198
    165199                                        } elseif ( 'closed' === $plugin->post_status ) {
    166                                                 $extra .= sprintf( '(closed: %s)', Template::get_close_reason( $plugin ) );
    167                                                 $tooltips[] = 'Plugin is closed.';
     200                                                /* translators: %s: close/disable reason */
     201                                                $extra .= sprintf( __( '(closed: %s)', 'wporg-plugins' ),
     202                                                        Template::get_close_reason( $plugin )
     203                                                );
     204                                                $tooltips[] = __( 'Plugin is closed.', 'wporg-plugins' );
    168205                                                $classes[]  = 'profile-plugin-closed';
    169206
    170207                                        } elseif ( 'disabled' === $plugin->post_status ) {
    171                                                 $extra .= sprintf( '(disabled: %s)', Template::get_close_reason( $plugin ) );
    172                                                 $tooltips[] = 'Plugin is disabled (updates are active).';
     208                                                /* translators: %s: close/disable reason */
     209                                                $extra .= sprintf( __( '(disabled: %s)', 'wporg-plugins' ),
     210                                                        Template::get_close_reason( $plugin )
     211                                                );
     212                                                $tooltips[] = __( 'Plugin is disabled (updates are active).', 'wporg-plugins' );
    173213                                                $classes[]  = 'profile-plugin-closed';
    174214                                                $note = true;
    … …  
    178218                                                if ( 'approved' === $plugin->post_status ) {
    179219                                                        $note       = true;
    180                                                         $tooltips[] = 'Plugin is approved, but has no data.';
     220                                                        $tooltips[] = __( 'Plugin is approved, but has no data.', 'wporg-plugins' );
    181221                                                } elseif ( strtotime( '-2 years' ) > strtotime( $last_updated ) ) {
    182                                                         $tooltips[] = 'Plugin is open but has not been updated in more than two years.';
     222                                                        $tooltips[] = __( 'Plugin is open but has not been updated in more than two years.', 'wporg-plugins' );
    183223                                                        $classes[]  = 'profile-plugin-open-old';
    184224                                                } else {
    185                                                         $tooltips[] = 'Plugin is open.';
     225                                                        $tooltips[] = __( 'Plugin is open.', 'wporg-plugins' );
    186226                                                }
    187227                                                $classes[]      = 'profile-plugin-open';
    … …  
    202242
    203243                                        $plugin_links = array(
    204                                                 '<a href="' . esc_url( get_edit_post_link( $plugin->ID, '' ) ) . '" title="Edit this plugin">Edit</a>',
    205                                                 '<a href="//make.wordpress.org/pluginrepo/?s=' . urlencode( esc_attr( $plugin_slug ) ) . '" title="Click to search Pluginrepo P2 for mention of this plugin">P2</a>',
    206                                                 '<a href="https://supportpress.wordpress.org/plugins/?q=' . urlencode( esc_attr( $plugin_slug ) ) . '&status=&todo=Search+%C2%BB" title="Click to search Pluginrepo SupportPress for mention of this plugin">SP</a>',
     244                                                sprintf( '<a href="%s" title="%s">%s</a>',
     245                                                        esc_url( get_edit_post_link( $plugin->ID, '' ) ),
     246                                                        esc_attr__( 'Edit this plugin', 'wporg-plugins' ),
     247                                                        __( 'Edit', 'wporg-plugins' )
     248                                                ),
     249                                                sprintf( '<a href="//make.wordpress.org/pluginrepo/?s=%s" title="%s">P2</a>',
     250                                                        urlencode( esc_attr( $plugin_slug ) ),
     251                                                        esc_attr__( 'Click to search Pluginrepo P2 for mentions of this plugin', 'wporg-plugins' )
     252                                                ),
     253                                                sprintf( '<a href="https://supportpress.wordpress.org/plugins/?q=%s&status=&todo=Search+%%C2%%BB" title="%s">SP</a>',
     254                                                        urlencode( esc_attr( $plugin_slug ) ),
     255                                                        esc_attr__( 'Click to search Pluginrepo SupportPress for mentions of this plugin', 'wporg-plugins' )
     256                                                ),
    207257                                        );
    208258                                        vprintf( '<span class="profile-sp-link">[ %s | %s | %s ]</span>', $plugin_links );
    … …  
    218268                        ?>
    219269                </div>
     270
    220271                <?php
    221 
    222272                /**
    223273                 * Fires at the end of a plugin's author card.
Note: See TracChangeset for help on using the changeset viewer.