[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> locale.php (source)

   1  <?php
   2  gp_title(
   3      sprintf(
   4          /* translators: %s: Locale english name. */
   5          __( 'Projects translated to %s &lt; GlotPress', 'glotpress' ),
   6          esc_html( $locale->english_name )
   7      )
   8  );
   9  
  10  $breadcrumb   = array();
  11  $breadcrumb[] = gp_link_get( gp_url( '/languages' ), __( 'Locales', 'glotpress' ) );
  12  if ( 'default' == $current_set_slug ) {
  13      $breadcrumb[] = esc_html( $locale->english_name );
  14  } else {
  15      $breadcrumb[] = gp_link_get( gp_url_join( gp_url( '/languages' ), $locale->slug ), esc_html( $locale->english_name ) );
  16      $breadcrumb[] = $set_list[ $current_set_slug ];
  17  }
  18  gp_breadcrumb( $breadcrumb );
  19  gp_tmpl_header();
  20  ?>
  21  
  22  <div class="gp-heading">
  23      <h2>
  24          <?php
  25          printf(
  26              /* translators: %s: Locale english name. */
  27              esc_html__( 'Active Projects translated to %s', 'glotpress' ),
  28              esc_html( $locale->english_name )
  29          );
  30          ?>
  31      </h2>
  32      <div class="glossary-links">
  33          <?php if ( $locale_glossary ) : ?>
  34              <a href="<?php echo esc_url( gp_url_join( gp_url( '/languages' ), $locale->slug, $current_set_slug, 'glossary' ) ); ?>" class="glossary-link"><?php _e( 'Locale Glossary', 'glotpress' ); ?></a>
  35          <?php elseif ( $can_create_locale_glossary ) : ?>
  36              <a href="<?php echo esc_url( gp_url_join( gp_url( '/languages' ), $locale->slug, $current_set_slug, 'glossary' ) ); ?>" class="glossary-link"><?php _e( 'Create Locale Glossary', 'glotpress' ); ?></a>
  37          <?php endif; ?>
  38      </div>
  39  </div>
  40  
  41  <?php if ( count( $set_list ) > 1 ) : ?>
  42      <p class="actionlist">
  43          <?php
  44          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in GP_Route_Locale::single().
  45          echo implode( ' &bull; ', $set_list );
  46          ?>
  47      </p>
  48  <?php endif; ?>
  49  
  50  <?php
  51  if ( empty( $projects_data ) ) {
  52      _e( 'No active projects found.', 'glotpress' );
  53  }
  54  ?>
  55  
  56  <?php
  57  foreach ( $projects_data as $project_id => $sub_projects ) :
  58      $count_sub_projects = count( $sub_projects );
  59      $has_sub_projects   = $count_sub_projects > 1;
  60      ?>
  61      <div class="locale-project">
  62          <h3><?php echo esc_html( $projects[ $project_id ]->name ); ?></h3>
  63          <table class="gp-table locale-sub-projects">
  64              <thead>
  65                  <tr>
  66                      <th class="gp-column-project-stats" rowspan="<?php echo esc_attr( $count_sub_projects ); ?>"><?php _e( 'Project / Stats', 'glotpress' ); ?></th>
  67                      <th class="gp-column-set-sub-projects"><?php _e( 'Set / Sub Project', 'glotpress' ); ?></th>
  68                      <th class="gp-column-translated"><?php _e( 'Translated', 'glotpress' ); ?></th>
  69                      <th class="gp-column-fuzzy"><?php _e( 'Fuzzy', 'glotpress' ); ?></th>
  70                      <th class="gp-column-untranslated"><?php _e( 'Untranslated', 'glotpress' ); ?></th>
  71                      <th class="gp-column-waiting"><?php _e( 'Waiting', 'glotpress' ); ?></th>
  72                  </tr>
  73              </thead>
  74              <tbody>
  75              <?php foreach ( $sub_projects as $sub_project_id => $data ) : ?>
  76                  <tr>
  77                  <th class="sub-project" rowspan="<?php echo count( $data['sets'] ); ?>">
  78                      <?php
  79                      if ( $has_sub_projects ) {
  80                          echo esc_html( $projects[ $sub_project_id ]->name );
  81                      }
  82                      ?>
  83                      <div class="stats">
  84                          <div class="total-strings">
  85                              <?php
  86                              printf(
  87                                  /* translators: %s: Count number. */
  88                                  __( '%s strings', 'glotpress' ),
  89                                  number_format_i18n( $data['totals']->all_count )
  90                              );
  91                              ?>
  92                          </div>
  93                          <div class="percent-completed">
  94                              <?php
  95                              $percent_completed = 0;
  96                              if ( $data['totals']->current_count ) {
  97                                  $percent_completed = floor( $data['totals']->current_count / $data['totals']->all_count * 100 );
  98                              }
  99                              printf(
 100                                  /* translators: %s: Percent completed. */
 101                                  __( '%s%% translated', 'glotpress' ),
 102                                  number_format_i18n( $percent_completed )
 103                              );
 104                              ?>
 105                          </div>
 106                      </div>
 107                  </th>
 108                  <?php foreach ( $data['sets'] as $set_id => $set_data ) : ?>
 109                      <?php
 110                      reset( $data['sets'] );
 111                      if ( key( $data['sets'] ) !== $set_id ) {
 112                          echo '<tr>';
 113                      }
 114                      ?>
 115                      <td class="set-name">
 116                          <strong><?php gp_link( gp_url_project( $set_data->project_path, gp_url_join( $locale->slug, $set_data->slug ) ), $set_data->name ); ?></strong>
 117                          <?php
 118                          if ( $set_data->current_count && $set_data->current_count >= $set_data->all_count * 0.9 ) :
 119                              $percent = floor( $set_data->current_count / $set_data->all_count * 100 );
 120                              ?>
 121                              <span class="bubble morethan90"><?php echo number_format_i18n( $percent ); ?>%</span>
 122                          <?php endif; ?>
 123                      </td>
 124                      <td class="stats translated">
 125                          <?php
 126                          gp_link(
 127                              gp_url_project(
 128                                  $set_data->project_path,
 129                                  gp_url_join( $locale->slug, $set_data->slug ),
 130                                  array(
 131                                      'filters[status]' => 'current',
 132                                  )
 133                              ),
 134                              number_format_i18n( $set_data->current_count )
 135                          );
 136                          ?>
 137                      </td>
 138                      <td class="stats fuzzy">
 139                          <?php
 140                          gp_link(
 141                              gp_url_project(
 142                                  $set_data->project_path,
 143                                  gp_url_join( $locale->slug, $set_data->slug ),
 144                                  array(
 145                                      'filters[status]' => 'fuzzy',
 146                                  )
 147                              ),
 148                              number_format_i18n( $set_data->fuzzy_count )
 149                          );
 150                          ?>
 151                      </td>
 152                      <td class="stats untranslated">
 153                          <?php
 154                          gp_link(
 155                              gp_url_project(
 156                                  $set_data->project_path,
 157                                  gp_url_join( $locale->slug, $set_data->slug ),
 158                                  array(
 159                                      'filters[status]' => 'untranslated',
 160                                  )
 161                              ),
 162                              number_format_i18n( $set_data->all_count - $set_data->current_count )
 163                          );
 164                          ?>
 165                      </td>
 166                      <td class="stats waiting">
 167                          <?php
 168                          gp_link(
 169                              gp_url_project(
 170                                  $set_data->project_path,
 171                                  gp_url_join( $locale->slug, $set_data->slug ),
 172                                  array(
 173                                      'filters[status]' => 'waiting',
 174                                  )
 175                              ),
 176                              number_format_i18n( $set_data->waiting_count )
 177                          );
 178                          ?>
 179                      </td>
 180                      </tr>
 181                  <?php endforeach; // Sub project slugs. ?>
 182                  </tr>
 183              <?php endforeach;  // Sub projects. ?>
 184              </tbody>
 185          </table>
 186      </div>
 187  <?php endforeach; // Top projects. ?>
 188  
 189      <p class="actionlist">
 190          <?php gp_link( gp_url( '/projects' ), __( 'All projects', 'glotpress' ) ); ?>
 191      </p>
 192  
 193  <?php
 194  gp_tmpl_footer();


Generated: Tue Dec 3 01:01:05 2024 Cross-referenced by PHPXref 0.7.1