[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Template for the editor part of a single translation row in a translation set display
   4   *
   5   * @package    GlotPress
   6   * @subpackage Templates
   7   */
   8  
   9  /**
  10   * Filter to update colspan of editor. Decrease to add an extra column
  11   * with action 'gp_translation_row_editor_columns'.
  12   *
  13   * @since 3.0.0
  14   *
  15   * @param int $colspan The colspan of editor column.
  16   */
  17  $colspan = apply_filters( 'gp_translation_row_editor_colspan', $can_approve ? 5 : 4 );
  18  
  19  $singular = sprintf(
  20      /* translators: %s: Original singular form of the text */
  21      __( 'Singular: %s', 'glotpress' ),
  22      '<span class="original">' . $translation_singular . '</span>'
  23  );
  24  $plural = sprintf(
  25      /* translators: %s: Original plural form of the text */
  26      __( 'Plural: %s', 'glotpress' ),
  27      '<span class="original">' . ( isset( $translation->plural_glossary_markup ) ? $translation->plural_glossary_markup : esc_translation( $translation->plural ) ) . '</span>'
  28  );
  29  
  30  ?>
  31  <tr class="editor <?php gp_translation_row_classes( $translation ); ?>" id="editor-<?php echo esc_attr( $translation->row_id ); ?>" row="<?php echo esc_attr( $translation->row_id ); ?>">
  32      <td colspan="<?php echo esc_attr( $colspan ); ?>">
  33          <div class="strings">
  34              <?php if ( ! $translation->plural ) : ?>
  35                  <p class="original"><?php echo prepare_original( $translation_singular );  // WPCS: XSS OK. ?></p>
  36                  <p class="original_raw"><?php echo esc_translation( $translation->singular ); // WPCS: XSS ok. ?></p>
  37                  <?php textareas( $translation, array( $can_edit, $can_approve_translation ) ); ?>
  38              <?php else : ?>
  39                  <?php if ( absint( $locale->nplurals ) === 2 && 'n != 1' === $locale->plural_expression ) : ?>
  40                      <p>
  41                          <?php echo $singular;  // WPCS: XSS OK. ?>
  42                      </p>
  43                      <?php textareas( $translation, array( $can_edit, $can_approve ), 0 ); ?>
  44                      <p class="clear">
  45                          <?php echo $plural;  // WPCS: XSS OK. ?>
  46                      </p>
  47                      <?php textareas( $translation, array( $can_edit, $can_approve ), 1 ); ?>
  48                  <?php else : ?>
  49                      <!--
  50                      TODO: labels for each plural textarea and a sample number
  51                      -->
  52                      <p>
  53                          <?php echo $singular;  // WPCS: XSS OK. ?>
  54                      </p>
  55                      <p class="clear">
  56                          <?php echo $plural;  // WPCS: XSS OK. ?>
  57                      </p>
  58                      <?php foreach ( range( 0, $locale->nplurals - 1 ) as $plural_index ) : ?>
  59                          <?php if ( $locale->nplurals > 1 ) : ?>
  60                              <p class="plural-numbers">
  61                                  <?php
  62                                  printf(
  63                                      /* translators: %s: Numbers */
  64                                      __( 'This plural form is used for numbers like: %s', 'glotpress' ),
  65                                      '<span class="numbers">' . implode( ', ', $locale->numbers_for_index( $plural_index ) ) . '</span>'
  66                                  ); // WPCS: XSS OK.
  67                                  ?>
  68                              </p>
  69                          <?php endif; ?>
  70                          <?php textareas( $translation, array( $can_edit, $can_approve ), $plural_index ); ?>
  71                      <?php endforeach; ?>
  72                  <?php endif; ?>
  73              <?php endif; ?>
  74              <?php gp_tmpl_load( 'translation-row-editor-actions', get_defined_vars() ); ?>
  75          </div>
  76          <?php gp_tmpl_load( 'translation-row-editor-meta', get_defined_vars() ); ?>
  77          <?php gp_tmpl_load( 'translation-row-editor-notes', get_defined_vars() ); ?>
  78      </td>
  79      <?php
  80      /**
  81       * Fires after editor column.
  82       *
  83       * @since 3.0.0
  84       *
  85       * @param GP_Translation     $translation The current translation.
  86       * @param GP_Translation_Set $translation_set The current translation set.
  87       */
  88      do_action( 'gp_translation_row_editor_columns', $translation, $translation_set );
  89      ?>
  90  </tr>


Generated: Sat Aug 24 01:03:14 2019 Cross-referenced by PHPXref 0.7.1