| toPortuguese2 | R Documentation | 
toPortuguese2 translates a text from any supported source language into Portuguese using the DeepL API Free.
Use available_languages2 to list all supported languages.
toPortuguese2(
  text,
  source_lang = NULL,
  split_sentences = TRUE,
  preserve_formatting = FALSE,
  get_detect = FALSE,
  context = NULL,
  model_type = NULL,
  formality = NULL,
  glossary_id = NULL,
  auth_key
)
| text | A character vector containing the text(s) to be translated. Only UTF-8 encoded plain text is supported. Each element may contain multiple sentences but should not exceed 30 kB. | 
| source_lang | A string specifying the source language. If  | 
| split_sentences | Logical. If  | 
| preserve_formatting | Logical. If  | 
| get_detect | Logical. If  | 
| context | Optional string providing contextual information to improve translation quality, especially for short or ambiguous text. Context is not translated and does not count toward character limits. | 
| model_type | Optional. Specifies the DeepL model to use: 
 | 
| formality | Optional. Controls formality level of the translation (only for certain target languages): 
 | 
| glossary_id | Optional. Glossary ID for custom translation. Must match the language pair and requires  | 
| auth_key | A string representing the authentication key for the DeepL API Free. 
If not provided, the function will attempt to retrieve the key from the environment 
variable  | 
To use this function, you must obtain an authentication key by registering for a DeepL API Free account at DeepL API Free. With the Free API, up to 500,000 characters per month can be translated at no cost.
If get_detect = FALSE, a character vector with translations is returned. 
If get_detect = TRUE, a tibble with the following columns is returned:
translation: The translated text.
source_lang: The detected or specified source language.
DeepL API Documentation — Translate
## Not run: 
toPortuguese2("Hallo Welt!")
texts <- c("My name is Fred.", "Je suis médecin.", "Ich komme aus der Schweiz.")
toPortuguese2(texts, get_detect = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.