From 8cefd8f258e3bc686e813cd9c91536a2a5051e53 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 3 Apr 2017 00:19:17 +0200 Subject: [PATCH 1/2] I18n: ensure all text strings with placeholders have translators comments. --- footer.php | 10 ++++++++-- inc/template-tags.php | 4 ++++ search.php | 5 ++++- template-parts/content-none.php | 5 ++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/footer.php b/footer.php index c44ce3e..ed7a193 100644 --- a/footer.php +++ b/footer.php @@ -15,9 +15,15 @@ diff --git a/inc/template-tags.php b/inc/template-tags.php index 7aa0714..ca9616f 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -25,11 +25,13 @@ function _s_posted_on() { ); $posted_on = sprintf( + /* translators: %s: post date. */ esc_html_x( 'Posted on %s', 'post date', '_s' ), '' . $time_string . '' ); $byline = sprintf( + /* translators: %s: post author. */ esc_html_x( 'by %s', 'post author', '_s' ), '' . esc_html( get_the_author() ) . '' ); @@ -49,12 +51,14 @@ function _s_entry_footer() { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list( esc_html__( ', ', '_s' ) ); if ( $categories_list && _s_categorized_blog() ) { + /* translators: 1: list of categories. */ printf( '' . esc_html__( 'Posted in %1$s', '_s' ) . '', $categories_list ); // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', '_s' ) ); if ( $tags_list ) { + /* translators: 1: list of tags. */ printf( '' . esc_html__( 'Tagged %1$s', '_s' ) . '', $tags_list ); // WPCS: XSS OK. } } diff --git a/search.php b/search.php index c2cec52..4ab5676 100644 --- a/search.php +++ b/search.php @@ -16,7 +16,10 @@ get_header(); ?> if ( have_posts() ) : ?> -

Get started here.', '_s' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?>

+

Get started here.', '_s' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); + ?>

From a65be483687e294c8989338c39ecc29b5fd4684c Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 3 Apr 2017 00:38:36 +0200 Subject: [PATCH 2/2] CS: Fix code layout of nested function calls with associative arrays. --- header.php | 7 ++++++- inc/template-tags.php | 16 ++++++++++++++-- template-parts/content-none.php | 14 ++++++++++++-- template-parts/content.php | 11 +++++++++-- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/header.php b/header.php index 3e489f7..f052991 100644 --- a/header.php +++ b/header.php @@ -42,7 +42,12 @@ diff --git a/inc/template-tags.php b/inc/template-tags.php index ca9616f..72f6edd 100644 --- a/inc/template-tags.php +++ b/inc/template-tags.php @@ -65,8 +65,20 @@ function _s_entry_footer() { if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo ''; - /* translators: %s: post title */ - comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment on %s', '_s' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title() ) ); + comments_popup_link( + sprintf( + wp_kses( + /* translators: %s: post title */ + __( 'Leave a Comment on %s', '_s' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), + get_the_title() + ) + ); echo ''; } diff --git a/template-parts/content-none.php b/template-parts/content-none.php index d1328eb..50c2c21 100644 --- a/template-parts/content-none.php +++ b/template-parts/content-none.php @@ -19,8 +19,18 @@ if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>

Get started here.', '_s' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); + printf( + wp_kses( + /* translators: 1: link to WP admin new post page. */ + __( 'Ready to publish your first post? Get started here.', '_s' ), + array( + 'a' => array( + 'href' => array(), + ), + ) + ), + esc_url( admin_url( 'post-new.php' ) ) + ); ?>

diff --git a/template-parts/content.php b/template-parts/content.php index a61abaf..68b8468 100644 --- a/template-parts/content.php +++ b/template-parts/content.php @@ -29,8 +29,15 @@
→', '_s' ), array( 'span' => array( 'class' => array() ) ) ), + wp_kses( + /* translators: %s: Name of current post. */ + __( 'Continue reading %s ', '_s' ), + array( + 'span' => array( + 'class' => array(), + ), + ) + ), the_title( '"', '"', false ) ) );