Ticket #2320: 2320.diff
File 2320.diff, 3.2 KB (added by , 6 years ago) |
---|
-
views/locale-details.php
129 129 <?php endif; ?> 130 130 131 131 <?php if ( ! empty( $locale_data['translators'] ) ) : ?> 132 <h2><?php printf( __( ' AllTranslation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators'] ) ) ); ?></h2>132 <h2><?php printf( __( 'Current Translation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators'] ) ) ); ?></h2> 133 133 134 134 <p> 135 135 <?php … … 146 146 </p> 147 147 <?php endif; ?> 148 148 149 <?php if ( ! empty( $locale_data['translators_past'] ) ) : ?> 150 <h2><?php printf( __( 'Past Translation Contributors (%s)', 'wporg' ), number_format_i18n( count( $locale_data['translators_past'] ) ) ); ?></h2> 151 152 <p> 153 <?php 154 $translators = array(); 155 foreach ( $locale_data['translators_past'] as $translator ) { 156 $translators[] = sprintf( 157 '<a href="https://profiles.wordpress.org/%s">%s</a>', 158 esc_attr( $translator['nice_name'] ), 159 esc_html( $translator['display_name'] ) 160 ); 161 } 162 echo wp_sprintf( '%l.', $translators ); 163 ?> 164 </p> 165 <?php endif; ?> 166 149 167 <?php 150 168 $notice = sprintf( 151 169 '%s <a href="https://translate.wordpress.org/locale/%s">%s</a>', -
wp-i18n-teams.php
281 281 $locale_data['validators'] = $contributors['validators']; 282 282 $locale_data['project_validators'] = $contributors['project_validators']; 283 283 $locale_data['translators'] = $contributors['translators']; 284 $locale_data['translators_past'] = $contributors['translators_past']; 284 285 285 286 return $locale_data; 286 287 } … … 301 302 $contributors['locale_managers'] = $this->get_locale_managers( $locale ); 302 303 $contributors['validators'] = $this->get_general_translation_editors( $locale ); 303 304 $contributors['project_validators'] = $this->get_project_translation_editors( $locale ); 304 $contributors['translators'] = $this->get_translation_contributors( $locale ); 305 $contributors['translators'] = $this->get_translation_contributors( $locale, 365 ); // Contributors from the past year 306 $contributors['translators_past'] = array_diff_key( $this->get_translation_contributors( $locale ), $contributors['translators'] ); 305 307 306 308 wp_cache_set( 'contributors-data:' . $locale->wp_locale, $contributors, 'wp-i18n-teams', 2 * HOUR_IN_SECONDS ); 307 309 … … 477 479 * @param GP_Locale $locale 478 480 * @return array 479 481 */ 480 private function get_translation_contributors( $locale ) {482 private function get_translation_contributors( $locale, $max_age_days = null ) { 481 483 global $wpdb; 482 484 483 485 $contributors = array(); 484 486 487 $date_constraint = ''; 488 if ( !is_null( $max_age_days ) ) 489 $date_constraint = $wpdb->prepare( " AND date_modified >= CURRENT_DATE - INTERVAL %d DAY", $max_age_days ); 490 485 491 $users = $wpdb->get_col( $wpdb->prepare( 486 492 "SELECT DISTINCT user_id FROM translate_user_translations_count WHERE accepted > 0 AND locale = %s", 487 493 $locale->slug 488 ) );494 ) . $date_constraint ); 489 495 490 496 if ( ! $users ) { 491 497 $contributors;