translations_api example

function wp_get_available_translations() {
    if ( ! wp_installing() ) {
        $translations = get_site_transient( 'available_translations' );
        if ( false !== $translations ) {
            return $translations;
        }
    }

    // Include an unmodified $wp_version.     require ABSPATH . WPINC . '/version.php';

    $api = translations_api( 'core', array( 'version' => $wp_version ) );

    if ( is_wp_error( $api ) || empty( $api['translations'] ) ) {
        return array();
    }

    $translations = array();
    // Key the array with the language code for now.     foreach ( $api['translations'] as $translation ) {
        $translations[ $translation['language'] ] = $translation;
    }

    
Home | Imprint | This part of the site doesn't use cookies.