[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> translation-row.php (source)

   1  <?php
   2  $status_class = $t->translation_status? 'status-'.$t->translation_status : 'untranslated';
   3  $warning_class = $t->warnings? 'has-warnings' : 'no-warnings';
   4  $priority_class = 'priority-'.gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority );
   5  $priority_char = array(
   6      '-2' => array('&times;', 'transparent', '#ccc'),
   7      '-1' => array('&darr;', 'transparent', 'blue'),
   8      '0' => array('', 'transparent', 'white'),
   9      '1' => array('&uarr;', 'transparent', 'green'),
  10  );
  11  $can_reject_self = (GP::$user->current()->user_login == $t->user_login && $t->translation_status == "waiting");
  12  ?>
  13  
  14  <tr class="preview <?php echo $parity().' '.$status_class.' '.$warning_class.' '.$priority_class ?>" id="preview-<?php echo $t->row_id ?>" row="<?php echo $t->row_id; ?>">
  15      <?php if ( $can_approve ) : ?><th scope="row" class="checkbox"><input type="checkbox" name="selected-row[]" /></th><?php endif; ?>
  16      <?php /*
  17      <td class="priority" style="background-color: <?php echo $priority_char[$t->priority][1] ?>; color: <?php echo $priority_char[$t->priority][2] ?>; text-align: center; font-size: 1.2em;" title="<?php echo esc_attr('Priority: '.gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority )); ?>">
  18      */ ?>
  19      <td class="priority" title="<?php echo esc_attr('Priority: '.gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority )); ?>">
  20         <?php echo $priority_char[$t->priority][0] ?>
  21      </td>
  22      <td class="original">
  23          <?php echo prepare_original( esc_translation( $t->singular ) ); ?>
  24          <?php if ( $t->context ): ?>
  25          <span class="context bubble" title="<?php printf( __('Context: %s'), esc_html($t->context) ); ?>"><?php echo esc_html($t->context); ?></span>
  26          <?php endif; ?>
  27  
  28      </td>
  29      <td class="translation foreign-text">
  30      <?php
  31          $edit_text = $can_edit? __('Double-click to add') : sprintf(__('You <a href="%s">have to login</a> to add a translation.'), gp_url_login());
  32          $missing_text = "<span class='missing'>$edit_text</span>";
  33          if ( !count( array_filter( $t->translations ) ) ):
  34              echo $missing_text;
  35          elseif ( !$t->plural ):
  36              echo esc_translation( $t->translations[0] );
  37          else: ?>
  38          <ul>
  39              <?php
  40                  foreach( $t->translations as $translation ):
  41              ?>
  42                  <li><?php echo $translation? esc_translation( $translation ) : $missing_text; ?></li>
  43              <?php
  44                  endforeach;
  45              ?>
  46          </ul>
  47      <?php
  48          endif;
  49      ?>
  50      </td>
  51      <td class="actions">
  52          <a href="#" row="<?php echo $t->row_id; ?>" class="action edit"><?php _e('Details'); ?></a>
  53      </td>
  54  </tr>
  55  <tr class="editor <?php echo $warning_class; ?>" id="editor-<?php echo $t->row_id; ?>" row="<?php echo $t->row_id; ?>">
  56      <td colspan="<?php echo $can_approve ? 5 : 4 ?>">
  57          <div class="strings">
  58          <?php if ( !$t->plural ): ?>
  59          <p class="original"><?php echo prepare_original( esc_translation($t->singular) ); ?></p>
  60          <?php textareas( $t, array( $can_edit, $can_approve ) ); ?>
  61          <?php else: ?>
  62              <?php if ( $locale->nplurals == 2 && $locale->plural_expression == 'n != 1'): ?>
  63                  <p><?php printf(__('Singular: %s'), '<span class="original">'.esc_translation($t->singular).'</span>'); ?></p>
  64                  <?php textareas( $t, array( $can_edit, $can_approve ), 0 ); ?>
  65                  <p class="clear">
  66                      <?php printf(__('Plural: %s'), '<span class="original">'.esc_translation($t->plural).'</span>'); ?>
  67                  </p>
  68                  <?php textareas( $t, array( $can_edit, $can_approve ), 1 ); ?>
  69              <?php else: ?>
  70                  <!--
  71                  TODO: labels for each plural textarea and a sample number
  72                  -->
  73                  <p><?php printf(__('Singular: %s'), '<span class="original">'.esc_translation($t->singular).'</span>'); ?></p>
  74                  <p class="clear">
  75                      <?php printf(__('Plural: %s'), '<span class="original">'.esc_translation($t->plural).'</span>'); ?>
  76                  </p>
  77                  <?php foreach( range( 0, $locale->nplurals - 1 ) as $plural_index ): ?>
  78                      <?php if ( $locale->nplurals > 1 ): ?>
  79                      <p class="plural-numbers"><?php printf(__('This plural form is used for numbers like: %s'),
  80                              '<span class="numbers">'.implode(', ', $locale->numbers_for_index( $plural_index ) ).'</span>' ); ?></p>
  81                      <?php endif; ?>
  82                      <?php textareas( $t, array( $can_edit, $can_approve ), $plural_index ); ?>
  83                  <?php endforeach; ?>
  84              <?php endif; ?>
  85          <?php endif; ?>
  86          </div>
  87  
  88          <div class="meta">
  89              <h3><?php _e('Meta'); ?></h3>
  90              <dl>
  91                  <dt><?php _e('Status:'); ?></dt>
  92                  <dd>
  93                      <?php echo display_status( $t->translation_status ); ?>
  94                      <?php if ( $t->translation_status ): ?>
  95                          <?php if ( $can_approve ): ?>
  96                              <?php if ( $t->translation_status != 'current' ): ?>
  97                              <button class="approve" tabindex="-1"><strong>+</strong> <?php _e('Approve'); ?></button>
  98                              <?php endif; ?>
  99                              <?php if ( $t->translation_status != 'rejected' ): ?>
 100                              <button class="reject" tabindex="-1"><strong>&minus;</strong> <?php _e('Reject'); ?></button>
 101                              <?php endif; ?>
 102                          <?php elseif ( $can_reject_self ): ?>
 103                              <button class="reject" tabindex="-1"><strong>&minus;</strong> <?php _e('Reject Suggestion'); ?></button>
 104                          <?php endif; ?>
 105                      <?php endif; ?>
 106                  </dd>
 107              </dl>
 108              <!--
 109              <dl>
 110                  <dt><?php _e('Priority:'); ?></dt>
 111                  <dd><?php echo esc_html($t->priority); ?></dd>
 112              </dl>
 113              -->
 114  
 115              <?php if ( $t->context ): ?>
 116              <dl>
 117                  <dt><?php _e('Context:'); ?></dt>
 118                  <dd><span class="context bubble"><?php echo esc_translation($t->context); ?></span></dd>
 119              </dl>
 120              <?php endif; ?>
 121              <?php if ( $t->extracted_comment ): ?>
 122              <dl>
 123                  <dt><?php _e('Comment:'); ?></dt>
 124                  <dd><?php echo make_clickable( esc_translation($t->extracted_comment) ); ?></dd>
 125              </dl>
 126              <?php endif; ?>
 127              <?php if ( $t->translation_added && $t->translation_added != '0000-00-00 00:00:00' ): ?>
 128              <dl>
 129                  <dt><?php _e('Date added:'); ?></dt>
 130                  <dd><?php echo $t->translation_added; ?> GMT</dd>
 131              </dl>
 132              <?php endif; ?>
 133              <?php if ( $t->user_login ): ?>
 134              <dl>
 135                  <dt><?php _e('Translated by:'); ?></dt>
 136                  <dd><?php
 137                  if ( $t->user_display_name && $t->user_display_name != $t->user_login ) {
 138                      printf( '%s (%s)', $t->user_display_name, $t->user_login );
 139                  } else {
 140                      echo $t->user_login;
 141                  }
 142                  ?></dd>
 143              </dl>
 144              <?php endif; ?>
 145  
 146              <?php references( $project, $t ); ?>
 147  
 148              <dl>
 149                  <dt><?php _e('Priority of the original:'); ?></dt>
 150              <?php if ( $can_write ): ?>
 151                  <dd><?php echo gp_select( 'priority-'.$t->original_id, GP::$original->get_static( 'priorities' ), $t->priority, array('class' => 'priority', 'tabindex' => '-1') ); ?></dd>
 152              <?php else: ?>
 153                  <dd><?php echo gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority, 'unknown' ); ?></dd>
 154              <?php endif; ?>
 155              </dl>
 156  
 157              <?php $extra_args = $t->translation_status? array( 'filters[translation_id]' => $t->id ) : array(); ?>
 158              <dl>
 159  <?php
 160          $permalink = gp_url_project_locale( $project, $locale->slug, $translation_set->slug,
 161              array_merge( array('filters[status]' => 'either', 'filters[original_id]' => $t->original_id ), $extra_args ) );
 162          $original_history = gp_url_project_locale( $project, $locale->slug, $translation_set->slug,
 163              array_merge( array('filters[status]' => 'either', 'filters[original_id]' => $t->original_id, 'sort[by]' => 'translation_date_added', 'sort[how]' => 'asc' ) ) );
 164  
 165  ?>
 166                  <dt><?php _e('More links:'); ?>
 167                  <ul>
 168                      <li><a tabindex="-1" href="<?php echo $permalink; ?>" title="<?php _e('Permanent link to this translation'); ?>"><?php _e('Permalink to this translation'); ?></a></li>
 169                      <li><a tabindex="-1" href="<?php echo $original_history; ?>" title="<?php _e('Link to the history of translations of this original'); ?>"><?php _e('All translations of this original'); ?></a></li>
 170                  </ul>
 171                  </dt>
 172              </dl>
 173          </div>
 174          <div class="actions">
 175          <?php if ( $can_edit ): ?>
 176              <button class="ok">
 177                  <?php echo $can_approve? __('Add translation &rarr;') : __('Suggest new translation &rarr;'); ?>
 178              </button>
 179          <?php endif; ?>
 180              or <a href="#" class="close"><?php _e('Cancel'); ?></a>
 181          </div>
 182      </td>
 183  </tr>


Generated: Sat May 25 03:59:55 2013 Hosted by follow the white rabbit.