Changeset 9721
- Timestamp:
- 04/14/2020 05:41:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-language-pack.php
r8489 r9721 16 16 const BUILD_DIR = '/nfs/rosetta/builds'; 17 17 const SVN_URL = 'https://i18n.svn.wordpress.org'; 18 const PACKAGE_THRESHOLD = 9 5;18 const PACKAGE_THRESHOLD = 90; 19 19 20 20 /** … … 320 320 321 321 /** 322 * Retrieves activ ate language packs for a theme/plugin of a version.322 * Retrieves active language packs for a theme/plugin of a version. 323 323 * 324 324 * @param string $type Type of the language pack. Supports 'plugin' or 'theme'. … … 342 342 343 343 return $active_language_packs; 344 } 345 346 /** 347 * Whether there's at least one active language pack for a theme/plugin of any version. 348 * 349 * @param string $type Type of the language pack. Supports 'plugin' or 'theme'. 350 * @param string $domain Slug of a theme/plugin. 351 * @param string $locale WordPress locale. 352 * @return boolean True if theme/plugin has an active language pack, false if not. 353 */ 354 private function has_active_language_pack( $type, $domain, $locale ) { 355 global $wpdb; 356 357 return (bool) $wpdb->get_var( $wpdb->prepare( 358 'SELECT updated FROM language_packs WHERE type = %s AND domain = %s AND language = %s AND active = 1 LIMIT 1', 359 $type, 360 $domain, 361 $locale 362 ) ); 344 363 } 345 364 … … 588 607 } 589 608 590 // Check if percent translated is above threshold. 591 $percent_translated = $set->percent_translated(); 592 if ( ! $this->force && $percent_translated < self::PACKAGE_THRESHOLD ) { 593 WP_CLI::log( "Skip {$wp_locale}, translations below threshold ({$percent_translated}%)." ); 594 continue; 609 // Check if percent translated is above threshold for initial language pack. 610 $has_existing_pack = $this->has_active_language_pack( $data->type, $data->domain, $wp_locale ); 611 if ( ! $has_existing_pack ) { 612 $percent_translated = $set->percent_translated(); 613 if ( ! $this->force && $percent_translated < self::PACKAGE_THRESHOLD ) { 614 WP_CLI::log( "Skip {$wp_locale}, translations below threshold ({$percent_translated}%)." ); 615 continue; 616 } 617 } else { 618 WP_CLI::log( "Skipping threshold check for {$wp_locale}, has existing language pack." ); 595 619 } 596 620
Note: See TracChangeset
for help on using the changeset viewer.