$GLOBALS['mwsgDeeplTranslateServiceAuth'] = 'your-auth-key-here';
$GLOBALS['mwsgDeeplTranslateServiceUrl'] = 'https://api.deepl.com/v2';
// Optional - special cases
$GLOBALS['mwsgDeeplTranslateTranslateUrl'] = $GLOBALS['mwsgDeeplTranslateServiceUrl'] . '/translate';
$GLOBALS['mwsgDeeplTranslateLanguagesUrl'] = $GLOBALS['mwsgDeeplTranslateServiceUrl'] . '/languages';
$translator = \MediaWiki\MediaWikiServices::getInstance()->getService( 'MWStake.DeepLTranslator' );
$translation = $translator->translateText( 'Hello, world!', 'EN', 'DE' );
curl -X POST "https://your-wiki/rest.php/mws/v1/deepl/translate" -H "Content-Type: application/json" --data '{"text":"Hello, world!","source_lang":"EN","target_lang":"DE"}'
mws.deepltranslator.translateText( 'Hello, world!', 'EN', 'DE' ).then( function( translation ) {
console.log( translation );
} );