I18N: Allow for post custom field name in `the_meta()` to be translated, e.g. to insert a non-breaking space before the colon.

Props audrasjb, johnbillion.
Fixes #41653.
Built from https://develop.svn.wordpress.org/trunk@41583


git-svn-id: http://core.svn.wordpress.org/trunk@41416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2017-09-24 11:28:46 +00:00
parent 58761c1ff2
commit 400bc41731
2 changed files with 14 additions and 6 deletions

View File

@ -1018,11 +1018,19 @@ function the_meta() {
if ( $keys = get_post_custom_keys() ) {
echo "<ul class='post-meta'>\n";
foreach ( (array) $keys as $key ) {
$keyt = trim($key);
if ( is_protected_meta( $keyt, 'post' ) )
$keyt = trim( $key );
if ( is_protected_meta( $keyt, 'post' ) ) {
continue;
$values = array_map('trim', get_post_custom_values($key));
$value = implode($values,', ');
}
$values = array_map( 'trim', get_post_custom_values( $key ) );
$value = implode( $values, ', ' );
$html = sprintf( "<li><span class='post-meta-key'>%s</span> %s</li>\n",
/* translators: %s: Post custom field name */
sprintf( _x( '%s:', 'Post custom field name' ), $key ),
$value
);
/**
* Filters the HTML output of the li element in the post custom fields list.
@ -1033,7 +1041,7 @@ function the_meta() {
* @param string $key Meta key.
* @param string $value Meta value.
*/
echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
echo apply_filters( 'the_meta_key', $html, $key, $value );
}
echo "</ul>\n";
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41582';
$wp_version = '4.9-alpha-41583';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.