Skip to content

Commit 272e5bb

Browse files
committed
Coding Standards: Add missing translator comments.
Twentys Eleven, Sixteen, and Seventeen now have translator comments for all their strings. Also, WPCS now doesn't show missing translator comment warnings for test files. See #47632. git-svn-id: https://develop.svn.wordpress.org/trunk@45604 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 18ec05e commit 272e5bb

37 files changed

+154
-38
lines changed

phpcs.xml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@
148148
<exclude-pattern>/tests/phpunit/tests/l10n/loadTextdomainJustInTime\.php</exclude-pattern>
149149
</rule>
150150

151+
<!-- Translator comments aren't needed in unit tests. -->
152+
<rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
153+
<exclude-pattern>/tests/*</exclude-pattern>
154+
</rule>
155+
151156
<rule ref="Generic.Functions.FunctionCallArgumentSpacing">
152157
<exclude-pattern>/wp-config\.php</exclude-pattern>
153158
<exclude-pattern>/wp-config-sample\.php</exclude-pattern>

src/wp-content/themes/twentyeleven/archive.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,20 @@
2121

2222
<header class="page-header">
2323
<h1 class="page-title">
24-
<?php if ( is_day() ) : ?>
25-
<?php printf( __( 'Daily Archives: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' ); ?>
26-
<?php elseif ( is_month() ) : ?>
27-
<?php printf( __( 'Monthly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
28-
<?php elseif ( is_year() ) : ?>
29-
<?php printf( __( 'Yearly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
30-
<?php else : ?>
31-
<?php _e( 'Blog Archives', 'twentyeleven' ); ?>
32-
<?php endif; ?>
24+
<?php
25+
if ( is_day() ) {
26+
/* translators: %s: date */
27+
printf( __( 'Daily Archives: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' );
28+
} elseif ( is_month() ) {
29+
/* translators: %s: date */
30+
printf( __( 'Monthly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>' );
31+
} elseif ( is_year() ) {
32+
/* translators: %s: date */
33+
printf( __( 'Yearly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>' );
34+
} else {
35+
_e( 'Blog Archives', 'twentyeleven' );
36+
}
37+
?>
3338
</h1>
3439
</header>
3540

src/wp-content/themes/twentyeleven/author.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@
2626
?>
2727

2828
<header class="page-header">
29-
<h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
29+
<h1 class="page-title author">
30+
<?php
31+
/* translators: %s: author display name */
32+
printf( __( 'Author Archives: %s', 'twentyeleven' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' );
33+
?>
34+
</h1>
3035
</header>
3136

3237
<?php
@@ -58,7 +63,12 @@
5863
?>
5964
</div><!-- #author-avatar -->
6065
<div id="author-description">
61-
<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
66+
<h2>
67+
<?php
68+
/* translators: author display name */
69+
printf( __( 'About %s', 'twentyeleven' ), get_the_author() );
70+
?>
71+
</h2>
6272
<?php the_author_meta( 'description' ); ?>
6373
</div><!-- #author-description -->
6474
</div><!-- #author-info -->

src/wp-content/themes/twentyeleven/category.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<header class="page-header">
1818
<h1 class="page-title">
1919
<?php
20+
/* translators: %s: category title */
2021
printf( __( 'Category Archives: %s', 'twentyeleven' ), '<span>' . single_cat_title( '', false ) . '</span>' );
2122
?>
2223
</h1>

src/wp-content/themes/twentyeleven/content-featured.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
/* translators: used between list items, there is a space after the comma */
3636
$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
3737
if ( '' != $tag_list ) {
38+
/* translators: 1: category list, 2: tag list, 3: post permalink, 4: post title */
3839
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
3940
} else {
41+
/* translators: 1: category list, 3: post permalink, 4: post title */
4042
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
4143
}
4244
printf(

src/wp-content/themes/twentyeleven/content-gallery.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@
4646
<p><em>
4747
<?php
4848
printf(
49+
/* translators: 1: link attributes, 2: number of photos */
4950
_n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyeleven' ),
51+
/* translators: %s: Post title */
5052
'href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
5153
number_format_i18n( $total_images )
5254
);
@@ -75,6 +77,7 @@
7577
?>
7678
<span class="cat-links">
7779
<?php
80+
/* translators: 1: CSS classes, 2: list of categories */
7881
printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
7982
$show_sep = true;
8083
?>
@@ -90,6 +93,7 @@
9093
<?php endif; // End if $show_sep ?>
9194
<span class="tag-links">
9295
<?php
96+
/* translators: 1: CSS classes, 2: list of tags */
9397
printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
9498
$show_sep = true;
9599
?>

src/wp-content/themes/twentyeleven/content-image.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@
4141
<div class="entry-meta">
4242
<?php
4343
printf(
44+
/* translators: 1: the permalink, 2: date and time, 3: date and time, 4: author link, 5: author link title, 6: author display name */
4445
__( '<a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span></span>', 'twentyeleven' ),
4546
esc_url( get_permalink() ),
4647
get_the_date( 'c' ),
4748
get_the_date(),
4849
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
50+
/* translators: %s: author display name */
4951
esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
5052
get_the_author()
5153
);
@@ -58,7 +60,10 @@
5860
if ( $categories_list ) :
5961
?>
6062
<span class="cat-links">
61-
<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list ); ?>
63+
<?php
64+
/* translators: 1: CSS classes, 2: category list */
65+
printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
66+
?>
6267
</span>
6368
<?php endif; // End if categories ?>
6469
<?php
@@ -67,7 +72,10 @@
6772
if ( $tags_list ) :
6873
?>
6974
<span class="tag-links">
70-
<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
75+
<?php
76+
/* translators: 1: CSS classes, 2: tag list */
77+
printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
78+
?>
7179
</span>
7280
<?php endif; // End if $tags_list ?>
7381

src/wp-content/themes/twentyeleven/content-quote.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
?>
5454
<span class="cat-links">
5555
<?php
56+
/* translators: 1: CSS classes, 2: list of categories */
5657
printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
5758
$show_sep = true;
5859
?>
@@ -68,6 +69,7 @@
6869
<?php endif; // End if $show_sep ?>
6970
<span class="tag-links">
7071
<?php
72+
/* translators: 1: CSS classes, 2: list of tags */
7173
printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
7274
$show_sep = true;
7375
?>

src/wp-content/themes/twentyeleven/content-single.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@
3939
/* translators: used between list items, there is a space after the comma */
4040
$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
4141
if ( '' != $tag_list ) {
42+
/* translators: 1: categories list, 2: tag list, 3: permalink, 4: post title, 5: author name, 6: author URL */
4243
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
4344
} elseif ( '' != $categories_list ) {
45+
/* translators: 1: categories list, 2: tag list, 3: permalink, 4: post title, 5: author name, 6: author URL */
4446
$utility_text = __( 'This entry was posted in %1$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
4547
} else {
48+
/* translators: 1: categories list, 2: tag list, 3: permalink, 4: post title, 5: author name, 6: author URL */
4649
$utility_text = __( 'This entry was posted by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
4750
}
4851

@@ -67,11 +70,19 @@
6770
?>
6871
</div><!-- #author-avatar -->
6972
<div id="author-description">
70-
<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
73+
<h2>
74+
<?php
75+
/* translators: %s: author name */
76+
printf( __( 'About %s', 'twentyeleven' ), get_the_author() );
77+
?>
78+
</h2>
7179
<?php the_author_meta( 'description' ); ?>
7280
<div id="author-link">
7381
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
74-
<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), get_the_author() ); ?>
82+
<?php
83+
/* translators: %s: author name */
84+
printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), get_the_author() );
85+
?>
7586
</a>
7687
</div><!-- #author-link -->
7788
</div><!-- #author-description -->

src/wp-content/themes/twentyeleven/content.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
?>
6161
<span class="cat-links">
6262
<?php
63+
/* translators: 1: CSS classes, 2: category list */
6364
printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
6465
$show_sep = true;
6566
?>
@@ -77,6 +78,7 @@
7778
<?php endif; // End if $show_sep ?>
7879
<span class="tag-links">
7980
<?php
81+
/* translators: 1: CSS classes, 2: tag list */
8082
printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
8183
$show_sep = true;
8284
?>

0 commit comments

Comments
 (0)