DLT. - DeepL Translate

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > DLT. - DeepL-Translate >

DLT. - DeepL Translate

DLT.Additional Instructions

Previous Top Next


MiniRobotLanguage (MRL)

 

DLT.Additional Instructions

Sets extra JSON instructions for DeepL

 

 

Intention

 

The DLT.Additional Instructions command is used to set additional instructions for the JSON body sent to the DeepL Translator. For example, you can use this command to specify additional parameters that are not covered by other commands.


Example 1 (manual Escaping):

To set the glossary_terms field in the JSON body, you would use:

 

DLT.Additional Instructions|\"glossary_terms\": [\"term1\", \"term2\"]

 

This will result in the DLT_Adi variable being set to "\"glossary_terms\": [\"term1\", \"term2\"]", and the JSON body sent to the DeepL Translator will include this additional instruction.


Example 2 (use AIC.Escape String):

To set the glossary_terms field in the JSON body, you would first use the AIC.Escape String command to escape the string:

 

AIC.Escape String|glossary_terms: [term1, term2]|$$RES

 

Then, you would use the DLT.Additional Instructions command with the escaped string:

 

DLT.Additional Instructions|$$RES


Example 3 (multiple additional Instructions)

 

To set multiple fields in the JSON body, such as glossary_terms and additional_context, you would first use the AIC.Escape String command to escape each string:

 

AIC.Escape String|glossary_terms: [term1, term2]|$$RES1

AIC.Escape String|additional_context: [context1, context2]|$$RES2

 

Then, you would use the DLT.Additional Instructions command with the escaped strings, concatenating them with a comma:

 

DLT.Additional Instructions|$$RES1, $$RES2

 

This will result in the internal variable being set to the concatenated escaped strings, and the JSON body sent to the DeepL Translator will include these additional instructions.

 

Please note that the AIC.Escape String command is used to escape each string separately, and the results are stored in different variables ($$RES1 and $$RES2). These escaped strings are then concatenated with a comma to form the final additional instructions.


 

Syntax

 

 

DLT.Additional Instructions[P1] … ELS. … EIF.

 

 

Parameter Explanation

 

P1 - (optional) The additional instructions for the JSON body. This is a string that should be formatted as a valid JSON key-value pair. For example, "\"glossary_terms\": [\"term1\", \"term2\"]" would add a glossary_terms field to the JSON body with the values term1 and term2.

If no parameter is provided, P1 will be set to an empty string.

 

It's important to note that any necessary escaping of special characters in the additional instructions must be done manually.
This can also be achieved using the AIC.Escape String command.
This step ensures that the additional instructions are formatted correctly as a valid JSON string.

 

 

 

 

Example

 

'***********************************

' Here is the resulting JSON Body

'***********************************

{

  "text": ["Your text here"],

  "source_lang": "EN",

  "target_lang": "DE",

  "split_sentences": "1",

  "format": "text",

  "formality": "default",

  "preserve_formatting": false,

  "glossary_terms": ["term1", "term2"],

  "additional_context": ["context1", "context2"]

}

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also: