WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/23/2013 02:07:51 AM (8 years ago)
Author:
nacin
Message:

Add a language pack upgrader class.

At the conclusion of any upgrade, after the transients are refreshed from the API, pending translations are downloaded and installed to wp-content/languages.

props dd32.
see #18200.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update.php

    r25540 r25566  
    380380}
    381381add_action( 'admin_notices', 'maintenance_nag' );
     382
     383/**
     384 * Retrieves a list of all language updates available.
     385 *
     386 * @since 3.7.0
     387 */
     388function wp_get_translation_updates() {
     389    $updates = array();
     390    $transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' );
     391    foreach ( $transients as $transient => $type ) {
     392
     393        $transient = get_site_transient( $transient );
     394        if ( empty( $transient->translations ) )
     395            continue;
     396
     397        foreach ( $transient->translations as $translation ) {
     398            $updates[] = (object) $translation;
     399        }
     400    }
     401
     402    return $updates;
     403}
Note: See TracChangeset for help on using the changeset viewer.