From 4d5fbe29f4e40a0d08092de54516e3ede24c716a Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Wed, 11 Nov 2015 20:59:56 +0000 Subject: [PATCH] Comments: Dynamically update the document title text for all languages, not only English. See [33821]. Fixes #33414. git-svn-id: https://develop.svn.wordpress.org/trunk@35615 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/edit-comments.js | 6 +++--- src/wp-includes/script-loader.php | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/edit-comments.js b/src/wp-admin/js/edit-comments.js index 23228af15f..7fc62deb73 100644 --- a/src/wp-admin/js/edit-comments.js +++ b/src/wp-admin/js/edit-comments.js @@ -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 || $( '
' ); 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; diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 971012a9a4..5288896a3b 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -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 );