diff --git a/plugin.php b/plugin.php index e51aeb2..9e821f4 100644 --- a/plugin.php +++ b/plugin.php @@ -78,7 +78,7 @@ function() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $tab = isset( $_GET['tab'] ) ? sanitize_title_with_dashes( wp_unslash( $_GET['tab'] ) ) : ''; if ( 'dependencies' === $tab ) { - echo '

' . esc_html__( 'These suggestions are based on dependencies required by installed plugins.' ) . '

'; + echo '

' . esc_html__( 'These suggestions are based on dependencies required by installed plugins.', 'wp-plugin-dependencies' ) . '

'; } } ); @@ -93,7 +93,7 @@ function() { * @return array */ public function add_install_tab( $tabs ) { - $tabs['dependencies'] = _x( 'Dependencies', 'Plugin Installer' ); + $tabs['dependencies'] = _x( 'Dependencies', 'Plugin Installer tab name', 'wp-plugin-dependencies' ); return $tabs; } diff --git a/wp-admin/includes/class-wp-plugin-dependencies.php b/wp-admin/includes/class-wp-plugin-dependencies.php index 689661d..8be75c3 100644 --- a/wp-admin/includes/class-wp-plugin-dependencies.php +++ b/wp-admin/includes/class-wp-plugin-dependencies.php @@ -368,7 +368,7 @@ public function modify_plugin_row_elements( $plugin_file, $plugin_data ) { $sources = $this->get_dependency_sources( $plugin_data ); $requires_filepaths = $this->get_requires_paths( $plugin_data ); print ''; } @@ -424,9 +424,9 @@ public function modify_plugin_install_action_links( $action_links, $plugin ) { foreach ( $requires_arr as $req ) { if ( ! $dependencies[ $req ] || is_plugin_inactive( $dependencies[ $req ] ) ) { if ( str_contains( $action_links[0], 'activate-now' ) ) { - $action_links[0] = str_replace( __( 'Network Activate' ), __( 'Activate' ), $action_links[0] ); - $action_links[0] = str_replace( __( 'Activate' ), _x( 'Cannot Activate', 'plugin' ), $action_links[0] ); - $action_links[0] .= '' . __( 'Cannot activate due to unmet dependency' ) . ''; + $action_links[0] = str_replace( __( 'Network Activate', 'wp-plugin-dependencies' ), __( 'Activate', 'wp-plugin-dependencies' ), $action_links[0] ); + $action_links[0] = str_replace( __( 'Activate', 'wp-plugin-dependencies' ), _x( 'Cannot Activate', 'plugin', 'wp-plugin-dependencies' ), $action_links[0] ); + $action_links[0] .= '' . __( 'Cannot activate due to unmet dependency', 'wp-plugin-dependencies' ) . ''; $action_links[0] = str_replace( 'activate-now', 'button-disabled', $action_links[0] ); if ( 'plugin-install.php' !== $pagenow ) { $action_links[] = $this->get_dependency_link(); @@ -457,9 +457,9 @@ public function empty_package_remove_install_button( $action_links, $plugin ) { ) { return $action_links; } - $action_links[0] = str_replace( __( 'Network Install' ), __( 'Install' ), $action_links[0] ); - $action_links[0] = str_replace( __( 'Install Now' ), _x( 'Cannot Install', 'plugin' ), $action_links[0] ); - $action_links[0] .= '' . __( 'Cannot install due to empty package' ) . ''; + $action_links[0] = str_replace( __( 'Network Install', 'wp-plugin-dependencies' ), __( 'Install', 'wp-plugin-dependencies' ), $action_links[0] ); + $action_links[0] = str_replace( __( 'Install Now', 'wp-plugin-dependencies' ), _x( 'Cannot Install', 'plugin', 'wp-plugin-dependencies' ), $action_links[0] ); + $action_links[0] .= '' . __( 'Cannot install due to empty package', 'wp-plugin-dependencies' ) . ''; $action_links[0] = str_replace( 'install-now', 'button-disabled', $action_links[0] ); return $action_links; @@ -476,7 +476,7 @@ public function plugin_install_description( $description, $plugin ) { $required = null; if ( in_array( $plugin['slug'], array_keys( $this->plugin_data ), true ) ) { $dependents = $this->get_dependency_sources( $plugin ); - $required = '' . __( 'Required by:' ) . ' ' . $dependents; + $required = '' . __( 'Required by:', 'wp-plugin-dependencies' ) . ' ' . $dependents; $description = $description . '

' . $required . '

'; } @@ -486,7 +486,7 @@ public function plugin_install_description( $description, $plugin ) { $file = $this->plugin_dirnames[ $plugin['slug'] ]; if ( in_array( $file, array_keys( $this->requires_plugins ), true ) ) { $require_names = $this->get_requires_plugins_names( $file ); - $requires = '' . __( 'Requires:' ) . ' ' . $require_names; + $requires = '' . __( 'Requires:', 'wp-plugin-dependencies' ) . ' ' . $require_names; $description = $description . '

' . $requires . '

'; } @@ -523,7 +523,7 @@ private function get_view_details_links( $plugin_file, $names ) { "%s", esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . '&TB_iframe=true&width=600&height=550' ) ), /* translators: %s: Plugin name. */ - sprintf( __( 'More information about %s' ), $name_attr ), + sprintf( __( 'More information about %s', 'wp-plugin-dependencies' ), $name_attr ), $name_attr, $name ); @@ -572,8 +572,8 @@ public function cannot_activate_unmet_dependencies( $actions, $plugin_file ) { foreach ( $plugin_dependencies as $plugin_dependency ) { if ( ! $dependencies[ $plugin_dependency ] || is_plugin_inactive( $dependencies[ $plugin_dependency ] ) ) { - $activate = _x( 'Cannot Activate', 'plugin' ); - $activate .= '' . __( 'Cannot activate due to unmet dependency' ) . ''; + $activate = _x( 'Cannot Activate', 'plugin', 'wp-plugin-dependencies' ); + $activate .= '' . __( 'Cannot activate due to unmet dependency', 'wp-plugin-dependencies' ) . ''; $dependencies = $this->get_dependency_link(); unset( $actions['activate'] ); $actions = array_merge( @@ -633,7 +633,7 @@ public function admin_notices() { printf( '

' /* translators: 1: plugin names, 2: link to Dependencies install page */ - . esc_html__( '%1$s plugin(s) have been deactivated. There are uninstalled or inactive dependencies. Go to the %2$s install page.' ) + . esc_html__( '%1$s plugin(s) have been deactivated. There are uninstalled or inactive dependencies. Go to the %2$s install page.', 'wp-plugin-dependencies' ) . '

', '' . esc_html( $deactivated_plugins ) . '', wp_kses_post( $this->get_dependency_link( true ) ) @@ -644,14 +644,14 @@ public function admin_notices() { $intersect = array_intersect( $this->slugs, $installed_slugs ); asort( $intersect ); if ( $intersect !== $this->slugs ) { - $message_html = __( 'There are additional plugins that must be installed.' ); + $message_html = __( 'There are additional plugins that must be installed.', 'wp-plugin-dependencies' ); // Display link (if not already on Dependencies install page). // phpcs:ignore WordPress.Security.NonceVerification.Recommended $tab = isset( $_GET['tab'] ) ? sanitize_title_with_dashes( wp_unslash( $_GET['tab'] ) ) : ''; if ( 'plugin-install.php' !== $pagenow || 'dependencies' !== $tab ) { $message_html .= ' ' . sprintf( - /* translators: 1: link to Dependencies install page */ + /* translators: link to Dependencies install page */ __( 'Go to the %s install page.' ), wp_kses_post( $this->get_dependency_link( true ) ), '' @@ -667,9 +667,12 @@ public function admin_notices() { $circular_dependencies = $this->get_circular_dependencies(); if ( ! empty( $circular_dependencies ) && count( $circular_dependencies ) > 1 ) { - /* translators: circular dependencies names */ - $messages = sprintf( __( 'You have circular dependencies with the following plugins: %s' ), implode( ', ', $circular_dependencies['names'] ) ); - $messages .= '
' . __( 'Please contact the plugin developers and make them aware.' ); + $messages = sprintf( + /* translators: circular dependencies names */ + __('You have circular dependencies with the following plugins: %s', 'wp-plugin-dependencies' ), + implode( ', ', $circular_dependencies['names'] ) + ); + $messages .= '
' . __( 'Please contact the plugin developers and make them aware.', 'wp-plugin-dependencies' ); printf( '

%s

', wp_kses_post( $messages ) @@ -773,9 +776,9 @@ private function get_dependency_sources( $plugin_data ) { * @return string */ private function get_dependency_link( $notice = false ) { - $link_text = $notice ? __( 'Dependencies' ) : __( 'Manage Dependencies' ); + $link_text = $notice ? __( 'Dependencies', 'wp-plugin-dependencies' ) : __( 'Manage Dependencies', 'wp-plugin-dependencies' ); $link = sprintf( - '%s', + '%s', $link_text ); @@ -830,7 +833,7 @@ private function get_empty_plugins_api_response( $response, $args ) { $dependencies = $this->get_dependency_filepaths(); $file = $dependencies[ $slug ]; $args = $file ? $this->plugins[ $file ] : $args; - $short_description = __( 'You will need to manually install this dependency. Please contact the plugin\'s developer and ask them to add plugin dependencies support and for information on how to install the this dependency.' ); + $short_description = __( 'You will need to manually install this dependency. Please contact the plugin\'s developer and ask them to add plugin dependencies support and for information on how to install the this dependency.', 'wp-plugin-dependencies' ); $response = array( 'name' => $args['Name'], 'slug' => $slug, @@ -842,7 +845,7 @@ private function get_empty_plugins_api_response( $response, $args ) { 'requires_php' => $args['RequiresPHP'], 'sections' => array( 'description' => '

' . $args['Description'] . '

' . $short_description, - 'installation' => __( 'Ask the plugin developer where to download and install this plugin dependency.' ), + 'installation' => __( 'Ask the plugin developer where to download and install this plugin dependency.', 'wp-plugin-dependencies' ), ), 'short_description' => '

' . $args['Description'] . '

' . $short_description, 'download_link' => '',