[ 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 ); ?></p>
  36                  <p class="original_raw"><?php echo esc_translation( $translation->singular ); ?></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
  42                          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  43                          echo $singular;
  44                          ?>
  45                      </p>
  46                      <?php textareas( $translation, array( $can_edit, $can_approve ), 0 ); ?>
  47                      <p class="clear">
  48                          <?php
  49                          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  50                          echo $plural;
  51                          ?>
  52                      </p>
  53                      <?php textareas( $translation, array( $can_edit, $can_approve ), 1 ); ?>
  54                  <?php else : ?>
  55                      <!--
  56                      TODO: labels for each plural textarea and a sample number
  57                      -->
  58                      <p>
  59                          <?php
  60                          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  61                          echo $singular;
  62                          ?>
  63                      </p>
  64                      <p class="clear">
  65                          <?php
  66                          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  67                          echo $plural;
  68                          ?>
  69                      </p>
  70                      <?php foreach ( range( 0, $locale->nplurals - 1 ) as $plural_index ) : ?>
  71                          <?php if ( $locale->nplurals > 1 ) : ?>
  72                              <p class="plural-numbers">
  73                                  <?php
  74                                  printf(
  75                                      /* translators: %s: Numbers */
  76                                      __( 'This plural form is used for numbers like: %s', 'glotpress' ),
  77                                      // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  78                                      '<span class="numbers">' . implode( ', ', $locale->numbers_for_index( $plural_index ) ) . '</span>'
  79                                  );
  80                                  ?>
  81                              </p>
  82                          <?php endif; ?>
  83                          <?php textareas( $translation, array( $can_edit, $can_approve ), $plural_index ); ?>
  84                      <?php endforeach; ?>
  85                  <?php endif; ?>
  86              <?php endif; ?>
  87              <?php gp_tmpl_load( 'translation-row-editor-actions', get_defined_vars() ); ?>
  88          </div>
  89          <?php gp_tmpl_load( 'translation-row-editor-meta', get_defined_vars() ); ?>
  90      </td>
  91      <?php
  92      /**
  93       * Fires after editor column.
  94       *
  95       * @since 3.0.0
  96       *
  97       * @param GP_Translation     $translation The current translation.
  98       * @param GP_Translation_Set $translation_set The current translation set.
  99       */
 100      do_action( 'gp_translation_row_editor_columns', $translation, $translation_set );
 101      ?>
 102  </tr>


Generated: Sat Aug 8 01:01:51 2020 Cross-referenced by PHPXref 0.7.1