Making WordPress.org


Ignore:
Timestamp:
03/29/2023 02:12:17 PM (23 months ago)
Author:
amieiro
Message:

Translate: Add suggestions from OpenAI and DeepL

File:
1 edited

Legend:

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

    r11732 r12510  
    11<?php
    2 
    3 if ( empty( $suggestions ) ) {
     2if ( empty( $suggestions ) && empty( $openai_suggestions ) && empty( $deepl_suggestions ) ) {
    43    echo '<p class="no-suggestions">No suggestions.</p>';
    54} else {
     
    2423        echo '</li>';
    2524    }
     25    foreach ( $openai_suggestions as $suggestion ) {
     26        echo '<li>';
     27        echo '<div class="translation-suggestion with-tooltip openai" tabindex="0" role="button" aria-pressed="false" aria-label="Copy translation">';
     28            echo '<span class="openai-suggestion__score">OpenAI</span>';
     29
     30            echo '<span class="translation-suggestion__translation">';
     31                echo esc_translation( $suggestion['translation'] );
     32
     33                if ( $suggestion['diff'] ) {
     34                    echo '<span class="translation-suggestion__original-diff">' . wp_kses_post( $suggestion['diff'] ) . '</span>';
     35                }
     36            echo '</span>';
     37
     38            echo '<span aria-hidden="true" class="translation-suggestion__translation-raw">' . esc_translation( $suggestion['translation'] ) . '</span>';
     39
     40            echo '<button type="button" class="button is-small copy-suggestion">Copy</button>';
     41        echo '</div>';
     42        echo '</li>';
     43    }
     44    foreach ( $deepl_suggestions as $suggestion ) {
     45        echo '<li>';
     46        echo '<div class="translation-suggestion with-tooltip deepl" tabindex="0" role="button" aria-pressed="false" aria-label="Copy translation">';
     47            echo '<span class="deepl-suggestion__score">DeepL</span>';
     48
     49            echo '<span class="translation-suggestion__translation">';
     50                echo esc_translation( $suggestion['translation'] );
     51
     52                if ( $suggestion['diff'] ) {
     53                    echo '<span class="translation-suggestion__original-diff">' . wp_kses_post( $suggestion['diff'] ) . '</span>';
     54                }
     55            echo '</span>';
     56
     57            echo '<span aria-hidden="true" class="translation-suggestion__translation-raw">' . esc_translation( $suggestion['translation'] ) . '</span>';
     58
     59            echo '<button type="button" class="button is-small copy-suggestion">Copy</button>';
     60        echo '</div>';
     61        echo '</li>';
     62    }
    2663    echo '</ul>';
    2764}
Note: See TracChangeset for help on using the changeset viewer.