translations_api_result filter-hookWP 4.0.0

Filters the Translation Installation API response results.

Usage

add_filter( 'translations_api_result', 'wp_kama_translations_api_result_filter', 10, 3 );

/**
 * Function for `translations_api_result` filter-hook.
 * 
 * @param array|WP_Error $res  On success an associative array of translations, WP_Error on failure.
 * @param string         $type The type of translations being requested.
 * @param object         $args Translation API arguments.
 *
 * @return array|WP_Error
 */
function wp_kama_translations_api_result_filter( $res, $type, $args ){

	// filter...
	return $res;
}
$res(array|WP_Error)

On success an associative array of translations, WP_Error on failure.

  • translations(array)
    List of translations, each an array of data.

    • ...$0(array)

      • language(string)
        Language code.

      • version(string)
        WordPress version.

      • updated(string)
        Date the translation was last updated, in MySQL datetime format.

      • english_name(string)
        English name of the language.

      • native_name(string)
        Native name of the language.

      • package(string)
        URL to download the translation package.

      • iso(string[])
        Array of ISO language codes.

      • strings(array)
        Array of translated strings used in the installation process.
$type(string)
The type of translations being requested.
$args(object)
Translation API arguments.

Changelog

Since 4.0.0 Introduced.

Where the hook is called

translations_api()
translations_api_result
wp-admin/includes/translation-install.php 141
return apply_filters( 'translations_api_result', $res, $type, $args );

Where the hook is used in WordPress

Usage not found.