From cc2424579e4125a0b9e60b12325b3148e265f4a5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 21 Jul 2023 13:31:17 +0000 Subject: [PATCH] I18N: Add missing translator comment in `WP_Upgrader::generic_strings()`. This resolves a WPCS warning: > A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders. Includes moving `wp-content` out of the translatable string in a similar message in `_wp_delete_all_temp_backups()`. Follow-up to [55720], [56117]. Props jrf. See #58831. git-svn-id: https://develop.svn.wordpress.org/trunk@56276 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-upgrader.php | 1 + src/wp-includes/update.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index a2cea37917..d3788c906c 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -189,6 +189,7 @@ class WP_Upgrader { $this->strings['fs_unavailable'] = __( 'Could not access filesystem.' ); $this->strings['fs_error'] = __( 'Filesystem error.' ); $this->strings['fs_no_root_dir'] = __( 'Unable to locate WordPress root directory.' ); + /* translators: %s: Directory name. */ $this->strings['fs_no_content_dir'] = sprintf( __( 'Unable to locate WordPress content directory (%s).' ), 'wp-content' ); $this->strings['fs_no_plugins_dir'] = __( 'Unable to locate WordPress plugin directory.' ); $this->strings['fs_no_themes_dir'] = __( 'Unable to locate WordPress theme directory.' ); diff --git a/src/wp-includes/update.php b/src/wp-includes/update.php index 1d2f55fbef..350182b2ce 100644 --- a/src/wp-includes/update.php +++ b/src/wp-includes/update.php @@ -1119,7 +1119,11 @@ function _wp_delete_all_temp_backups() { } if ( ! $wp_filesystem->wp_content_dir() ) { - return new WP_Error( 'fs_no_content_dir', __( 'Unable to locate WordPress content directory (wp-content).' ) ); + return new WP_Error( + 'fs_no_content_dir', + /* translators: %s: Directory name. */ + sprintf( __( 'Unable to locate WordPress content directory (%s).' ), 'wp-content' ) + ); } $temp_backup_dir = $wp_filesystem->wp_content_dir() . 'upgrade-temp-backup/';