protected function download_language_pack( $download, $slug = null ) {
		$translations        = $this->get_all_languages( $slug );
		$translation_to_load = null;

		foreach ( $translations as $translation ) {
			if ( $translation['language'] === $download ) {
				$translation_to_load = $translation;
				break;
			}
		}

		if ( ! $translation_to_load ) {
			return new \WP_Error( 'not_found', "Language '{$download}' not available." );
		}
		$translation = (object) $translation;

		$translation->type = rtrim( $this->obj_type, 's' );

		// Make sure caching in LanguagePackUpgrader works.
		if ( ! isset( $translation->slug ) ) {
			$translation->slug = $slug;
		}

		$upgrader = 'WP_CLI\\LanguagePackUpgrader';
		$result   = Utils\get_upgrader( $upgrader )->upgrade( $translation, array( 'clear_update_cache' => false ) );

		if ( is_wp_error( $result ) ) {
			return $result;
		}

		if ( ! $result ) {
			return new \WP_Error( 'not_installed', "Could not install language '{$download}'." );
		}

		return $translation->language;
	}
protected function download_language_pack( $download, $slug = null ) {
		$translations        = $this->get_all_languages( $slug );
		$translation_to_load = null;

		foreach ( $translations as $translation ) {
			if ( $translation['language'] === $download ) {
				$translation_to_load = $translation;
				break;
			}
		}

		if ( ! $translation_to_load ) {
			return new \WP_Error( 'not_found', "Language '{$download}' not available." );
		}
		$translation = (object) $translation;

		$translation->type = rtrim( $this->obj_type, 's' );

		// Make sure caching in LanguagePackUpgrader works.
		if ( ! isset( $translation->slug ) ) {
			$translation->slug = $slug;
		}

		$upgrader = 'WP_CLI\\LanguagePackUpgrader';
		$result   = Utils\get_upgrader( $upgrader )->upgrade( $translation, array( 'clear_update_cache' => false ) );

		if ( is_wp_error( $result ) ) {
			return $result;
		}

		if ( ! $result ) {
			return new \WP_Error( 'not_installed', "Could not install language '{$download}'." );
		}

		return $translation->language;
	}
protected function download_language_pack ( $ download , $ slug = null ) { $ translations = $ this -> get_all_languages ( $ slug ) ; $ translation_to_load = null ; foreach ( $ translations as $ translation ) { if ( $ translation [ 'language' ] === $ download ) { $ translation_to_load = $ translation ; break ; } } if ( ! $ translation_to_load ) { return new \ WP_Error ( 'not_found' , "Language '{$download}' not available." ) ; } $ translation = ( object ) $ translation ; $ translation -> type = rtrim ( $ this -> obj_type , 's' ) ; // Make sure caching in LanguagePackUpgrader works. if ( ! isset ( $ translation -> slug ) ) { $ translation -> slug = $ slug ; } $ upgrader = 'WP_CLI\\LanguagePackUpgrader' ; $ result = Utils \ get_upgrader ( $ upgrader ) -> upgrade ( $ translation , array ( 'clear_update_cache' => false ) ) ; if ( is_wp_error ( $ result ) ) { return $ result ; } if ( ! $ result ) { return new \ WP_Error ( 'not_installed' , "Could not install language '{$download}'." ) ; } return $ translation -> language ; }
Download a language pack.

@see wp_download_language_pack()

@param string $download Language code to download.
@param string $slug Plugin or theme slug. Not used for core.
@return string|\WP_Error Returns the language code if successfully downloaded, or a WP_Error object on failure.
Download a language pack .