Skip to content

Commit a7513ac

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@45926 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 425d6fd commit a7513ac

139 files changed

Lines changed: 1905 additions & 541 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/wp-admin/about.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777

7878
if ( current_user_can( 'install_plugins' ) ) {
7979
printf(
80-
/* translators: 1: link to /wp-admin/site-health.php 2: link to /wp-admin/site-health.php?tab=debug */
80+
/* translators: 1: link to /wp-admin/site-health.php, 2: link to /wp-admin/site-health.php?tab=debug */
8181
__( ' <a href="%1$s">Check your site status</a>, and <a href="%2$s">learn how to debug issues</a>.' ),
8282
admin_url( 'site-health.php' ),
8383
admin_url( 'site-health.php?tab=debug' )
@@ -142,7 +142,7 @@
142142
<p>
143143
<?php
144144
printf(
145-
/* translators: 1: wp_body_open 2: <body> */
145+
/* translators: 1: wp_body_open, 2: <body> */
146146
__( '5.2 introduces a %1$s hook, which lets themes support injecting code right at the beginning of the %2$s element.' ),
147147
'<code>wp_body_open</code>',
148148
'<code>&lt;body&gt;</code>'

src/wp-admin/admin-footer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
?>
3333
<p id="footer-left" class="alignleft">
3434
<?php
35+
/* translators: %s: https://wordpress.org/ */
3536
$text = sprintf( __( 'Thank you for creating with <a href="%s">WordPress</a>.' ), __( 'https://wordpress.org/' ) );
3637
/**
3738
* Filters the "Thank you" text displayed in the admin footer.

src/wp-admin/admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
}
259259

260260
if ( ! ( file_exists( WP_PLUGIN_DIR . "/$plugin_page" ) && is_file( WP_PLUGIN_DIR . "/$plugin_page" ) ) && ! ( file_exists( WPMU_PLUGIN_DIR . "/$plugin_page" ) && is_file( WPMU_PLUGIN_DIR . "/$plugin_page" ) ) ) {
261+
/* translators: %s: Admin page generated by a plugin. */
261262
wp_die( sprintf( __( 'Cannot load %s.' ), htmlentities( $plugin_page ) ) );
262263
}
263264

src/wp-admin/async-upload.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,19 @@
9292

9393
$id = media_handle_upload( 'async-upload', $post_id );
9494
if ( is_wp_error( $id ) ) {
95-
echo '<div class="error-div error">
96-
<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __( 'Dismiss' ) . '</button>
97-
<strong>' . sprintf( __( '&#8220;%s&#8221; has failed to upload.' ), esc_html( $_FILES['async-upload']['name'] ) ) . '</strong><br />' .
98-
esc_html( $id->get_error_message() ) . '</div>';
95+
printf(
96+
'<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
97+
sprintf(
98+
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
99+
__( 'Dismiss' )
100+
),
101+
sprintf(
102+
/* translators: %s: Name of the file that failed to upload. */
103+
__( '&#8220;%s&#8221; has failed to upload.' ),
104+
esc_html( $_FILES['async-upload']['name'] )
105+
),
106+
esc_html( $id->get_error_message() )
107+
);
99108
exit;
100109
}
101110

src/wp-admin/comment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@
204204
<th scope="row"><?php _e( 'Submitted on' ); ?></th>
205205
<td>
206206
<?php
207-
/* translators: 1: comment date, 2: comment time */
208207
$submitted = sprintf(
208+
/* translators: 1: comment date, 2: comment time */
209209
__( '%1$s at %2$s' ),
210210
/* translators: comment date format. See https://secure.php.net/date */
211211
get_comment_date( __( 'Y/m/d' ), $comment ),

src/wp-admin/customize.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
<div class="accordion-section-title">
208208
<span class="preview-notice">
209209
<?php
210+
/* translators: %s: Site title */
210211
echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
211212
?>
212213
</span>

src/wp-admin/edit-comments.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,24 +152,24 @@
152152
$comments_count = wp_count_comments( $post_id );
153153
$draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' );
154154
if ( $comments_count->moderated > 0 ) {
155-
/* translators: 1: comments count, 2: post title */
156155
$title = sprintf(
156+
/* translators: 1: comments count, 2: post title */
157157
__( 'Comments (%1$s) on &#8220;%2$s&#8221;' ),
158158
number_format_i18n( $comments_count->moderated ),
159159
$draft_or_post_title
160160
);
161161
} else {
162-
/* translators: %s: post title */
163162
$title = sprintf(
163+
/* translators: %s: post title */
164164
__( 'Comments on &#8220;%s&#8221;' ),
165165
$draft_or_post_title
166166
);
167167
}
168168
} else {
169169
$comments_count = wp_count_comments();
170170
if ( $comments_count->moderated > 0 ) {
171-
/* translators: %s: comments count */
172171
$title = sprintf(
172+
/* translators: %s: comments count */
173173
__( 'Comments (%s)' ),
174174
number_format_i18n( $comments_count->moderated )
175175
);
@@ -225,8 +225,8 @@
225225
<h1 class="wp-heading-inline">
226226
<?php
227227
if ( $post_id ) {
228-
/* translators: %s: link to post */
229228
printf(
229+
/* translators: %s: link to post */
230230
__( 'Comments on &#8220;%s&#8221;' ),
231231
sprintf(
232232
'<a href="%1$s">%2$s</a>',
@@ -243,8 +243,8 @@
243243
<?php
244244
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
245245
echo '<span class="subtitle">';
246-
/* translators: %s: search keywords */
247246
printf(
247+
/* translators: %s: search keywords */
248248
__( 'Search results for &#8220;%s&#8221;' ),
249249
wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' )
250250
);
@@ -282,34 +282,34 @@
282282

283283
if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
284284
if ( $approved > 0 ) {
285-
/* translators: %s: number of comments approved */
285+
/* translators: %s: number of comments */
286286
$messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
287287
}
288288

289289
if ( $spammed > 0 ) {
290290
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
291-
/* translators: %s: number of comments marked as spam */
291+
/* translators: %s: number of comments */
292292
$messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", 'bulk-comments' ) ) . '">' . __( 'Undo' ) . '</a><br />';
293293
}
294294

295295
if ( $unspammed > 0 ) {
296-
/* translators: %s: number of comments restored from the spam */
296+
/* translators: %s: number of comments */
297297
$messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
298298
}
299299

300300
if ( $trashed > 0 ) {
301301
$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
302-
/* translators: %s: number of comments moved to the Trash */
302+
/* translators: %s: number of comments */
303303
$messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", 'bulk-comments' ) ) . '">' . __( 'Undo' ) . '</a><br />';
304304
}
305305

306306
if ( $untrashed > 0 ) {
307-
/* translators: %s: number of comments restored from the Trash */
307+
/* translators: %s: number of comments */
308308
$messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed );
309309
}
310310

311311
if ( $deleted > 0 ) {
312-
/* translators: %s: number of comments permanently deleted */
312+
/* translators: %s: number of comments */
313313
$messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
314314
}
315315

src/wp-admin/edit-form-advanced.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
6 => __( 'Post published.' ) . $view_post_link_html,
181181
7 => __( 'Post saved.' ),
182182
8 => __( 'Post submitted.' ) . $preview_post_link_html,
183+
/* translators: %s: scheduled date for the post */
183184
9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
184185
10 => __( 'Post draft updated.' ) . $preview_post_link_html,
185186
);
@@ -194,6 +195,7 @@
194195
6 => __( 'Page published.' ) . $view_page_link_html,
195196
7 => __( 'Page saved.' ),
196197
8 => __( 'Page submitted.' ) . $preview_page_link_html,
198+
/* translators: %s: scheduled date for the page */
197199
9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,
198200
10 => __( 'Page draft updated.' ) . $preview_page_link_html,
199201
);
@@ -238,7 +240,11 @@
238240
if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
239241
foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) {
240242
if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
241-
$notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
243+
$notice = sprintf(
244+
/* translators: %s: URL to view the autosave */
245+
__( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ),
246+
get_edit_post_link( $autosave->ID )
247+
);
242248
break;
243249
}
244250
}
@@ -292,7 +298,11 @@
292298
);
293299

294300
get_current_screen()->set_help_sidebar(
295-
'<p>' . sprintf( __( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ), 'tools.php' ) . '</p>' .
301+
'<p>' . sprintf(
302+
/* translators: %s: URL to Press This bookmarklet */
303+
__( 'You can also create posts with the <a href="%s">Press This bookmarklet</a>.' ),
304+
'tools.php'
305+
) . '</p>' .
296306
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
297307
'<p>' . __( '<a href="https://wordpress.org/support/article/wordpress-editor/">Documentation on Writing and Editing Posts</a>' ) . '</p>' .
298308
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
@@ -359,8 +369,11 @@
359369
}
360370

361371
if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
362-
/* translators: %s: Featured Image */
363-
$publish_box .= '<li>' . sprintf( __( '<strong>%s</strong> &mdash; This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ), esc_html( $post_type_object->labels->featured_image ) ) . '</li>';
372+
$publish_box .= '<li>' . sprintf(
373+
/* translators: %s: Featured Image */
374+
__( '<strong>%s</strong> &mdash; This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ),
375+
esc_html( $post_type_object->labels->featured_image )
376+
) . '</li>';
364377
}
365378

366379
$publish_box .= '</ul>';
@@ -577,7 +590,15 @@
577590
);
578591
?>
579592
<table id="post-status-info"><tbody><tr>
580-
<td id="wp-word-count" class="hide-if-no-js"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
593+
<td id="wp-word-count" class="hide-if-no-js">
594+
<?php
595+
printf(
596+
/* translators: %s: Number of words */
597+
__( 'Word count: %s' ),
598+
'<span class="word-count">0</span>'
599+
);
600+
?>
601+
</td>
581602
<td class="autosave-info">
582603
<span class="autosave-message">&nbsp;</span>
583604
<?php

src/wp-admin/edit-link-form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
}
1313

1414
if ( ! empty( $link_id ) ) {
15+
/* translators: %s: URL to Links screen */
1516
$heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
1617
$submit_text = __( 'Update Link' );
1718
$form_name = 'editlink';
1819
$nonce_action = 'update-bookmark_' . $link_id;
1920
} else {
21+
/* translators: %s: URL to Links screen */
2022
$heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
2123
$submit_text = __( 'Add Link' );
2224
$form_name = 'addlink';

src/wp-admin/edit-tags.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@
242242
if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) {
243243
$help = '';
244244
if ( 'category' == $taxonomy ) {
245-
$help = '<p>' . sprintf( __( 'You can use categories to define sections of your site and group related posts. The default category is &#8220;Uncategorized&#8221; until you change it in your <a href="%s">writing settings</a>.' ), 'options-writing.php' ) . '</p>';
245+
$help = '<p>' . sprintf(
246+
/* translators: %s: URL to Writing Settings screen */
247+
__( 'You can use categories to define sections of your site and group related posts. The default category is &#8220;Uncategorized&#8221; until you change it in your <a href="%s">writing settings</a>.' ),
248+
'options-writing.php'
249+
) . '</p>';
246250
} elseif ( 'link_category' == $taxonomy ) {
247251
$help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>';
248252
} else {
@@ -596,13 +600,27 @@
596600
</p>
597601
<?php if ( current_user_can( 'import' ) ) : ?>
598602
<p>
599-
<?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ); ?>
603+
<?php
604+
printf(
605+
/* translators: %s: URL to Categories to Tags Converter tool */
606+
__( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ),
607+
esc_url( $import_link )
608+
);
609+
?>
600610
</p>
601611
<?php endif; ?>
602612
</div>
603613
<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?>
604614
<div class="form-wrap edit-term-notes">
605-
<p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ); ?></p>
615+
<p>
616+
<?php
617+
printf(
618+
/* translators: %s: URL to Categories to Tags Converter tool */
619+
__( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ),
620+
esc_url( $import_link )
621+
);
622+
?>
623+
</p>
606624
</div>
607625
<?php
608626
endif;

0 commit comments

Comments
 (0)