- Timestamp:
- 06/23/2015 10:33:30 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/public_html/gp-templates/locale.php
r1586 r1684 2 2 gp_title( sprintf( __( 'Projects translated to %s < GlotPress' ), esc_html( $locale->english_name ) ) ); 3 3 4 $breadcrumb = array();4 $breadcrumb = array(); 5 5 $breadcrumb[] = gp_link_get( '/languages', __( 'Locales' ) ); 6 if ( 'default' == $current_set_slug ) { 7 $breadcrumb[] = esc_html( $locale->english_name ); 8 } else { 9 $breadcrumb[] = gp_link_get( gp_url_join( '/languages', $locale->slug ), esc_html( $locale->english_name ) ); 10 $breadcrumb[] = $set_list[ $current_set_slug ]; 11 } 6 $breadcrumb[] = esc_html( $locale->english_name ); 12 7 gp_breadcrumb( $breadcrumb ); 13 8 gp_tmpl_header(); 14 9 ?> 15 10 16 <h2><?php printf( __( 'Active Projects translated to %s' ), esc_html( $locale->english_name ) ); ?></h2> 11 <div class="locale-header"> 12 <p class="locale-intro">Translate WordPress, core projects, plugins, and themes into your language. Select your project below to get started.</p> 17 13 18 <?php if ( count( $set_list ) > 1 ) : ?> 19 <p class="actionlist secondary"> 20 <?php echo implode( ' • ', $set_list ); ?> 21 </p> 22 <?php endif; ?> 14 <div class="locale-box"> 15 <ul class="name"> 16 <li class="english"><?php echo $locale->english_name; ?></li> 17 <li class="native"><?php echo $locale->native_name; ?></li> 18 <li class="code"> 19 <?php 20 echo $locale->wp_locale; 23 21 24 <?php 25 if ( empty( $projects_data ) ) { 26 _e( 'No active projects found.' ); 27 } 28 ?> 22 if ( count( $variants ) > 1 ) { 23 ?> 24 <select id="variant-selector" name="variant"> 25 <?php 26 foreach ( $variants as $variant ) { 27 $selected = 28 printf( 29 '<option name="%s" data-project-url="%s"%s>%s</option>', 30 $variant, 31 esc_url( gp_url_join( '/languages', $locale_slug, $variant, $project->slug ) ), 32 ( $set_slug == $variant ) ? ' selected="selected"' : '', 33 ucfirst( $variant ) 34 ); 35 } 36 ?> 37 </select> 38 <?php 39 } 40 ?> 41 </li> 42 </ul> 43 <div class="contributors"> 44 <?php 45 $contributors = sprintf( 46 '<span class="dashicons dashicons-admin-users"></span><br />%s', 47 isset( $contributors_count[ $locale->slug ] ) ? $contributors_count[ $locale->slug ] : 0 48 ); 49 echo gp_link_get( 'https://make.wordpress.org/polyglots/teams/?locale=' . $locale->wp_locale, $contributors ); 50 ?> 51 </div> 52 </div> 53 </div> 29 54 30 <?php foreach ( $projects_data as $project_id => $sub_projects ) : ?> 31 <div class="locale-project"> 32 <h3><?php echo ( $projects[$project_id]->name );?></h3> 33 <table class="locale-sub-projects"> 34 <thead> 35 <tr> 36 <th class="header" <?php if (count($sub_projects)>1 ) echo 'rowspan="'. count($sub_projects) . '"';?>><?php if (count($sub_projects)>1 ) _e( 'Project' ); ?></th> 37 <th class="header"><?php _e( 'Set / Sub Project' ); ?></th> 38 <th><?php _e( 'Translated' ); ?></th> 39 <th><?php _e( 'Fuzzy' ); ?></th> 40 <th><?php _e( 'Untranslated' ); ?></th> 41 <th><?php _e( 'Waiting' ); ?></th> 42 </tr> 43 </thead> 44 <tbody> 45 <?php foreach ( $sub_projects as $sub_project_id => $data ) : ?> 46 <tr> 47 <th class="sub-project" rowspan="<?php echo count( $data['sets'] ); ?>"> 48 <?php if (count($sub_projects)>1 ) echo esc_html( $projects[$sub_project_id]->name ); ?> 49 <div class="stats"> 50 <div class="total-strings"><?php printf( __( '%d strings' ), $data['totals']->all_count ); ?></div> 51 <div class="percent-completed"><?php printf( __( '%d%% translated' ), $data['totals']->current_count ? floor( absint($data['totals']->current_count ) / absint( $data['totals']->all_count ) * 100 ) : 0 ); ?></div> 52 </div> 53 </th> 54 <?php foreach ( $data['sets'] as $set_id => $set_data ) : ?> 55 <?php reset( $data['sets'] ); if ( $set_id !== key($data['sets']) ) echo '<tr>'; ?> 56 <td class="set-name"> 57 <strong><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ) ), $set_data->name ); ?></strong> 58 <?php if ( $set_data->current_count && $set_data->current_count >= $set_data->all_count * 0.9 ): 59 $percent = floor( $set_data->current_count / $set_data->all_count * 100 ); 60 ?> 61 <span class="bubble morethan90"><?php echo $percent; ?>%</span> 62 <?php endif;?> 63 </td> 64 <td class="stats translated"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'current') ), absint( $set_data->current_count ) ); ?></td> 65 <td class="stats fuzzy"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[status]' => 'fuzzy' ) ), absint( $set_data->fuzzy_count ) ); ?></td> 66 <td class="stats untranslated"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[status]' => 'untranslated' ) ), absint( $set_data->all_count ) - absint( $set_data->current_count ) ); ?></td> 67 <td class="stats waiting"><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ), array('filters[translated]' => 'yes', 'filters[status]' => 'waiting') ), absint( $set_data->waiting_count ) ); ?></td> 68 </tr> 69 <?php endforeach; //sub project slugs ?> 70 </tr> 71 <?php endforeach; //sub projects ?> 72 </tbody> 73 </table> 55 <div class="filter-header"> 56 <ul class="filter-header-links"> 57 <?php 58 foreach ( $top_level_projects as $top_level_project ) { 59 printf( 60 '<li><a href="%s"%s>%s</a></li>', 61 gp_url_join( '/languages', $locale_slug, $set_slug, $top_level_project->slug ), 62 ( $top_level_project->path == $project_path ) ? ' class="current"' : '', 63 $top_level_project->name 64 ); 65 } 66 ?> 67 </ul> 68 <div class="search-form"> 69 <label class="screen-reader-text" for="projects-filter"><?php esc_attr_e( 'Search projects...' ); ?></label> 70 <input placeholder="<?php esc_attr_e( 'Search projects...' ); ?>" type="search" id="projects-filter" class="filter-search"> 74 71 </div> 75 < ?php endforeach; //top projects ?>72 </div> 76 73 77 <p class="actionlist secondary"> 78 <?php gp_link( '/projects', __('All projects') ); ?> 79 </p> 74 <div id="projects" class="projects"> 75 <?php 76 foreach ( $sub_projects as $sub_project ) { 77 $percent_complete = $waiting = $sub_projects_count = 0; 78 if ( isset( $project_status[ $sub_project->id ] ) ) { 79 $status = $project_status[ $sub_project->id ]; 80 $percent_complete = floor( $status->current_count / $status->all_count * 100 ); 81 $waiting = $status->waiting_count; 82 $sub_projects_count = $status->sub_projects_count; 83 } 84 85 $project_url = gp_url_join( '/languages', $locale_slug, $set_slug, $sub_project->path ); 86 87 $project_icon = ''; 88 if ( isset( $project_icons[ $sub_project->id ] ) ) { 89 $project_icon = $project_icons[ $sub_project->id ]; 90 } 91 92 $classes = 'project-' . sanitize_title_with_dashes( str_replace( '/', '-', $project->path ) ); 93 $classes .= ' project-' . sanitize_title_with_dashes( str_replace( '/', '-', $sub_project->path ) ); 94 $classes .= ' percent-' . $percent_complete; 95 ?> 96 <div class="project <?php echo $classes; ?>"> 97 <div class="project-top"> 98 <div class="project-icon"> 99 <?php echo gp_link_get( $project_url, $project_icon ) ?> 100 </div> 101 102 <div class="project-name"> 103 <h4> 104 <?php echo gp_link_get( $project_url, $sub_project->name ) ?> 105 </h4> 106 </div> 107 <div class="project-description"> 108 <p><?php echo $sub_project->description; ?></p> 109 </div> 110 </div> 111 112 <div class="project-status"> 113 <div class="project-status-sub-projects"> 114 <span class="project-status-title">Sub-Projects</span> 115 <span class="project-status-value"><?php echo $sub_projects_count; ?></span> 116 </div> 117 <div class="project-status-waiting"> 118 <span class="project-status-title">Waiting</span> 119 <span class="project-status-value"><?php echo $waiting; ?></span> 120 </div> 121 <div class="project-status-progress"> 122 <span class="project-status-title">Progress</span> 123 <span class="project-status-value"><?php echo $percent_complete; ?>%</span> 124 </div> 125 </div> 126 127 <div class="percent"> 128 <div class="percent-complete" style="width:<?php echo $percent_complete; ?>%;"></div> 129 </div> 130 131 <div class="project-bottom"> 132 <div class="button contribute-button"> 133 <?php echo gp_link_get( $project_url, 'Translate Project' ) ?> 134 </div> 135 </div> 136 </div> 137 <?php 138 } 139 ?> 140 </div> 141 142 <script> 143 jQuery( document ).ready( function( $ ) { 144 $rows = $( '#projects' ).find( '.project' ); 145 $( '#projects-filter' ).on( 'input keyup', function() { 146 var words = this.value.toLowerCase().split( ' ' ); 147 148 if ( '' === this.value.trim() ) { 149 $rows.show(); 150 } else { 151 $rows.hide(); 152 $rows.filter( function( i, v ) { 153 var $t = $(this).find( '.project-top' ); 154 for ( var d = 0; d < words.length; ++d ) { 155 if ( $t.text().toLowerCase().indexOf( words[d] ) != -1 ) { 156 return true; 157 } 158 } 159 return false; 160 }).show(); 161 } 162 }); 163 164 $( '#variant-selector' ).on( 'change', function( event ) { 165 event.preventDefault(); 166 167 var $optionSelected = $( 'option:selected', this ), 168 projectUrl = $optionSelected.data( 'projectUrl' ); 169 170 if ( projectUrl.length ) { 171 window.location = projectUrl; 172 } 173 }); 174 }); 175 </script> 80 176 81 177 <?php gp_tmpl_footer();
Note: See TracChangeset
for help on using the changeset viewer.