Changeset 1800
- Timestamp:
- 08/01/2015 01:17:57 PM (9 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php
r1791 r1800 43 43 <li class="button download-button"> 44 44 <a href="<?php echo esc_url( $locale_data['language_pack_url'] ); ?>" role="button"> 45 <?php // translators: %s is the latest version ?> 46 <?php printf( __( 'Download language pack (%s)', 'wporg' ), $locale_data['latest_release'] ); ?> 45 <?php 46 // translators: %s is the latest version 47 printf( __( 'Download language pack (%s)', 'wporg' ), $locale_data['language_pack_version'] ); 48 ?> 47 49 </a> 48 50 </li> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php
r1190 r1800 159 159 } 160 160 161 public function get_language_packs_data() { 162 global $wpdb; 163 164 $cache = get_transient( 'wp_i18n_teams_language_packs_data' ); 165 if ( false !== $cache ) { 166 return $cache; 167 } 168 169 $language_packs = $wpdb->get_results( "SELECT language AS locale, version FROM `language_packs` WHERE `type` = 'core' AND `active` = 1 AND `version` NOT LIKE '%-%'" ); 170 171 $language_packs_data = array(); 172 foreach ( $language_packs as $pack ) { 173 if ( ! isset( $language_packs_data[ $pack->locale ] ) ) { 174 $language_packs_data[ $pack->locale ] = array(); 175 } 176 177 $language_packs_data[ $pack->locale ][] = $pack->version; 178 } 179 180 set_transient( 'wp_i18n_teams_language_packs_data', $language_packs_data, 900 ); 181 return $language_packs_data; 182 } 183 161 184 public function get_extended_locale_data( $locale ) { 162 185 $locales_data = $this->get_locales_data(); … … 166 189 $latest_release = $locale_data['latest_release']; 167 190 if ( $latest_release ) { 168 list( $x, $y ) = explode( '.', $latest_release );169 $latest_branch = "$x.$y";170 191 $locale_data['localized_core_url'] = sprintf( '%s/wordpress-%s-%s.zip', $locale_data['rosetta_site_url'], $latest_release, $locale->wp_locale ); 171 172 if ( version_compare( $latest_release, '4.0', '>=' ) ) { 173 $locale_data['language_pack_url'] = sprintf( 'https://downloads.wordpress.org/translation/core/%s/%s.zip', $latest_branch, $locale->wp_locale ); 192 $language_packs_data = $this->get_language_packs_data(); 193 194 if ( version_compare( $latest_release, '4.0', '>=' ) && ! empty( $language_packs_data[ $locale->wp_locale ] ) ) { 195 list( $x, $y ) = explode( '.', $latest_release ); 196 $latest_branch = "$x.$y"; 197 198 $pack_version = null; 199 if ( in_array( $latest_release, $language_packs_data[ $locale->wp_locale ] ) ) { 200 $pack_version = $latest_release; 201 } elseif ( in_array( $latest_branch, $language_packs_data[ $locale->wp_locale ] ) ) { 202 $pack_version = $latest_branch; 203 } 204 205 if ( $pack_version ) { 206 $locale_data['language_pack_version'] = $pack_version; 207 $locale_data['language_pack_url'] = sprintf( 'https://downloads.wordpress.org/translation/core/%s/%s.zip', $pack_version, $locale->wp_locale ); 208 } 174 209 } 175 210 }
Note: See TracChangeset
for help on using the changeset viewer.