Comments: Dynamically update the document title text for all languages, not only English.

See [33821].
Fixes #33414.
Built from https://develop.svn.wordpress.org/trunk@35615


git-svn-id: http://core.svn.wordpress.org/trunk@35579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-11-11 21:00:27 +00:00
parent db8c89cccb
commit 27e4384e89
4 changed files with 8 additions and 5 deletions

View File

@ -98,7 +98,7 @@ var getCount, updateCount, updateCountText, updatePending, updateApproved,
updateHtmlTitle = function ( diff ) {
var newTitle, regExMatch, titleCount, commentFrag;
titleRegEx = titleRegEx || new RegExp( 'Comments (\\([0-9' + thousandsSeparator + ']+\\))?' );
titleRegEx = titleRegEx || new RegExp( adminCommentsL10n.docTitleCommentsCount.replace( '%s', '\\([0-9' + thousandsSeparator + ']+\\)' ) + '?' );
// count funcs operate on a $'d element
titleDiv = titleDiv || $( '<div />' );
newTitle = adminTitle;
@ -117,12 +117,12 @@ var getCount, updateCount, updateCountText, updatePending, updateApproved,
updateCount( titleDiv, titleCount );
regExMatch = titleRegEx.exec( document.title );
if ( regExMatch ) {
newTitle = document.title.replace( regExMatch[0], 'Comments (' + titleDiv.text() + ') ' );
newTitle = document.title.replace( regExMatch[0], adminCommentsL10n.docTitleCommentsCount.replace( '%s', titleDiv.text() ) + ' ' );
}
} else {
regExMatch = titleRegEx.exec( newTitle );
if ( regExMatch ) {
newTitle = newTitle.replace( regExMatch[0], 'Comments' );
newTitle = newTitle.replace( regExMatch[0], adminCommentsL10n.docTitleComments );
}
}
document.title = newTitle;

File diff suppressed because one or more lines are too long

View File

@ -487,6 +487,9 @@ function wp_default_scripts( &$scripts ) {
'replyApprove' => __( 'Approve and Reply' ),
'reply' => __( 'Reply' ),
'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
'docTitleComments' => __( 'Comments' ),
/* translators: %s: comments count */
'docTitleCommentsCount' => __( 'Comments (%s)' ),
) );
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-beta3-35614';
$wp_version = '4.4-beta3-35615';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.