Making WordPress.org


Ignore:
Timestamp:
08/31/2023 10:50:11 AM (3 years ago)
Author:
amieiro
Message:

Translate: Add a link to the OpenAI and DeepL configuration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-suggestions/inc/class-plugin.php

    r12751 r12873  
    173173        $query_tm = mb_strlen( $entry->singular ) <= 420;
    174174
     175        // Used to add a link to add the OpenAI and the DeepL keys.
     176        // We only show this link if the user has not added any of these keys yet.
     177        $gp_default_sort = get_user_option( 'gp_default_sort' );
     178        $openai_key      = trim( gp_array_get( $gp_default_sort, 'openai_api_key' ) );
     179        $deepl_key       = trim( gp_array_get( $gp_default_sort, 'deepl_api_key' ) );
    175180        ?>
    176181        <details open class="suggestions__translation-memory<?php echo $query_tm ? '' : ' initialized'; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'translation-memory-suggestions-' . $entry->original_id ) ); ?>">
     
    181186                <p class="no-suggestions">No suggestions.</p>
    182187            <?php endif; ?>
     188
     189            <?php if ( empty( $openai_key ) && empty( $deepl_key ) ) : ?>
     190                <p class="translation-suggestion__footer_message__for_suggestions">Get translation suggestions from <a href="https://translate.wordpress.org/settings/" target="_blank">OpenAI</a>  and from <a href="https://translate.wordpress.org/settings/" target="_blank">DeepL</a>. <a href="https://make.wordpress.org/polyglots/2023/03/29/adding-chatgpt-and-deepl-in-the-translation-memory/" target="_blank">More info</a>.</p>
     191            <?php endif; ?>
    183192        </details>
    184193
Note: See TracChangeset for help on using the changeset viewer.