toPortuguese {deeplr} | R Documentation |
Translate texts into Portuguese using DeepL API Pro
Description
toPortuguese
translates a text from an available language into Portuguese
using DeepL API Pro. Use available_languages
to list all supported languages.
An authentication key is required to use this service.
The service costs depending on the number of translated characters.
Usage
toPortuguese(
text,
source_lang = NULL,
split_sentences = TRUE,
preserve_formatting = FALSE,
get_detect = FALSE,
auth_key = "your_key"
)
Arguments
text |
character vector to be translated. Only UTF8-encoded plain text is supported. An element can contain several sentences, but should not exceed 30kbytes. |
source_lang |
language of the text to be translated. If parameter |
split_sentences |
if |
preserve_formatting |
if |
get_detect |
if |
auth_key |
Authentication key. |
Details
To get an authentication key, you need to register for a DeepL API Pro account (https://www.deepl.com/pro#developer).
Value
If get_detect
is set to FALSE
a character vector
containing the
translation is returned. Otherwise, a (tibble
) is returned with the following columns:
-
translation
the translated text. -
source_lang
detected or specified language of the input text.
References
Examples
## Not run:
# Translate a single text
toPortuguese("Hallo Welt!", auth_key = "my_key")
# Translate multiple texts and return the detected language
texts <- c("My name is Fred.", "Je suis médecin.", "Ich komme aus der Schweiz.")
toPortuguese(texts, get_detect = T, auth_key = "x")
## End(Not run)