Changeset 9814
- Timestamp:
- 05/02/2020 10:50:07 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php
r9555 r9814 46 46 add_filter( 'gp_translation_row_template_more_links', array( $this, 'add_consistency_tool_link' ), 10, 5 ); 47 47 add_filter( 'gp_translation_prepare_for_save', array( $this, 'apply_capital_P_dangit' ), 10, 2 ); 48 add_filter( 'gp_original_extracted_comments', array( $this, 'format_translator_commments' ), 5 ); 48 49 49 50 // Cron. … … 66 67 $this->register_cli_commands(); 67 68 } 69 } 70 71 /** 72 * Splits multiple translator comments for an original into separate lines. 73 */ 74 public function format_translator_commments( $comments ) { 75 $comment_parts = preg_split( '#(^|\n)translators: #i', $comments, 0, PREG_SPLIT_NO_EMPTY ); 76 if ( ! $comment_parts ) { 77 return $comments; 78 } 79 80 return implode( '<br/>', $comment_parts ); 68 81 } 69 82 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/translation-row-editor.php
r9813 r9814 107 107 <?php endif; ?> 108 108 <?php if ( $translation->extracted_comments ) : 109 $comments = trim( preg_replace( '/^translators:/ ', '', $translation->extracted_comments ) );110 109 ?> 111 110 <details open class="source-details__comment"> 112 111 <summary><?php _e( 'Comment', 'glotpress' ); ?></summary> 113 <p><?php echo make_clickable( esc_translation( $comments ) ); ?></p> 112 <p> 113 <?php 114 /** 115 * Filters the extracted comments of an original. 116 * 117 * @param string $extracted_comments Extracted comments of an original. 118 * @param GP_Translation $translation Translation object. 119 */ 120 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 121 echo apply_filters( 'gp_original_extracted_comments', $translation->extracted_comments, $translation ); 122 ?> 123 </p> 114 124 </details> 115 125 <?php endif; ?>
Note: See TracChangeset
for help on using the changeset viewer.