Changeset 8751 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/translation-row-editor.php
- Timestamp:
- 05/08/2019 07:33:18 PM (6 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
r8395 r8751 10 10 if ( $t->translation_status ) { 11 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 ) ); 12 $more_links['translation-permalink'] = '<a tabindex="-1" href="' . esc_url( $translation_permalink ) . '">' . __( 'Permalink to this translation', 'glotpress' ) . '</a>';12 $more_links['translation-permalink'] = '<a href="' . esc_url( $translation_permalink ) . '">Permalink to translation</a>'; 13 13 } else { 14 14 $original_permalink = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[original_id]' => $t->original_id ) ); 15 $more_links['original-permalink'] = '<a tabindex="-1" href="' . esc_url( $original_permalink ) . '">' . __( 'Permalink to this original', 'glotpress' ) . '</a>';15 $more_links['original-permalink'] = '<a href="' . esc_url( $original_permalink ) . '">Permalink to original</a>'; 16 16 } 17 17 18 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' ) ); 19 $more_links['history'] = '<a tabindex="-1" href="' . esc_url( $original_history ) . '">' . __( 'All translations of this original', 'glotpress' ) . '</a>';19 $more_links['history'] = '<a href="' . esc_url( $original_history ) . '">Translation History</a>'; 20 20 21 21 /** … … 40 40 $t = map_glossary_entries_to_translation_originals( $t, $glossary, $glossary_entries_terms ); 41 41 } 42 42 43 ?> 43 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 ); ?>"> 44 45 <td colspan="<?php echo $can_approve ? 5 : 4 ?>"> 45 <div class="strings"> 46 <?php 47 $singular = isset( $t->singular_glossary_markup ) ? $t->singular_glossary_markup : esc_translation( $t->singular ); 48 $plural = isset( $t->plural_glossary_markup ) ? $t->plural_glossary_markup : esc_translation( $t->plural ); 49 ?> 50 51 <?php if ( ! $t->plural ): ?> 52 <p class="original"><?php echo prepare_original( $singular ); ?></p> 53 <?php textareas( $t, array( $can_edit, $can_approve_translation ) ); ?> 54 <?php else: ?> 55 <?php if ( $locale->nplurals == 2 && $locale->plural_expression == 'n != 1'): ?> 56 <p><?php printf(__( 'Singular: %s', 'glotpress' ), '<span class="original">'. $singular .'</span>'); ?></p> 57 <?php textareas( $t, array( $can_edit, $can_approve ), 0 ); ?> 58 <p class="clear"> 59 <?php printf(__( 'Plural: %s', 'glotpress' ), '<span class="original">'. $plural .'</span>'); ?> 60 </p> 61 <?php textareas( $t, array( $can_edit, $can_approve ), 1 ); ?> 62 <?php else: ?> 63 <!-- 64 TODO: labels for each plural textarea and a sample number 65 --> 66 <p><?php printf(__( 'Singular: %s', 'glotpress' ), '<span class="original">'. $singular .'</span>'); ?></p> 67 <p class="clear"> 68 <?php printf(__( 'Plural: %s', 'glotpress' ), '<span class="original">'. $plural .'</span>'); ?> 69 </p> 70 <?php foreach( range( 0, $locale->nplurals - 1 ) as $plural_index ): ?> 71 <?php if ( $locale->nplurals > 1 ): ?> 72 <p class="plural-numbers"><?php printf(__( 'This plural form is used for numbers like: %s', 'glotpress' ), 73 '<span class="numbers">'.implode(', ', $locale->numbers_for_index( $plural_index ) ).'</span>' ); ?></p> 74 <?php endif; ?> 75 <?php textareas( $t, array( $can_edit, $can_approve ), $plural_index ); ?> 76 <?php endforeach; ?> 77 <?php endif; ?> 78 <?php endif; ?> 79 </div> 80 81 <div class="meta"> 82 <h3><?php _e( 'Meta', 'glotpress' ); ?></h3> 83 <dl> 84 <dt><?php _e( 'Status:', 'glotpress' ); ?></dt> 85 <dd> 86 <?php echo display_status( $t->translation_status ); ?> 87 <?php if ( $t->translation_status ): ?> 88 <?php if ( $can_approve_translation ) : ?> 89 <?php if ( 'current' !== $t->translation_status ) : ?> 90 <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> 46 <div class="editor-panel"> 47 <div class="editor-panel__left"> 48 <div class="panel-header"> 49 <?php 50 $status = sprintf( 51 '<span class="panel-header__bubble%s">%s</span>', 52 $t->translation_status ? ' panel-header__bubble--' . $t->translation_status : '', 53 display_status( $t->translation_status ) 54 ); 55 56 $warnings_count = wporg_gp_count_warnings( $t ); 57 $warnings_info = ''; 58 if ( $warnings_count ) { 59 $warnings_info = ' <span class="panel-header__bubble panel-header__bubble--warning">' . sprintf( 60 _n( '%s warning', '%s warnings', $warnings_count ), 61 number_format_i18n( $warnings_count ) 62 ) . '</span>'; 63 } 64 ?> 65 <h3>Original <?php echo $status . $warnings_info; ?></h3> 66 <div class="panel-header-actions"> 67 <button type="button" class="panel-header-actions__cancel with-tooltip" aria-label="Close current editor"> 68 <span class="screen-reader-text">Close</span><span aria-hidden="true" class="dashicons dashicons-no-alt"></span> 69 </button> 70 <button type="button" class="panel-header-actions__previous with-tooltip" aria-label="Open previous editor"> 71 <span class="screen-reader-text">Previous</span><span aria-hidden="true" class="dashicons dashicons-arrow-up-alt2"></span> 72 </button> 73 <button type="button" class="panel-header-actions__next with-tooltip" aria-label="Open next editor"> 74 <span class="screen-reader-text">Next</span><span aria-hidden="true" class="dashicons dashicons-arrow-down-alt2"></span> 75 </button> 76 <div class="button-menu"> 77 <button type="button" class="button-menu__toggle with-tooltip" aria-label="Show contextual links"> 78 <span class="screen-reader-text">Links</span><span aria-hidden="true" class="dashicons dashicons-paperclip"></span> 79 </button> 80 <ul class="button-menu__dropdown"> 81 <?php foreach ( $more_links as $link ) : ?> 82 <li><?php echo $link; ?></li> 83 <?php endforeach; ?> 84 </ul> 85 </div> 86 </div> 87 </div> 88 <div class="panel-content"> 89 <?php 90 $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 <div class="source-string strings"> 94 <?php if ( ! $t->plural ) : ?> 95 <div class="source-string__singular"> 96 <span class="original"><?php echo prepare_original( $singular ); ?></span> 97 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $t->singular ); ?></span> 98 </div> 99 <?php else: ?> 100 <div class="source-string__singular"> 101 <small>Singular:</small> 102 <span class="original"><?php echo $singular; ?></span> 103 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $t->singular ); ?></span> 104 </div> 105 <div class="source-string__plural"> 106 <small>Plural:</small> 107 <span class="original"><?php echo $plural; ?></span> 108 <span aria-hidden="true" class="original-raw"><?php echo esc_translation( $t->plural ); ?></span> 109 </div> 110 <?php endif; ?> 111 </div> 112 113 <details class="source-details"> 114 <summary>Context</summary> 115 116 <?php if ( $t->context ): ?> 117 <dl class="source-details__context"> 118 <dt><?php _e( 'Context:', 'glotpress' ); ?></dt> 119 <dd><span class="context bubble"><?php echo esc_translation( $t->context ); ?></span></dd> 120 </dl> 121 <?php endif; ?> 122 <?php if ( $t->extracted_comments ) : 123 $comments = trim( preg_replace( '/^translators:/ ', '', $t->extracted_comments ) ); 124 ?> 125 <dl class="source-details__comments"> 126 <dt><?php _e( 'Comment:', 'glotpress' ); ?></dt> 127 <dd><?php echo make_clickable( esc_translation( $comments ) ); ?></dd> 128 </dl> 129 <?php endif; ?> 130 <?php references( $project, $t ); ?> 131 </details> 132 133 <div class="translation-wrapper"> 134 <?php if ( $t->plural && $locale->nplurals > 1 ) : ?> 135 <div class="translation-form-wrapper"> 136 <span>Form:</span> 137 <ul class="translation-form-list"> 138 <?php if ( 2 === (int) $locale->nplurals && 'n != 1' === $locale->plural_expression ) : ?> 139 <li> 140 <button class="translation-form-list__tab translation-form-list__tab--active with-tooltip" 141 type="button" 142 aria-label="Translation for singular form" 143 data-plural-index="0"> 144 Singular 145 </button> 146 </li> 147 <li> 148 <button class="translation-form-list__tab with-tooltip" 149 type="button" 150 aria-label="Translation for plural form" 151 data-plural-index="1"> 152 Plural 153 </button> 154 </li> 155 <?php else : ?> 156 <?php foreach( range( 0, $locale->nplurals - 1 ) as $plural_index ): 157 $plural_string = implode(', ', $locale->numbers_for_index( $plural_index ) ); 158 ?> 159 <li> 160 <button 161 class="translation-form-list__tab with-tooltip<?php echo ( 0 === $plural_index ) ? ' translation-form-list__tab--active' : ''; ?>" 162 data-plural-index="<?php echo $plural_index; ?>" 163 aria-label="<?php printf('This plural form is used for numbers like: %s', $plural_string ); ?>" 164 type="button"> 165 <?php echo $plural_string; ?> 166 </button> 167 </li> 168 <?php endforeach; ?> 169 <?php endif; ?> 170 </ul> 171 </div> 172 <?php endif; ?> 173 174 <?php if ( ! $t->plural ) : ?> 175 <?php wporg_gp_translate_textarea( $t, [ $can_edit, $can_approve_translation ] ); ?> 176 <?php else : ?> 177 <?php foreach( range( 0, $locale->nplurals - 1 ) as $plural_index ): ?> 178 <?php wporg_gp_translate_textarea( $t, [ $can_edit, $can_approve ], $plural_index ); ?> 179 <?php endforeach; ?> 180 <?php endif; ?> 181 182 <div class="translation-actions"> 183 <?php if ( $can_edit ) : ?> 184 <div class="translation-actions__primary"> 185 <button class="translation-actions__save with-tooltip" 186 type="button" 187 aria-label="<?php echo $can_approve_translation ? 'Save and approve translation' : 'Suggest new translation'; ?>" 188 data-nonce="<?php echo esc_attr( wp_create_nonce( 'add-translation_' . $t->original_id ) ); ?>"> 189 <?php echo $can_approve_translation ? 'Save' : 'Suggest'; ?> 190 </button> 191 </div> 192 <div class="translation-actions__secondary"> 193 <button type="button" class="translation-actions__copy with-tooltip" aria-label="Copy original"> 194 <span class="screen-reader-text">Copy</span><span aria-hidden="true" class="dashicons dashicons-admin-page"></span> 195 </button> 196 <button type="button" class="translation-actions__ltr with-tooltip" aria-label="Switch to LTR"> 197 <span class="screen-reader-text">LTR</span><span aria-hidden="true" class="dashicons dashicons-editor-ltr"></span> 198 </button> 199 <button type="button" class="translation-actions__rtl with-tooltip" aria-label="Switch to RTL"> 200 <span class="screen-reader-text">RTL</span><span aria-hidden="true" class="dashicons dashicons-editor-rtl"></span> 201 </button> 202 <button type="button" class="translation-actions__help with-tooltip" aria-label="Show help"> 203 <span class="screen-reader-text">Help</span><span aria-hidden="true" class="dashicons dashicons-editor-help"></span> 204 </button> 205 </div> 206 <?php elseif ( is_user_logged_in() ) : ?> 207 You are not allowed to edit this translation. 208 <?php else : ?> 209 <p class="info"> 210 <?php 211 printf( 212 'You <a href="%s">have to log in</a> to edit this translation.', 213 esc_url( wp_login_url( gp_url_current() ) ) 214 ); 215 ?> 216 </p> 91 217 <?php endif; ?> 92 <?php if ( 'rejected' !== $t->translation_status ) : ?> 93 <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> 218 </div> 219 </div> 220 221 <?php 222 if ( has_action( 'wporg_translate_suggestions' ) ) { 223 ?> 224 <div class="suggestions-wrapper"> 225 <?php do_action( 'wporg_translate_suggestions', $t ); ?> 226 </div> 227 <?php 228 } 229 ?> 230 </div> 231 </div> 232 233 <div class="editor-panel__right"> 234 <div class="panel-header"> 235 <h3><?php _e( 'Meta', 'glotpress' ); ?></h3> 236 </div> 237 <div class="panel-content"> 238 <div class="meta"> 239 240 <?php if ( $t->translation_status ): ?> 241 <div class="status-actions"> 242 <?php if ( $can_approve_translation ) : ?> 243 <?php if ( 'current' !== $t->translation_status ) : ?> 244 <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> 245 <?php endif; ?> 246 <?php if ( 'rejected' !== $t->translation_status ) : ?> 247 <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> 248 <?php endif; ?> 249 <?php if ( 'fuzzy' !== $t->translation_status ) : ?> 250 <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> 251 <?php endif; ?> 252 <?php elseif ( $can_reject_self ): ?> 253 <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> 254 <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> 94 255 <?php endif; ?> 95 <?php if ( 'fuzzy' !== $t->translation_status ) : ?> 96 <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> 256 </div> 257 <?php endif; ?> 258 259 <dl> 260 <dt><?php _e( 'Status:', 'glotpress' ); ?></dt> 261 <dd> 262 <?php echo display_status( $t->translation_status ); ?> 263 </dd> 264 </dl> 265 266 <?php if ( $t->translation_added && $t->translation_added != '0000-00-00 00:00:00' ): ?> 267 <dl> 268 <dt><?php _e( 'Date added:', 'glotpress' ); ?></dt> 269 <dd><?php echo $t->translation_added; ?> GMT</dd> 270 </dl> 271 <?php endif; ?> 272 <?php if ( $t->user ) : ?> 273 <dl> 274 <dt><?php _e( 'Translated by:', 'glotpress' ); ?></dt> 275 <dd><?php gp_link_user( $t->user ); ?></dd> 276 </dl> 277 <?php endif; ?> 278 <?php if ( $t->user_last_modified && ( ! $t->user || $t->user->ID !== $t->user_last_modified->ID ) ) : ?> 279 <dl> 280 <dt><?php 281 if ( 'current' === $t->translation_status ) { 282 _e( 'Approved by:', 'glotpress' ); 283 } elseif ( 'rejected' === $t->translation_status ) { 284 _e( 'Rejected by:', 'glotpress' ); 285 } else { 286 _e( 'Last updated by:', 'glotpress' ); 287 } 288 ?> 289 </dt> 290 <dd><?php gp_link_user( $t->user_last_modified ); ?></dd> 291 </dl> 292 <?php endif; ?> 293 294 <dl> 295 <dt><?php _e( 'Priority of the original:', 'glotpress' ); ?></dt> 296 <?php if ( $can_write ): ?> 297 <dd><?php 298 echo gp_select( 299 'priority-' . $t->original_id, 300 GP::$original->get_static( 'priorities' ), 301 $t->priority, 302 array( 303 'class' => 'priority', 304 'tabindex' => '-1', 305 'data-nonce' => wp_create_nonce( 'set-priority_' . $t->original_id ), 306 ) 307 ); 308 ?></dd> 309 <?php else : ?> 310 <dd><?php echo gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority, 'unknown' ); // WPCS: XSS ok. ?></dd> 97 311 <?php endif; ?> 98 <?php elseif ( $can_reject_self ): ?> 99 <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> 100 <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> 101 <?php endif; ?> 102 <?php endif; ?> 103 </dd> 104 </dl> 105 <!-- 106 <dl> 107 <dt><?php _e( 'Priority:', 'glotpress' ); ?></dt> 108 <dd><?php echo esc_html($t->priority); ?></dd> 109 </dl> 110 --> 111 112 <?php if ( $t->context ): ?> 113 <dl> 114 <dt><?php _e( 'Context:', 'glotpress' ); ?></dt> 115 <dd><span class="context bubble"><?php echo esc_translation($t->context); ?></span></dd> 116 </dl> 117 <?php endif; ?> 118 <?php if ( $t->extracted_comments ): ?> 119 <dl> 120 <dt><?php _e( 'Comment:', 'glotpress' ); ?></dt> 121 <dd><?php echo make_clickable( esc_translation($t->extracted_comments) ); ?></dd> 122 </dl> 123 <?php endif; ?> 124 <?php if ( $t->translation_added && $t->translation_added != '0000-00-00 00:00:00' ): ?> 125 <dl> 126 <dt><?php _e( 'Date added:', 'glotpress' ); ?></dt> 127 <dd><?php echo $t->translation_added; ?> GMT</dd> 128 </dl> 129 <?php endif; ?> 130 <?php if ( $t->user ) : ?> 131 <dl> 132 <dt><?php _e( 'Translated by:', 'glotpress' ); ?></dt> 133 <dd><?php gp_link_user( $t->user ); ?></dd> 134 </dl> 135 <?php endif; ?> 136 <?php if ( $t->user_last_modified && ( ! $t->user || $t->user->ID !== $t->user_last_modified->ID ) ) : ?> 137 <dl> 138 <dt><?php 139 if ( 'current' === $t->translation_status ) { 140 _e( 'Approved by:', 'glotpress' ); 141 } elseif ( 'rejected' === $t->translation_status ) { 142 _e( 'Rejected by:', 'glotpress' ); 143 } else { 144 _e( 'Last updated by:', 'glotpress' ); 145 } 146 ?> 147 </dt> 148 <dd><?php gp_link_user( $t->user_last_modified ); ?></dd> 149 </dl> 150 <?php endif; ?> 151 <?php references( $project, $t ); ?> 152 153 <dl> 154 <dt><?php _e( 'Priority of the original:', 'glotpress' ); ?></dt> 155 <?php if ( $can_write ): ?> 156 <dd><?php 157 echo gp_select( 158 'priority-' . $t->original_id, 159 GP::$original->get_static( 'priorities' ), 160 $t->priority, 161 array( 162 'class' => 'priority', 163 'tabindex' => '-1', 164 'data-nonce' => wp_create_nonce( 'set-priority_' . $t->original_id ), 165 ) 166 ); 167 ?></dd> 168 <?php else : ?> 169 <dd><?php echo gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority, 'unknown' ); // WPCS: XSS ok. ?></dd> 170 <?php endif; ?> 171 </dl> 172 173 <dl> 174 <dt><?php _e( 'More links:', 'glotpress' ); ?> 175 <ul> 176 <?php foreach ( $more_links as $link ) : ?> 177 <li><?php echo $link; // WPCS: XSS ok. ?></li> 178 <?php endforeach; ?> 179 </ul> 180 </dt> 181 </dl> 182 </div> 183 <div class="actions"> 184 <?php if ( $can_edit ): ?> 185 <button class="ok" data-nonce="<?php echo esc_attr( wp_create_nonce( 'add-translation_' . $t->original_id ) ); ?>"> 186 <?php echo $can_approve_translation ? __( 'Add translation →', 'glotpress' ) : __( 'Suggest new translation →', 'glotpress' ); ?> 187 </button> 188 <?php endif; ?> 189 <?php _e( 'or', 'glotpress' ); ?> <a href="#" class="close"><?php _e( 'Cancel', 'glotpress' ); ?></a> 312 </dl> 313 </div> 314 </div> 315 </div> 190 316 </div> 191 317 </td>
Note: See TracChangeset
for help on using the changeset viewer.