Translation
TranslationDeepSeek Translation

DeepSeek Translation

Use DeepSeek as a translation provider into directive @strTranslate, to translate a field value to your desired language.

Description

Make DeepSeek's API available as a translation provider in directive @strTranslate.

Add directive @strTranslate to any field of type String, to translate it to the desired language.

For instance, this query translates the post's title and content fields from English to French using the DeepSeek API:

{
  posts {
    title @strTranslate(
      from: "en",
      to: "fr",
      provider: deepseek
    )
    
    content @strTranslate(
      from: "en",
      to: "fr",
      provider: deepseek
    )
  }
}

DeepSeek Authorization

In order to use DeepSeek, it is mandatory to provide your DeepSeek API key, via tab "Plugin Management => DeepSeek Translation" on the Settings page.

Create the API key in your DeepSeek's account.

Then follow one of the methods below to input the value.

By Settings

Input the API key in the corresponding inputs in the Settings page, and click on "Save Changes (All)":

Setting DeepSeek's API key
Setting DeepSeek's API key

In wp-config.php

Add constant GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_DEEPSEEK_API_KEY in wp-config.php:

define( 'GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_DEEPSEEK_API_KEY', '{your API key}' );

By environment variable

Define environment variable DEEPSEEK_TRANSLATION_SERVICES_DEEPSEEK_API_KEY.

DeepSeek model

You can customize which DeepSeek model to use to execute the translation.

The following models are supported:

  • DeepSeek-V3 (deepseek-chat)

Follow one of the methods below to input the value.

By Settings

Input the model in the corresponding input in the Settings page, and click on "Save Changes (All)":

Setting the DeepSeek model
Setting the DeepSeek model

In wp-config.php

Add constant GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_MODEL in wp-config.php:

define( 'GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_MODEL', '{model}' );

By environment variable

Define environment variable DEEPSEEK_TRANSLATION_SERVICES_MODEL.

Translation prompt

You can customize the prompt to pass DeepSeek to execute the translation.

Follow one of the methods below to input the value.

By Settings

Input the "System message" and "Prompt template" in the corresponding inputs in the Settings page, and click on "Save Changes (All)":

Setting the prompt for DeepSeek
Setting the prompt for DeepSeek

In wp-config.php

Add constants GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_SYSTEM_MESSAGE and GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_PROMPT_TEMPLATE in wp-config.php:

define( 'GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_SYSTEM_MESSAGE', 'You are a helpful translator' );
define( 'GATOGRAPHQL_DEEPSEEK_TRANSLATION_SERVICES_PROMPT_TEMPLATE', 'Please translate strings from {$sourceLang} to {$targetLang}' );

By environment variable

Define environment variables DEEPSEEK_TRANSLATION_SERVICES_SYSTEM_MESSAGE and DEEPSEEK_TRANSLATION_SERVICES_PROMPT_TEMPLATE.