Make WordPress Core


Ignore:
Timestamp:
08/30/2018 01:35:27 PM (6 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

File:
1 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            )
Note: See TracChangeset for help on using the changeset viewer.