Making WordPress.org


Ignore:
Timestamp:
02/20/2023 02:50:11 PM (3 years ago)
Author:
amieiro
Message:

Translate: Sync gp-translation-helpers with GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/helpers/helper-translation-discussion.php

    r12274 r12405  
    805805     * @return array
    806806     */
    807     public static function get_comment_reasons(): array {
    808         return array(
     807    public static function get_comment_reasons( $locale = null ): array {
     808        $default_reasons = array(
    809809            'style'       => array(
    810810                'name'        => __( 'Style Guide' ),
     
    825825            'punctuation' => array(
    826826                'name'        => __( 'Punctuation' ),
    827                 'explanation' =>
    828                     __( 'The translation is not using the punctuation marks correctly.' ),
     827                'explanation' => __( 'The translation is not using the punctuation marks correctly.' ),
    829828            ),
    830829            'typo'        => array(
     
    833832            ),
    834833        );
     834        $reasons         = apply_filters( 'gp_custom_reasons', $default_reasons, $locale );
     835        return $reasons;
    835836    }
    836837}
     
    898899    $is_linking_comment = preg_match( '!^' . home_url( gp_url() ) . '[a-z0-9_/#-]+$!i', $comment->comment_content );
    899900
    900     $comment_locale = get_comment_meta( $comment->comment_ID, 'locale', true );
    901     $current_locale = $args['locale_slug'];
    902 
     901    $comment_locale         = get_comment_meta( $comment->comment_ID, 'locale', true );
     902    $current_locale         = $args['locale_slug'];
    903903    $current_translation_id = $args['translation_id'];
    904904    $comment_translation_id = get_comment_meta( $comment->comment_ID, 'translation_id', true );
     
    960960            if ( $comment_reason ) :
    961961                ?>
    962                 The translation <?php gth_print_translation( $comment_translation_id, $args ); ?> <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'is being discussed here' ); ?></a>.
     962                <p>The translation <?php gth_print_translation( $comment_translation_id, $args ); ?> <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'is being discussed here' ); ?></a>.</p>
    963963            <?php else : ?>
    964964                <a href="<?php echo esc_url( $linked_comment ); ?>"><?php esc_html_e( 'Please continue the discussion here' ); ?></a>
     
    10371037            }
    10381038
     1039            if ( $comment_translation_id && $comment_translation_id !== $current_translation_id ) {
     1040                $translation_status = '';
     1041                if ( $_translation_status ) {
     1042
     1043                    $translation_status = ( is_array( $_translation_status ) && array_key_exists( $comment_translation_id, $_translation_status ) ) ? '(' . $_translation_status[ $comment_translation_id ] . ')' : ' (' . $_translation_status[0] . ')';
     1044                }
     1045                gth_print_translation( $comment_translation_id, $args, 'Translation' . $translation_status . ': ' );
     1046            }
    10391047            if ( ! $is_linking_comment ) :
    1040                 if ( $comment_translation_id && $comment_translation_id !== $current_translation_id ) {
    1041                     $translation_status = '';
    1042                     if ( $_translation_status ) {
    1043                         $translation_status = ' (' . $_translation_status . ')';
    1044                     }
    1045                     gth_print_translation( $comment_translation_id, $args, 'Translation' . $translation_status . ': ' );
    1046                 }
    10471048
    10481049                ?>
Note: See TracChangeset for help on using the changeset viewer.