Skip to content

Commit d67c469

Browse files
Themes: Include theme name in available update messages, for better accessibility and consistency with other similar messages.
Follow-up to [48652-48654]. See #48491. git-svn-id: https://develop.svn.wordpress.org/trunk@48659 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b7a5c75 commit d67c469

3 files changed

Lines changed: 78 additions & 18 deletions

File tree

src/wp-admin/includes/theme.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,11 @@ function customize_themes_print_templates() {
811811
<p>
812812
<# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
813813
<?php
814-
_e( 'There is a new version available, but it doesn&#8217;t work with your versions of WordPress and PHP.' );
814+
printf(
815+
/* translators: %s: Theme name. */
816+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
817+
'{{{ data.name }}}'
818+
);
815819
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
816820
printf(
817821
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
@@ -837,7 +841,11 @@ function customize_themes_print_templates() {
837841
?>
838842
<# } else if ( ! data.updateResponse.compatibleWP ) { #>
839843
<?php
840-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of WordPress.' );
844+
printf(
845+
/* translators: %s: Theme name. */
846+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
847+
'{{{ data.name }}}'
848+
);
841849
if ( current_user_can( 'update_core' ) ) {
842850
printf(
843851
/* translators: %s: URL to WordPress Updates screen. */
@@ -848,7 +856,11 @@ function customize_themes_print_templates() {
848856
?>
849857
<# } else if ( ! data.updateResponse.compatiblePHP ) { #>
850858
<?php
851-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of PHP.' );
859+
printf(
860+
/* translators: %s: Theme name. */
861+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
862+
'{{{ data.name }}}'
863+
);
852864
if ( current_user_can( 'update_php' ) ) {
853865
printf(
854866
/* translators: %s: URL to Update PHP page. */

src/wp-admin/themes.php

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,14 @@
398398
<?php endif; ?>
399399
</p></div>
400400
<?php else : ?>
401-
<div class="notice inline notice-error notice-alt"><p>
401+
<div class="update-message notice inline notice-error notice-alt"><p>
402402
<?php
403403
if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
404-
_e( 'There is a new version available, but it doesn&#8217;t work with your versions of WordPress and PHP.' );
404+
printf(
405+
/* translators: %s: Theme name. */
406+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
407+
$theme['name']
408+
);
405409
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
406410
printf(
407411
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
@@ -425,7 +429,11 @@
425429
wp_update_php_annotation( '</p><p><em>', '</em>' );
426430
}
427431
} elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
428-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of WordPress.' );
432+
printf(
433+
/* translators: %s: Theme name. */
434+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
435+
$theme['name']
436+
);
429437
if ( current_user_can( 'update_core' ) ) {
430438
printf(
431439
/* translators: %s: URL to WordPress Updates screen. */
@@ -434,7 +442,11 @@
434442
);
435443
}
436444
} elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
437-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of PHP.' );
445+
printf(
446+
/* translators: %s: Theme name. */
447+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
448+
$theme['name']
449+
);
438450
if ( current_user_can( 'update_php' ) ) {
439451
printf(
440452
/* translators: %s: URL to Update PHP page. */
@@ -719,10 +731,14 @@ function wp_theme_auto_update_setting_template() {
719731
<# } #>
720732
</p></div>
721733
<# } else { #>
722-
<div class="notice inline notice-error notice-alt"><p>
734+
<div class="update-message notice inline notice-error notice-alt"><p>
723735
<# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
724736
<?php
725-
_e( 'There is a new version available, but it doesn&#8217;t work with your versions of WordPress and PHP.' );
737+
printf(
738+
/* translators: %s: Theme name. */
739+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
740+
'{{{ data.name }}}'
741+
);
726742
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
727743
printf(
728744
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
@@ -748,7 +764,11 @@ function wp_theme_auto_update_setting_template() {
748764
?>
749765
<# } else if ( ! data.updateResponse.compatibleWP ) { #>
750766
<?php
751-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of WordPress.' );
767+
printf(
768+
/* translators: %s: Theme name. */
769+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
770+
'{{{ data.name }}}'
771+
);
752772
if ( current_user_can( 'update_core' ) ) {
753773
printf(
754774
/* translators: %s: URL to WordPress Updates screen. */
@@ -759,7 +779,11 @@ function wp_theme_auto_update_setting_template() {
759779
?>
760780
<# } else if ( ! data.updateResponse.compatiblePHP ) { #>
761781
<?php
762-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of PHP.' );
782+
printf(
783+
/* translators: %s: Theme name. */
784+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
785+
'{{{ data.name }}}'
786+
);
763787
if ( current_user_can( 'update_php' ) ) {
764788
printf(
765789
/* translators: %s: URL to Update PHP page. */
@@ -973,7 +997,11 @@ function wp_theme_auto_update_setting_template() {
973997
<p>
974998
<# if ( ! data.updateResponse.compatibleWP && ! data.updateResponse.compatiblePHP ) { #>
975999
<?php
976-
_e( 'There is a new version available, but it doesn&#8217;t work with your versions of WordPress and PHP.' );
1000+
printf(
1001+
/* translators: %s: Theme name. */
1002+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
1003+
'{{{ data.name }}}'
1004+
);
9771005
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
9781006
printf(
9791007
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
@@ -999,7 +1027,11 @@ function wp_theme_auto_update_setting_template() {
9991027
?>
10001028
<# } else if ( ! data.updateResponse.compatibleWP ) { #>
10011029
<?php
1002-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of WordPress.' );
1030+
printf(
1031+
/* translators: %s: Theme name. */
1032+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
1033+
'{{{ data.name }}}'
1034+
);
10031035
if ( current_user_can( 'update_core' ) ) {
10041036
printf(
10051037
/* translators: %s: URL to WordPress Updates screen. */
@@ -1010,7 +1042,11 @@ function wp_theme_auto_update_setting_template() {
10101042
?>
10111043
<# } else if ( ! data.updateResponse.compatiblePHP ) { #>
10121044
<?php
1013-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of PHP.' );
1045+
printf(
1046+
/* translators: %s: Theme name. */
1047+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
1048+
'{{{ data.name }}}'
1049+
);
10141050
if ( current_user_can( 'update_php' ) ) {
10151051
printf(
10161052
/* translators: %s: URL to Update PHP page. */

src/wp-includes/customize/class-wp-customize-theme-control.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,15 @@ public function content_template() {
107107
</p>
108108
</div>
109109
<# } else { #>
110-
<div class="update-message notice inline notice-warning notice-alt" data-slug="{{ data.theme.id }}">
110+
<div class="update-message notice inline notice-error notice-alt" data-slug="{{ data.theme.id }}">
111111
<p>
112112
<# if ( ! data.theme.updateResponse.compatibleWP && ! data.theme.updateResponse.compatiblePHP ) { #>
113113
<?php
114-
_e( 'There is a new version available, but it doesn&#8217;t work with your versions of WordPress and PHP.' );
114+
printf(
115+
/* translators: %s: Theme name. */
116+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your versions of WordPress and PHP.' ),
117+
'{{{ data.theme.name }}}'
118+
);
115119
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
116120
printf(
117121
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
@@ -137,7 +141,11 @@ public function content_template() {
137141
?>
138142
<# } else if ( ! data.theme.updateResponse.compatibleWP ) { #>
139143
<?php
140-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of WordPress.' );
144+
printf(
145+
/* translators: %s: Theme name. */
146+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of WordPress.' ),
147+
'{{{ data.theme.name }}}'
148+
);
141149
if ( current_user_can( 'update_core' ) ) {
142150
printf(
143151
/* translators: %s: URL to WordPress Updates screen. */
@@ -148,7 +156,11 @@ public function content_template() {
148156
?>
149157
<# } else if ( ! data.theme.updateResponse.compatiblePHP ) { #>
150158
<?php
151-
_e( 'There is a new version available, but it doesn&#8217;t work with your version of PHP.' );
159+
printf(
160+
/* translators: %s: Theme name. */
161+
__( 'There is a new version of %s available, but it doesn&#8217;t work with your version of PHP.' ),
162+
'{{{ data.theme.name }}}'
163+
);
152164
if ( current_user_can( 'update_php' ) ) {
153165
printf(
154166
/* translators: %s: URL to Update PHP page. */

0 commit comments

Comments
 (0)