Making WordPress.org

Changeset 778


Ignore:
Timestamp:
08/04/2014 08:13:24 PM (11 years ago)
Author:
nacin
Message:

Translations API: Return 'Continue' strings for core.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/translations/lib.php

    r738 r778  
    5757
    5858    $_translations = array();
     59    if ( 'core' === $type ) {
     60        $continue_translations = wp_cache_get( 'continue-strings', $cache_group );
     61        if ( ! $continue_translations ) {
     62            // Magic numbers: 78 is wp/dev/admin. 326 is 'Continue'.
     63            $continue_translations = $wpdb->get_results(
     64                "SELECT locale as gp_locale, translation_0 as translation
     65                FROM translate_translation_sets ts
     66                INNER JOIN translate_translations t
     67                ON ts.id = t.translation_set_id
     68                WHERE project_id = 78
     69                AND slug = 'default'
     70                AND original_id = 326", OBJECT_K
     71            );
     72            wp_cache_add( 'continue-strings', $continue_translations, $cache_group, $cache_time );
     73        }
     74    }
     75
    5976    foreach ( $translations as $translation ) {
    6077        $locale = GP_Locales::by_field( 'wp_locale', $translation->language );
     
    8198        $_translations[ $iso ]->package = sprintf( "$base_url/%s/%s.zip", $translation->version, $translation->language );
    8299        $_translations[ $iso ]->iso = (object) $isos;
     100
     101        if ( 'core' === $type ) {
     102            $continue = isset( $continue_translations[ $locale->slug ] ) ? $continue_translations[ $locale->slug ]->translation : '';
     103            $_translations[ $iso ]->strings = (object) array( 'continue' => $continue );
     104        }
    83105    }
    84106    ksort( $_translations );
Note: See TracChangeset for help on using the changeset viewer.