private function install_many( $args, $assoc_args ) {
		$language_codes = (array) $args;
		$plugins        = $this->get_all_plugins();

		if ( empty( $assoc_args['format'] ) ) {
			$assoc_args['format'] = 'table';
		}

		if ( in_array( $assoc_args['format'], array( 'json', 'csv' ), true ) ) {
			$logger = new \WP_CLI\Loggers\Quiet();
			\WP_CLI::set_logger( $logger );
		}

		if ( empty( $plugins ) ) {
			\WP_CLI::success( 'No plugins installed.' );
			return;
		}

		$count = count( $plugins ) * count( $language_codes );

		$results = array();

		$successes = 0;
		$errors    = 0;
		$skips     = 0;
		foreach ( $plugins as $plugin_path => $plugin_details ) {
			$plugin_name = \WP_CLI\Utils\get_plugin_name( $plugin_path );

			$available = $this->get_installed_languages( $plugin_name );

			foreach ( $language_codes as $language_code ) {
				$result = [
					'name'   => $plugin_name,
					'locale' => $language_code,
				];

				if ( in_array( $language_code, $available, true ) ) {
					\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' already installed." );
					$result['status'] = 'already installed';
					$skips++;
				} else {
					$response = $this->download_language_pack( $language_code, $plugin_name );

					if ( is_wp_error( $response ) ) {
						\WP_CLI::warning( $response );
						\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' not installed." );

						if ( 'not_found' === $response->get_error_code() ) {
							$result['status'] = 'not available';
							$skips++;
						} else {
							$result['status'] = 'not installed';
							$errors++;
						}
					} else {
						\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' installed." );
						$result['status'] = 'installed';
						$successes++;
					}
				}

				$results[] = (object) $result;
			}
		}

		if ( 'summary' !== $assoc_args['format'] ) {
			\WP_CLI\Utils\format_items( $assoc_args['format'], $results, array( 'name', 'locale', 'status' ) );
		}

		\WP_CLI\Utils\report_batch_operation_results( 'language', 'install', $count, $successes, $errors, $skips );
	}
private function install_many( $args, $assoc_args ) {
		$language_codes = (array) $args;
		$plugins        = $this->get_all_plugins();

		if ( empty( $assoc_args['format'] ) ) {
			$assoc_args['format'] = 'table';
		}

		if ( in_array( $assoc_args['format'], array( 'json', 'csv' ), true ) ) {
			$logger = new \WP_CLI\Loggers\Quiet();
			\WP_CLI::set_logger( $logger );
		}

		if ( empty( $plugins ) ) {
			\WP_CLI::success( 'No plugins installed.' );
			return;
		}

		$count = count( $plugins ) * count( $language_codes );

		$results = array();

		$successes = 0;
		$errors    = 0;
		$skips     = 0;
		foreach ( $plugins as $plugin_path => $plugin_details ) {
			$plugin_name = \WP_CLI\Utils\get_plugin_name( $plugin_path );

			$available = $this->get_installed_languages( $plugin_name );

			foreach ( $language_codes as $language_code ) {
				$result = [
					'name'   => $plugin_name,
					'locale' => $language_code,
				];

				if ( in_array( $language_code, $available, true ) ) {
					\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' already installed." );
					$result['status'] = 'already installed';
					$skips++;
				} else {
					$response = $this->download_language_pack( $language_code, $plugin_name );

					if ( is_wp_error( $response ) ) {
						\WP_CLI::warning( $response );
						\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' not installed." );

						if ( 'not_found' === $response->get_error_code() ) {
							$result['status'] = 'not available';
							$skips++;
						} else {
							$result['status'] = 'not installed';
							$errors++;
						}
					} else {
						\WP_CLI::log( "Language '{$language_code}' for '{$plugin_details['Name']}' installed." );
						$result['status'] = 'installed';
						$successes++;
					}
				}

				$results[] = (object) $result;
			}
		}

		if ( 'summary' !== $assoc_args['format'] ) {
			\WP_CLI\Utils\format_items( $assoc_args['format'], $results, array( 'name', 'locale', 'status' ) );
		}

		\WP_CLI\Utils\report_batch_operation_results( 'language', 'install', $count, $successes, $errors, $skips );
	}
private function install_many ( $ args , $ assoc_args ) { $ language_codes = ( array ) $ args ; $ plugins = $ this -> get_all_plugins ( ) ; if ( empty ( $ assoc_args [ 'format' ] ) ) { $ assoc_args [ 'format' ] = 'table' ; } if ( in_array ( $ assoc_args [ 'format' ] , array ( 'json' , 'csv' ) , true ) ) { $ logger = new \ WP_CLI \ Loggers \ Quiet ( ) ; \ WP_CLI :: set_logger ( $ logger ) ; } if ( empty ( $ plugins ) ) { \ WP_CLI :: success ( 'No plugins installed.' ) ; return ; } $ count = count ( $ plugins ) * count ( $ language_codes ) ; $ results = array ( ) ; $ successes = 0 ; $ errors = 0 ; $ skips = 0 ; foreach ( $ plugins as $ plugin_path => $ plugin_details ) { $ plugin_name = \ WP_CLI \ Utils \ get_plugin_name ( $ plugin_path ) ; $ available = $ this -> get_installed_languages ( $ plugin_name ) ; foreach ( $ language_codes as $ language_code ) { $ result = [ 'name' => $ plugin_name , 'locale' => $ language_code , ] ; if ( in_array ( $ language_code , $ available , true ) ) { \ WP_CLI :: log ( "Language '{$language_code}' for '{$plugin_details['Name']}' already installed." ) ; $ result [ 'status' ] = 'already installed' ; $ skips ++ ; } else { $ response = $ this -> download_language_pack ( $ language_code , $ plugin_name ) ; if ( is_wp_error ( $ response ) ) { \ WP_CLI :: warning ( $ response ) ; \ WP_CLI :: log ( "Language '{$language_code}' for '{$plugin_details['Name']}' not installed." ) ; if ( 'not_found' === $ response -> get_error_code ( ) ) { $ result [ 'status' ] = 'not available' ; $ skips ++ ; } else { $ result [ 'status' ] = 'not installed' ; $ errors ++ ; } } else { \ WP_CLI :: log ( "Language '{$language_code}' for '{$plugin_details['Name']}' installed." ) ; $ result [ 'status' ] = 'installed' ; $ successes ++ ; } } $ results [ ] = ( object ) $ result ; } } if ( 'summary' !== $ assoc_args [ 'format' ] ) { \ WP_CLI \ Utils \ format_items ( $ assoc_args [ 'format' ] , $ results , array ( 'name' , 'locale' , 'status' ) ) ; } \ WP_CLI \ Utils \ report_batch_operation_results ( 'language' , 'install' , $ count , $ successes , $ errors , $ skips ) ; }
Installs translations for all installed plugins.

@param array $args       Runtime arguments.
@param array $assoc_args Runtime arguments.
Installs translations for all installed plugins .