wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_get_available_translations › WordPress Function
Since4.0.0
Deprecatedn/a
› wp_get_available_translations ( No parameters )
See: | |
Returns: |
|
Defined at: |
|
Codex: |
Get available translations from the WordPress.org API.
Source
function wp_get_available_translations() { if ( ! wp_installing() ) { $translations = get_site_transient( 'available_translations' ); if ( false !== $translations ) { return $translations; } } $api = translations_api( 'core', array( 'version' => wp_get_wp_version() ) ); if ( is_wp_error( $api ) || empty( $api['translations'] ) ) { return array(); } $translations = array(); // Key the array with the language code. foreach ( $api['translations'] as $translation ) { $translations[ $translation['language'] ] = $translation; } if ( ! defined( 'WP_INSTALLING' ) ) { set_site_transient( 'available_translations', $translations, 3 * HOUR_IN_SECONDS ); } return $translations; }