Making WordPress.org


Ignore:
Timestamp:
06/07/2023 08:07:12 AM (2 years ago)
Author:
akirk
Message:

Translate: allow switching on thin ajax request via flag

File:
1 edited

Legend:

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

    r12626 r12629  
    397397        gp_enqueue_script( 'gp-comment-feedback-js' );
    398398
     399        $gp_locale = GP_Locales::by_field( 'slug', $translation_set['locale_slug'] );
    399400        wp_localize_script(
    400401            'gp-comment-feedback-js',
     
    404405                'nonce'           => wp_create_nonce( 'gp_comment_feedback' ),
    405406                'locale_slug'     => $translation_set['locale_slug'],
     407                'language'        => $gp_locale ? $gp_locale->english_name : 'Unknown',
     408                'has_openai_key'  => !! apply_filters( 'gp_get_openai_key', null ),
    406409                'comment_reasons' => Helper_Translation_Discussion::get_comment_reasons( $translation_set['locale_slug'] ),
    407410            )
     
    453456
    454457        $openai_response = GP_OpenAI_Review::get_openai_review( $original, $translation, $language, $glossary, $is_retry );
    455 
     458        if ( isset( $openai_response['error'] ) ) {
     459            wp_send_json_error( $openai_response );
     460        }
    456461        wp_send_json_success( $openai_response );
    457462    }
Note: See TracChangeset for help on using the changeset viewer.