Skip to content

Commit 967cbe9

Browse files
committed
I18N: Place translator comments directly before their strings.
Some translator comments were placed in front of a ternary operator or shared a line with several translatable strings. String extraction tools either miss such comments or attach them to the wrong string. This moves each comment directly before the gettext call it describes. Developed in: #16069 Props swissspidy, mukesh27. See #66747. git-svn-id: https://develop.svn.wordpress.org/trunk@65774 602fd350-edb4-49c9-b593-d223f7449a82
1 parent fa31aae commit 967cbe9

6 files changed

Lines changed: 54 additions & 16 deletions

File tree

‎src/wp-admin/includes/deprecated.php‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,10 +1386,15 @@ function wp_dashboard_plugins_output( $rss, $args = array() ) {
13861386
$raw_title = $item->get_title();
13871387

13881388
$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800';
1389+
$install_label = sprintf(
1390+
/* translators: %s: Plugin name. */
1391+
_x( 'Install %s', 'plugin' ),
1392+
$raw_title
1393+
);
1394+
13891395
echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
13901396
'&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
1391-
/* translators: %s: Plugin name. */
1392-
esc_attr( sprintf( _x( 'Install %s', 'plugin' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
1397+
esc_attr( $install_label ) . '">(' . __( 'Install' ) . ')</a></li>';
13931398

13941399
$feed->__destruct();
13951400
unset( $feed );

‎src/wp-admin/includes/update.php‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,11 @@ function update_right_now_message() {
385385
$msg .= sprintf(
386386
'<a href="%s" class="button" aria-describedby="wp-version">%s</a>',
387387
network_admin_url( 'update-core.php' ),
388-
/* translators: %s: WordPress version number, or 'Latest' string. */
389-
sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )
388+
sprintf(
389+
/* translators: %s: WordPress version number, or 'Latest' string. */
390+
__( 'Update to %s' ),
391+
$cur->current ? $cur->current : __( 'Latest' )
392+
)
390393
);
391394
}
392395
}

‎src/wp-includes/class-wp-object-cache.php‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,15 @@ protected function is_valid_key( $key ) {
154154
wp_load_translations_early();
155155
}
156156

157-
$message = is_string( $key )
158-
? __( 'Cache key must not be an empty string.' )
159-
/* translators: %s: The type of the given cache key. */
160-
: sprintf( __( 'Cache key must be an integer or a non-empty string, %s given.' ), $type );
157+
if ( is_string( $key ) ) {
158+
$message = __( 'Cache key must not be an empty string.' );
159+
} else {
160+
$message = sprintf(
161+
/* translators: %s: The type of the given cache key. */
162+
__( 'Cache key must be an integer or a non-empty string, %s given.' ),
163+
$type
164+
);
165+
}
161166

162167
_doing_it_wrong(
163168
sprintf( '%s::%s', __CLASS__, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 )[1]['function'] ),

‎src/wp-includes/class-wp-taxonomy.php‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,12 @@ public static function get_default_labels() {
633633
'filter_by_item' => array( null, __( 'Filter by category' ) ),
634634
'items_list_navigation' => array( __( 'Tags list navigation' ), __( 'Categories list navigation' ) ),
635635
'items_list' => array( __( 'Tags list' ), __( 'Categories list' ) ),
636-
/* translators: Tab heading when selecting from the most used terms. */
637-
'most_used' => array( _x( 'Most Used', 'tags' ), _x( 'Most Used', 'categories' ) ),
636+
'most_used' => array(
637+
/* translators: Tab heading when selecting from the most used terms. */
638+
_x( 'Most Used', 'tags' ),
639+
/* translators: Tab heading when selecting from the most used terms. */
640+
_x( 'Most Used', 'categories' ),
641+
),
638642
'back_to_items' => array( __( '&larr; Go to Tags' ), __( '&larr; Go to Categories' ) ),
639643
'item_link' => array(
640644
_x( 'Tag Link', 'navigation link block title' ),

‎src/wp-includes/class-wp-theme-json.php‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5860,9 +5860,18 @@ private static function compute_spacing_sizes( $spacing_scale ) {
58605860
break;
58615861
}
58625862

5863+
if ( $below_midpoint_count === $steps_mid_point - 1 ) {
5864+
$name = __( 'Small' );
5865+
} else {
5866+
$name = sprintf(
5867+
/* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Small. */
5868+
__( '%sX-Small' ),
5869+
(string) $x_small_count
5870+
);
5871+
}
5872+
58635873
$below_sizes[] = array(
5864-
/* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Small. */
5865-
'name' => $below_midpoint_count === $steps_mid_point - 1 ? __( 'Small' ) : sprintf( __( '%sX-Small' ), (string) $x_small_count ),
5874+
'name' => $name,
58665875
'slug' => (string) $slug,
58675876
'size' => round( $current_step, 2 ) . $unit,
58685877
);
@@ -5897,9 +5906,18 @@ private static function compute_spacing_sizes( $spacing_scale ) {
58975906
? $current_step + $spacing_scale['increment']
58985907
: ( $spacing_scale['increment'] >= 1 ? $current_step * $spacing_scale['increment'] : $current_step / $spacing_scale['increment'] );
58995908

5909+
if ( 0 === $above_midpoint_count ) {
5910+
$name = __( 'Large' );
5911+
} else {
5912+
$name = sprintf(
5913+
/* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Large. */
5914+
__( '%sX-Large' ),
5915+
(string) $x_large_count
5916+
);
5917+
}
5918+
59005919
$above_sizes[] = array(
5901-
/* translators: %s: Digit to indicate multiple of sizing, eg. 2X-Large. */
5902-
'name' => 0 === $above_midpoint_count ? __( 'Large' ) : sprintf( __( '%sX-Large' ), (string) $x_large_count ),
5920+
'name' => $name,
59035921
'slug' => (string) $slug,
59045922
'size' => round( $current_step, 2 ) . $unit,
59055923
);

‎src/wp-includes/pluggable.php‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,8 +1930,11 @@ function wp_notify_postauthor( $comment_id, $deprecated = null ) {
19301930
$notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
19311931
/* translators: %s: Note author email. */
19321932
$notify_message .= sprintf( __( 'Email: %s' ), $comment_author_email ) . "\r\n";
1933-
/* translators: %s: Note text. */
1934-
$notify_message .= sprintf( __( 'Note: %s' ), "\r\n" . ( empty( $comment_content ) ? __( 'resolved/reopened' ) : $comment_content ) ) . "\r\n\r\n";
1933+
$notify_message .= sprintf(
1934+
/* translators: %s: Note text. */
1935+
__( 'Note: %s' ),
1936+
"\r\n" . ( empty( $comment_content ) ? __( 'resolved/reopened' ) : $comment_content )
1937+
) . "\r\n\r\n";
19351938
$notify_message .= __( 'You can see all notes on this post here:' ) . "\r\n";
19361939
/* translators: Note notification email subject. 1: Site title, 2: Post title. */
19371940
$subject = sprintf( __( '[%1$s] Note: "%2$s"' ), $blogname, $post->post_title );

0 commit comments

Comments
 (0)