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


Generated: Sat May 21 01:01:06 2022 Cross-referenced by PHPXref 0.7.1