[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

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

   1  <?php
   2  gp_title( sprintf( __( 'Translations &lt; %s &lt; %s &lt; GlotPress' ), $translation_set->name, $project->name ) );
   3  gp_breadcrumb( array(
   4      gp_project_links_from_root( $project ),
   5      gp_link_get( $url, $locale->english_name . 'default' != $translation_set->slug? $translation_set->name : '' ),
   6  ) );
   7  wp_enqueue_script( 'editor' );
   8  wp_enqueue_script( 'translations-page' );
   9  // localizer adds var in front of the variable name, so we can't use $gp.editor.options
  10  $editor_options = compact('can_approve', 'can_write', 'url', 'discard_warning_url', 'set_priority_url', 'set_status_url');
  11  $editor_options['google_translate_language'] = $locale->google_code;
  12  wp_localize_script( 'editor', '$gp_editor_options', $editor_options );
  13  $parity = gp_parity_factory();
  14  add_action( 'gp_head', lambda( '', 'gp_preferred_sans_serif_style_tag($locale);', compact( 'locale' ) ) );
  15  
  16  gp_tmpl_header();
  17  $i = 0;
  18  ?>
  19  <h2>
  20      Translation of <?php echo esc_html( $project->name ); ?>: <?php echo esc_html( $translation_set->name ); ?>
  21      <?php gp_link_set_edit( $translation_set, $project, '(edit)' ); ?>
  22  </h2>
  23  <?php if ( $can_approve ): ?>
  24  <form id="bulk-actions-toolbar" class="filters-toolbar bulk-actions" action="<?php echo $bulk_action; ?>" method="post">
  25      <div>
  26      <select name="bulk[action]">
  27          <option value="" selected="selected">Bulk Actions</option>
  28          <option value="approve">Approve</option>
  29          <option value="reject">Reject</option>
  30          <option value="gtranslate">Translate via Google</option>
  31      </select>
  32      <input type="hidden" name="bulk[redirect_to]" value="<?php echo esc_attr(gp_url_current()); ?>" id="bulk[redirect_to]" />
  33      <input type="hidden" name="bulk[row-ids]" value="" id="bulk[row-ids]" />
  34      <input type="submit" class="button" value="<?php esc_attr_e( 'Apply' ); ?>" />
  35      </div>
  36  </form>
  37  <?php endif; ?>
  38  <?php echo gp_pagination( $page, $per_page, $total_translations_count ); ?>
  39  <form id="upper-filters-toolbar" class="filters-toolbar" action="" method="get" accept-charset="utf-8">
  40      <div>
  41      <a href="#" class="revealing filter"><?php _e('Search &darr;'); ?></a> <span class="separator">&bull;</span>
  42      <a href="#" class="revealing sort"><?php _e('Sort &darr;'); ?></a> <strong class="separator">&bull;</strong>
  43      <?php
  44      $filter_links = array();
  45      $filter_links[] = gp_link_get( $url, __('All') );
  46      $untranslated = gp_link_get( add_query_arg( array('filters[status]' => 'untranslated', 'sort[by]' => 'priority', 'sort[how]' => 'desc'), $url ), __('Untranslated') );
  47      $untranslated .= '&nbsp;('.gp_link_get( add_query_arg( array('filters[status]' => 'untranslated', 'sort[by]' => 'random'), $url ), __('random') ).')';
  48      $filter_links[] = $untranslated;
  49      if ( $can_approve ) {
  50          $filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'yes', 'filters[status]' => 'waiting'), $url ),
  51                  __('Waiting') );
  52          $filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'yes', 'filters[status]' => 'fuzzy'), $url ),
  53                  __('Fuzzy') );
  54          $filter_links[] = gp_link_get( add_query_arg( array('filters[warnings]' => 'yes', 'filters[status]' => 'current_or_waiting', 'sort[by]' => 'translation_date_added'), $url ),
  55                  __('Warnings') );
  56      
  57      }
  58      // TODO: with warnings
  59      // TODO: saved searches
  60      echo implode( '&nbsp;<span class="separator">&bull;</span>&nbsp;', $filter_links );
  61      ?>
  62      </div>
  63      <dl class="filters-expanded filters hidden clearfix">
  64           <dt>
  65              <p><label for="filters[term]"><?php _e('Term:'); ?></label></p>
  66              <p><label for="filters[user_login]"><?php _e('User:'); ?></label></p>
  67          </dt>
  68          <dd>
  69              <p><input type="text" value="<?php echo gp_esc_attr_with_entities( gp_array_get( $filters, 'term' ) ); ?>" name="filters[term]" id="filters[term]" /></p>
  70              <p><input type="text" value="<?php echo gp_esc_attr_with_entities( gp_array_get( $filters, 'user_login' ) ); ?>" name="filters[user_login]" id="filters[user_login]" /></p>
  71          </dd>
  72           <dt><label><?php _e('Status:'); ?></label></dt>
  73          <dd>
  74              <?php echo gp_radio_buttons('filters[status]', //TODO: show only these, which user is allowed to see afterwards
  75                  array(
  76                      'current_or_waiting_or_fuzzy_or_untranslated' => __('Current/waiting/fuzzy + untranslated (All)'),
  77                      'current' => __('Current only'),
  78                      'old' => __('Approved, but obsoleted by another string'),
  79                      'waiting' => __('Waiting approval'),
  80                      'rejected' => __('Rejected'),
  81                      'untranslated' => __('Without current translation'),                    
  82                      'either' => __('Any'),
  83                  ), gp_array_get( $filters, 'status', 'current_or_waiting_or_fuzzy_or_untranslated' ) );
  84              ?>
  85          </dd>
  86          <dd>
  87              <input type="checkbox" name="filters[with_comment]" value="yes" id="filters[with_comment][yes]" <?php gp_checked( 'yes' == gp_array_get( $filters, 'with_comment' ) ); ?>><label for='filters[with_comment][yes]'><?php _e( 'With comment' ); ?></label><br />
  88              <input type="checkbox" name="filters[with_context]" value="yes" id="filters[with_context][yes]" <?php gp_checked( 'yes' == gp_array_get( $filters, 'with_context' ) ); ?>><label for='filters[with_context][yes]'><?php _e( 'With context' ); ?></label>
  89          </dd>
  90          
  91          
  92          <dd><input type="submit" value="<?php echo esc_attr(__('Filter')); ?>" name="filter" /></dd>
  93      </dl>
  94      <dl class="filters-expanded sort hidden clearfix">
  95          <dt><?php _e('By:'); ?></dt>
  96          <dd>
  97          <?php echo gp_radio_buttons('sort[by]',
  98              array(
  99                  'original_date_added' => __('Date added (original)'),
 100                  'translation_date_added' => __('Date added (translation)'),
 101                  'original' => __('Original string'),
 102                  'translation' => __('Translation'),
 103                  'priority' => __('Priority'),
 104                  'references' => __('Filename in source'),
 105                  'random' => __('Random'),
 106              ), gp_array_get( $sort, 'by', 'priority' ) );
 107          ?>
 108          </dd>
 109          <dt><?php _e('How:'); ?></dt>
 110          <dd>
 111          <?php echo gp_radio_buttons('sort[how]',
 112              array(
 113                  'asc' => __('Ascending'),
 114                  'desc' => __('Descending'),
 115              ), gp_array_get( $sort, 'how', 'desc' ) );
 116          ?>
 117          </dd>
 118          <dd><input type="submit" value="<?php echo esc_attr(__('Sort')); ?>" name="sorts" /></dd>
 119      </dl>
 120  </form>
 121  <table id="translations" class="translations clear">
 122      <thead>
 123      <tr>
 124          <?php if ( $can_approve ) : ?><th class="checkbox"><input type="checkbox" /></th><?php endif; ?>
 125          <th><?php /* Translators: Priority */ _e('Prio'); ?></th>
 126          <th class="original"><?php _e('Original string'); ?></th>
 127          <th class="translation"><?php _e('Translation'); ?></th>
 128          <th>&mdash;</th>
 129      </tr>
 130      </thead>
 131  <?php foreach( $translations as $t ):
 132          gp_tmpl_load( 'translation-row', get_defined_vars() );
 133  ?>
 134  <?php endforeach; ?>
 135  <?php
 136      if ( !$translations ):
 137  ?>
 138      <tr><td colspan="<?php echo $can_approve ? 5 : 4; ?>"><?php _e('No translations were found!'); ?></td></tr>
 139  <?php
 140      endif;
 141  ?>
 142  </table>
 143  <?php echo gp_pagination( $page, $per_page, $total_translations_count ); ?>
 144  <div id="legend" class="secondary clearfix">
 145      <div><strong><?php _e('Legend:'); ?></strong></div>
 146  <?php 
 147      foreach( GP::$translation->get_static( 'statuses' ) as $status ):
 148          if ( 'rejected' == $status ) continue;
 149  ?>
 150      <div class="box status-<?php echo $status; ?>"></div>
 151      <div><?php echo $status; ?></div>
 152  <?php endforeach; ?>
 153      <div class="box has-warnings"></div>
 154      <div><?php _e('with warnings'); ?></div>
 155  
 156  </div>
 157  <p class="clear actionlist secondary">
 158      <?php
 159          $footer_links = array();
 160          if ( $can_approve ) {
 161              $footer_links[] = gp_link_get( gp_url_project( $project, array( $locale->slug, $translation_set->slug, 'import-translations' ) ), __('Import translations') );
 162          }
 163          $export_url = gp_url_project( $project, array( $locale->slug, $translation_set->slug, 'export-translations' ) );
 164          $export_link = gp_link_get( $export_url , __('Export'), array('id' => 'export', 'filters' => add_query_arg( array( 'filters' => $filters ), $export_url ) ) );
 165          $format_slugs = array_keys( GP::$formats );
 166          $what_dropdown = gp_select( 'what-to-export', array('all' => _x('all current', 'export choice'), 'filtered' => _x('only matching the filter', 'export choice')), 'all' );
 167          $format_dropdown = gp_select( 'export-format', array_combine( $format_slugs, $format_slugs ), 'po' );
 168          /* translators: 1: export 2: what to export dropdown (all/filtered) 3: export format */
 169          $footer_links[] = sprintf( __('%1$s %2$s as %3$s'), $export_link, $what_dropdown, $format_dropdown );
 170          
 171          echo implode( ' &bull; ', apply_filters( 'translations_footer_links', $footer_links, $project, $locale, $translation_set ) );
 172      ?>
 173  </p>
 174  <?php gp_tmpl_footer();


Generated: Thu May 24 03:59:35 2012 Hosted by follow the white rabbit.