Changeset 9813 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/translation-row-editor.php
- Timestamp:
- 05/02/2020 10:13:03 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/translation-row-editor.php
r8971 r9813 4 4 */ 5 5 6 $user = wp_get_current_user();7 $can_reject_self = ( isset( $t->user->user_login ) && $user->user_login === $t->user->user_login && 'waiting' === $t->translation_status );8 6 9 7 $more_links = array(); 10 if ( $t ->translation_status ) {11 $translation_permalink = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[status]' => 'either', 'filters[original_id]' => $t ->original_id, 'filters[translation_id]' => $t->id ) );8 if ( $translation->translation_status ) { 9 $translation_permalink = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[status]' => 'either', 'filters[original_id]' => $translation->original_id, 'filters[translation_id]' => $translation->id ) ); 12 10 $more_links['translation-permalink'] = '<a href="' . esc_url( $translation_permalink ) . '">Permalink to translation</a>'; 13 11 } else { 14 $original_permalink = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[original_id]' => $t ->original_id ) );12 $original_permalink = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[original_id]' => $translation->original_id ) ); 15 13 $more_links['original-permalink'] = '<a href="' . esc_url( $original_permalink ) . '">Permalink to original</a>'; 16 14 } 17 15 18 $original_history = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[status]' => 'either', 'filters[original_id]' => $t ->original_id, 'sort[by]' => 'translation_date_added', 'sort[how]' => 'asc' ) );16 $original_history = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[status]' => 'either', 'filters[original_id]' => $translation->original_id, 'sort[by]' => 'translation_date_added', 'sort[how]' => 'asc' ) ); 19 17 $more_links['history'] = '<a href="' . esc_url( $original_history ) . '">Translation History</a>'; 20 18 … … 24 22 * @since 2.3.0 25 23 * 26 * @param array $more_linksThe links to be output.27 * @param GP_Project $projectProject object.28 * @param GP_Locale $localeLocale object.24 * @param array $more_links The links to be output. 25 * @param GP_Project $project Project object. 26 * @param GP_Locale $locale Locale object. 29 27 * @param GP_Translation_Set $translation_set Translation Set object. 30 * @param GP_Translation $tTranslation object.28 * @param GP_Translation $translation Translation object. 31 29 */ 32 $more_links = apply_filters( 'gp_translation_row_template_more_links', $more_links, $project, $locale, $translation_set, $t ); 33 34 if ( is_object( $glossary ) ) { 35 if ( ! isset( $glossary_entries_terms ) ) { 36 $glossary_entries = $glossary->get_entries(); 37 $glossary_entries_terms = gp_sort_glossary_entries_terms( $glossary_entries ); 38 } 39 40 $t = map_glossary_entries_to_translation_originals( $t, $glossary, $glossary_entries_terms ); 41 } 42 30 $more_links = apply_filters( 'gp_translation_row_template_more_links', $more_links, $project, $locale, $translation_set, $translation ); 43 31 ?> 44 <tr class="editor <?php echo gp_translation_row_classes( $t ); ?>" id="editor-<?php echo esc_attr( $t->row_id ); ?>" row="<?php echo esc_attr( $t->row_id ); ?>">32 <tr class="editor <?php echo gp_translation_row_classes( $translation ); ?>" id="editor-<?php echo esc_attr( $translation->row_id ); ?>" row="<?php echo esc_attr( $translation->row_id ); ?>"> 45 33 <td colspan="<?php echo $can_approve ? 5 : 4 ?>"> 46 34 <div class="editor-panel"> … … 50 38 $status = sprintf( 51 39 '<span class="panel-header__bubble%s">%s</span>', 52 $t ->translation_status ? ' panel-header__bubble--' . $t->translation_status : '',53 display_status( $t ->translation_status )40 $translation->translation_status ? ' panel-header__bubble--' . $translation->translation_status : '', 41 display_status( $translation->translation_status ) 54 42 ); 55 43 56 $warnings_count = wporg_gp_count_warnings( $t );44 $warnings_count = wporg_gp_count_warnings( $translation ); 57 45 $warnings_info = ''; 58 46 if ( $warnings_count ) { … … 87 75 </div> 88 76 <div class="panel-content"> 89 <?php90 $singular = isset( $t->singular_glossary_markup ) ? $t->singular_glossary_markup : esc_translation( $t->singular );91 $plural = isset( $t->plural_glossary_markup ) ? $t->plural_glossary_markup : esc_translation( $t->plural );92 ?>93 77 <div class="source-string strings"> 94 <?php if ( ! $t->plural ) : ?> 78 <?php 79 $singular = $translation->singular_glossary_markup ?? esc_translation( $translation->singular ); 80 $plural = $translation->plural_glossary_markup ?? esc_translation( $translation->plural ); 81 82 if ( ! $translation->plural ) : ?> 95 83 <div class="source-string__singular"> 96 84 <span class="original"><?php echo prepare_original( $singular ); ?></span> 97 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $t ->singular ); ?></span>85 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $translation->singular ); ?></span> 98 86 </div> 99 87 <?php else: ?> … … 101 89 <small>Singular:</small> 102 90 <span class="original"><?php echo $singular; ?></span> 103 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $t ->singular ); ?></span>91 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $translation->singular ); ?></span> 104 92 </div> 105 93 <div class="source-string__plural"> 106 94 <small>Plural:</small> 107 95 <span class="original"><?php echo $plural; ?></span> 108 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $t ->plural ); ?></span>96 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $translation->plural ); ?></span> 109 97 </div> 110 98 <?php endif; ?> … … 112 100 113 101 <div class="source-details"> 114 <?php if ( $t ->context ): ?>102 <?php if ( $translation->context ): ?> 115 103 <details open class="source-details__context"> 116 104 <summary>Context</summary> 117 <span class="context bubble"><?php echo esc_translation( $t ->context ); ?></span>105 <span class="context bubble"><?php echo esc_translation( $translation->context ); ?></span> 118 106 </details> 119 107 <?php endif; ?> 120 <?php if ( $t ->extracted_comments ) :121 $comments = trim( preg_replace( '/^translators:/ ', '', $t ->extracted_comments ) );108 <?php if ( $translation->extracted_comments ) : 109 $comments = trim( preg_replace( '/^translators:/ ', '', $translation->extracted_comments ) ); 122 110 ?> 123 111 <details open class="source-details__comment"> … … 126 114 </details> 127 115 <?php endif; ?> 128 <?php if ( $t ->references ) : ?>116 <?php if ( $translation->references ) : ?> 129 117 <details class="source-details__references"> 130 118 <summary>References</summary> 131 <?php wporg_references( $project, $t ); ?>119 <?php wporg_references( $project, $translation ); ?> 132 120 </details> 133 121 <?php endif; ?> … … 135 123 136 124 <div class="translation-wrapper"> 137 <?php if ( $t ->plural && $locale->nplurals > 1 ) : ?>125 <?php if ( $translation->plural && $locale->nplurals > 1 ) : ?> 138 126 <div class="translation-form-wrapper"> 139 127 <span>Form:</span> … … 175 163 <?php endif; ?> 176 164 177 <?php if ( ! $t ->plural ) : ?>178 <?php wporg_gp_translate_textarea( $t , [ $can_edit, $can_approve_translation ] ); ?>165 <?php if ( ! $translation->plural ) : ?> 166 <?php wporg_gp_translate_textarea( $translation, [ $can_edit, $can_approve_translation ] ); ?> 179 167 <?php else : ?> 180 168 <?php foreach( range( 0, $locale->nplurals - 1 ) as $plural_index ): ?> 181 <?php wporg_gp_translate_textarea( $t , [ $can_edit, $can_approve ], $plural_index ); ?>169 <?php wporg_gp_translate_textarea( $translation, [ $can_edit, $can_approve ], $plural_index ); ?> 182 170 <?php endforeach; ?> 183 171 <?php endif; ?> … … 189 177 type="button" 190 178 aria-label="<?php echo $can_approve_translation ? 'Save and approve translation' : 'Suggest new translation'; ?>" 191 data-nonce="<?php echo esc_attr( wp_create_nonce( 'add-translation_' . $t ->original_id ) ); ?>">179 data-nonce="<?php echo esc_attr( wp_create_nonce( 'add-translation_' . $translation->original_id ) ); ?>"> 192 180 <?php echo $can_approve_translation ? 'Save' : 'Suggest'; ?> 193 181 </button> … … 226 214 ?> 227 215 <div class="suggestions-wrapper"> 228 <?php do_action( 'wporg_translate_suggestions', $t ); ?>216 <?php do_action( 'wporg_translate_suggestions', $translation ); ?> 229 217 </div> 230 218 <?php … … 241 229 <div class="meta"> 242 230 243 <?php if ( $t ->translation_status ): ?>231 <?php if ( $translation->translation_status ): ?> 244 232 <div class="status-actions"> 245 233 <?php if ( $can_approve_translation ) : ?> 246 <?php if ( 'current' !== $t ->translation_status ) : ?>247 <button class="approve" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-current_' . $t ->id ) ); ?>"><strong>+</strong> <?php _e( 'Approve', 'glotpress' ); ?></button>234 <?php if ( 'current' !== $translation->translation_status ) : ?> 235 <button class="approve" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-current_' . $translation->id ) ); ?>"><strong>+</strong> <?php _e( 'Approve', 'glotpress' ); ?></button> 248 236 <?php endif; ?> 249 <?php if ( 'rejected' !== $t ->translation_status ) : ?>250 <button class="reject" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-rejected_' . $t ->id ) ); ?>"><strong>−</strong> <?php _e( 'Reject', 'glotpress' ); ?></button>237 <?php if ( 'rejected' !== $translation->translation_status ) : ?> 238 <button class="reject" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-rejected_' . $translation->id ) ); ?>"><strong>−</strong> <?php _e( 'Reject', 'glotpress' ); ?></button> 251 239 <?php endif; ?> 252 <?php if ( 'fuzzy' !== $t ->translation_status ) : ?>253 <button class="fuzzy" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-fuzzy_' . $t ->id ) ); ?>"><strong>~</strong> <?php _e( 'Fuzzy', 'glotpress' ); ?></button>240 <?php if ( 'fuzzy' !== $translation->translation_status ) : ?> 241 <button class="fuzzy" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-fuzzy_' . $translation->id ) ); ?>"><strong>~</strong> <?php _e( 'Fuzzy', 'glotpress' ); ?></button> 254 242 <?php endif; ?> 255 243 <?php elseif ( $can_reject_self ): ?> 256 <button class="reject" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-rejected_' . $t ->id ) ); ?>"><strong>−</strong> <?php _e( 'Reject Suggestion', 'glotpress' ); ?></button>257 <button class="fuzzy" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-fuzzy_' . $t ->id ) ); ?>"><strong>~</strong> <?php _e( 'Fuzzy', 'glotpress' ); ?></button>244 <button class="reject" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-rejected_' . $translation->id ) ); ?>"><strong>−</strong> <?php _e( 'Reject Suggestion', 'glotpress' ); ?></button> 245 <button class="fuzzy" tabindex="-1" data-nonce="<?php echo esc_attr( wp_create_nonce( 'update-translation-status-fuzzy_' . $translation->id ) ); ?>"><strong>~</strong> <?php _e( 'Fuzzy', 'glotpress' ); ?></button> 258 246 <?php endif; ?> 259 247 </div> … … 263 251 <dt><?php _e( 'Status:', 'glotpress' ); ?></dt> 264 252 <dd> 265 <?php echo display_status( $t ->translation_status ); ?>253 <?php echo display_status( $translation->translation_status ); ?> 266 254 </dd> 267 255 </dl> 268 256 269 <?php if ( $t ->translation_added && $t->translation_added != '0000-00-00 00:00:00' ): ?>257 <?php if ( $translation->translation_added && $translation->translation_added != '0000-00-00 00:00:00' ): ?> 270 258 <dl> 271 259 <dt><?php _e( 'Date added:', 'glotpress' ); ?></dt> 272 <dd><?php echo $t ->translation_added; ?> GMT</dd>260 <dd><?php echo $translation->translation_added; ?> GMT</dd> 273 261 </dl> 274 262 <?php endif; ?> 275 <?php if ( $t ->user ) : ?>263 <?php if ( $translation->user ) : ?> 276 264 <dl> 277 265 <dt><?php _e( 'Translated by:', 'glotpress' ); ?></dt> 278 <dd><?php gp_link_user( $t ->user ); ?></dd>266 <dd><?php gp_link_user( $translation->user ); ?></dd> 279 267 </dl> 280 268 <?php endif; ?> 281 <?php if ( $t ->user_last_modified && ( ! $t->user || $t->user->ID !== $t->user_last_modified->ID ) ) : ?>269 <?php if ( $translation->user_last_modified && ( ! $translation->user || $translation->user->ID !== $translation->user_last_modified->ID ) ) : ?> 282 270 <dl> 283 271 <dt><?php 284 if ( 'current' === $t ->translation_status ) {272 if ( 'current' === $translation->translation_status ) { 285 273 _e( 'Approved by:', 'glotpress' ); 286 } elseif ( 'rejected' === $t ->translation_status ) {274 } elseif ( 'rejected' === $translation->translation_status ) { 287 275 _e( 'Rejected by:', 'glotpress' ); 288 276 } else { … … 291 279 ?> 292 280 </dt> 293 <dd><?php gp_link_user( $t ->user_last_modified ); ?></dd>281 <dd><?php gp_link_user( $translation->user_last_modified ); ?></dd> 294 282 </dl> 295 283 <?php endif; ?> … … 300 288 <dd><?php 301 289 echo gp_select( 302 'priority-' . $t ->original_id,290 'priority-' . $translation->original_id, 303 291 GP::$original->get_static( 'priorities' ), 304 $t ->priority,292 $translation->priority, 305 293 array( 306 294 'class' => 'priority', 307 295 'tabindex' => '-1', 308 'data-nonce' => wp_create_nonce( 'set-priority_' . $t ->original_id ),296 'data-nonce' => wp_create_nonce( 'set-priority_' . $translation->original_id ), 309 297 ) 310 298 ); 311 299 ?></dd> 312 300 <?php else : ?> 313 <dd><?php echo gp_array_get( GP::$original->get_static( 'priorities' ), $t ->priority, 'unknown' ); // WPCS: XSS ok.?></dd>301 <dd><?php echo gp_array_get( GP::$original->get_static( 'priorities' ), $translation->priority, 'unknown' ); ?></dd> 314 302 <?php endif; ?> 315 303 </dl> 316 304 </div> 317 305 318 <?php do_action( 'wporg_translate_meta', $t ); ?>306 <?php do_action( 'wporg_translate_meta', $translation ); ?> 319 307 </div> 320 308 </div>
Note: See TracChangeset
for help on using the changeset viewer.