wp/wp-admin/includes/translation-install.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    27 	/**
    27 	/**
    28 	 * Allows a plugin to override the WordPress.org Translation Installation API entirely.
    28 	 * Allows a plugin to override the WordPress.org Translation Installation API entirely.
    29 	 *
    29 	 *
    30 	 * @since 4.0.0
    30 	 * @since 4.0.0
    31 	 *
    31 	 *
    32 	 * @param bool|array  $result The result object. Default false.
    32 	 * @param false|object $result The result object. Default false.
    33 	 * @param string      $type   The type of translations being requested.
    33 	 * @param string       $type   The type of translations being requested.
    34 	 * @param object      $args   Translation API arguments.
    34 	 * @param object       $args   Translation API arguments.
    35 	 */
    35 	 */
    36 	$res = apply_filters( 'translations_api', false, $type, $args );
    36 	$res = apply_filters( 'translations_api', false, $type, $args );
    37 
    37 
    38 	if ( false === $res ) {
    38 	if ( false === $res ) {
    39 		$url      = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
    39 		$url      = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
   204  * @since 4.0.0
   204  * @since 4.0.0
   205  *
   205  *
   206  * @see wp_get_available_translations()
   206  * @see wp_get_available_translations()
   207  *
   207  *
   208  * @param string $download Language code to download.
   208  * @param string $download Language code to download.
   209  * @return string|bool Returns the language code if successfully downloaded
   209  * @return string|false Returns the language code if successfully downloaded
   210  *                     (or already installed), or false on failure.
   210  *                      (or already installed), or false on failure.
   211  */
   211  */
   212 function wp_download_language_pack( $download ) {
   212 function wp_download_language_pack( $download ) {
   213 	// Check if the translation is already installed.
   213 	// Check if the translation is already installed.
   214 	if ( in_array( $download, get_available_languages(), true ) ) {
   214 	if ( in_array( $download, get_available_languages(), true ) ) {
   215 		return $download;
   215 		return $download;