toFrench | R Documentation |
toFrench
translates a text from any supported source language into French using the DeepL API Pro.
Use available_languages
to list all supported languages.
toFrench(
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 Pro.
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 Pro account at DeepL API Pro. This service may incur costs depending on the number of characters translated.
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:
toFrench("Hallo Welt!")
texts <- c("Me llamo Fred.", "I'm a doctor.", "Ich komme aus der Schweiz.")
toFrench(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.