Making WordPress.org


Ignore:
Timestamp:
10/30/2025 11:04:28 AM (4 months ago)
Author:
amieiro
Message:

Translate: Skip the DeepL AJAX request if the locale is not supported

File:
1 edited

Legend:

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

    r12873 r14582  
    66use GP_Locales;
    77use WordPressdotorg\GlotPress\TranslationSuggestions\Routes\Translation_Memory;
     8use WordPressdotorg\GlotPress\Bulk_Pretranslations\Deepl;
    89
    910class Plugin {
     
    131132        $get_openai_translations = ! empty( trim( gp_array_get( $gp_default_sort, 'openai_api_key' ) ) );
    132133        $get_deepl_translations  = ! empty( trim( gp_array_get( $gp_default_sort, 'deepl_api_key' ) ) );
    133 
     134        $deepl                   = new DeepL();
     135        $deepl_locale            = $deepl->get_deepl_locale( $args['locale_slug'] );
     136       
    134137        wp_localize_script(
    135138            'gp-translation-suggestions',
     
    140143                    'get_openai_translations' => $get_openai_translations,
    141144                    'get_deepl_translations'  => $get_deepl_translations,
     145                    'get_deepl_locale'        => $deepl_locale,
    142146                ),
    143147            )
     
    145149
    146150        gp_enqueue_script( 'gp-translation-suggestions' );
    147 
    148151        wp_add_inline_script(
    149152            'gp-translation-suggestions',
Note: See TracChangeset for help on using the changeset viewer.