Making WordPress.org

Ticket #1121: 1121.patch

File 1121.patch, 2.0 KB (added by ocean90, 10 years ago)
  • trunk/api.wordpress.org/public_html/translations/lib.php

     
    5151        }
    5252
    5353        require_once WPORGPATH . 'translate/glotpress/locales/locales.php';
     54        // Add some language variants to locales until GlotPress supports them.
     55        $GLOBALS['gp_locales'] = new GP_Locales;
     56        $de_formal = clone GP_Locales::by_field( 'wp_locale', 'de_DE' );
     57        $de_formal->english_name = 'German (Formal)';
     58        $de_formal->native_name = 'Deutsch (Sie)';
     59        $de_formal->slug = 'de/formal';
     60        $de_formal->wp_locale = 'de_DE_formal';
     61        $GLOBALS['gp_locales']->locales['de/formal'] = $de_formal;
     62
     63        $pt_informal = clone GP_Locales::by_field( 'wp_locale', 'pt_PT' );
     64        $pt_informal->english_name = 'Portuguese (Portugal/Informal)';
     65        $pt_informal->native_name = 'Português (informal)';
     66        $pt_informal->slug = 'pt/informal';
     67        $pt_informal->wp_locale = 'pt_PT_informal';
     68        $GLOBALS['gp_locales']->locales['pt/formal'] = $pt_informal;
     69
    5470        $base_url = is_ssl() ? 'https' : 'http';
    5571        $base_url .= '://downloads.wordpress.org/translation/';
    5672        $base_url .= ( $type == 'core' ) ? 'core' : "$type/$domain";
     
    6177                if ( ! $continue_translations ) {
    6278                        // Magic numbers: 78 is wp/dev/admin. 326 is 'Continue'.
    6379                        $continue_translations = $wpdb->get_results(
    64                                 "SELECT locale as gp_locale, translation_0 as translation
     80                                "SELECT
     81                                        IF(ts.slug <> 'default', CONCAT(ts.locale, '/', ts.slug), ts.locale) as gp_locale,
     82                                        translation_0 as translation
    6583                                FROM translate_translation_sets ts
    6684                                INNER JOIN translate_translations t
    6785                                ON ts.id = t.translation_set_id
    6886                                WHERE project_id = 78
    69                                 AND slug = 'default'
    7087                                AND original_id = 326", OBJECT_K
    7188                        );
    7289                        wp_cache_add( 'continue-strings', $continue_translations, $cache_group, $cache_time );
     
    246263
    247264        return $translations;
    248265}
    249