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


Generated: Thu Oct 1 01:01:50 2020 Cross-referenced by PHPXref 0.7.1