DeepL
Inject the DeepL API as a translation provider into directive @strTranslate
, to translate a field value to over 30 languages.
Description
Make DeepL'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 DeepL API:
List of languages
You can translate your content to any of the following languages:
Code | Language |
---|---|
AR | Arabic |
BG | Bulgarian |
CS | Czech |
DA | Danish |
DE | German |
EL | Greek |
EN | English (all English variants) |
ES | Spanish |
ET | Estonian |
FI | Finnish |
FR | French |
HU | Hungarian |
ID | Indonesian |
IT | Italian |
JA | Japanese |
KO | Korean |
LT | Lithuanian |
LV | Latvian |
NB | Norwegian Bokmål |
NL | Dutch |
PL | Polish |
PT | Portuguese (all Portuguese variants) |
RO | Romanian |
RU | Russian |
SK | Slovak |
SL | Slovenian |
SV | Swedish |
TR | Turkish |
UK | Ukrainian |
ZH | Chinese (all Chinese variants) |
DeepL API Configuration
In order to use DeepL, it is mandatory to provide the Plan used (Free or Pro) and the API key, via tab "Plugin Management => DeepL API" on the Settings page.
Create the API key in your DeepL's account, following the instructions here.
Then follow one of the methods below to input the value.
By Settings
Input the Plan and API key in the corresponding inputs in the Settings page, and click on "Save Changes (All)":
wp-config.php
In
Add constants GATOGRAPHQL_DEEPL_PLAN
and GATOGRAPHQL_DEEPL_API_KEY
in wp-config.php
:
By environment variable
Define environment variables DEEPL_PLAN
and DEEPL_API_KEY
.