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


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