Package 'deeplr'

Title: Interface to the 'DeepL' Translation API
Description: A wrapper for the 'DeepL' Pro API <https://www.deepl.com/docs-api>, a web service for translating texts between different languages. A DeepL API developer account is required to use the service (see <https://www.deepl.com/pro#developer>).
Authors: David Zumbach [aut, cre], Paul C. Bauer [aut]
Maintainer: David Zumbach <[email protected]>
License: MIT + file LICENSE
Version: 2.0.1
Built: 2025-02-16 05:31:20 UTC
Source: https://github.com/zumbov2/deeplr

Help Index


deeplr package

Description

An R wrapper for the DeepL Translator API

Details

See the README on GitHub

Author(s)

Maintainer: David Zumbach [email protected]

Authors:

See Also

Useful links:


List supported languages of DeepL API Pro

Description

available_languages list all supported languages of DeepL API Pro.

Usage

available_languages(auth_key = "your_key")

Arguments

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).

References

DeepL API documentations

Examples

## Not run: 
available_languages(auth_key = "my_key")

## End(Not run)

List supported languages of DeepL API Free

Description

available_languages2 list all supported languages of DeepL API Free.

Usage

available_languages2(auth_key = "your_key")

Arguments

auth_key

authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free account (https://www.deepl.com/pro#developer).

References

DeepL API documentations

Examples

## Not run: 
available_languages2(auth_key = "my_key")

## End(Not run)

deeplr package

Description

An R wrapper for the DeepL Translator API

Details

See the README on GitHub


Language detection using DeepL API Pro

Description

detect guesses the language of a text 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

detect(text, auth_key = "your_key")

Arguments

text

character vector with texts to classify. Only UTF8-encoded plain text is supported. An element can contain several sentences, but should not exceed 30kbytes.

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).

References

DeepL API documentations

Examples

## Not run: 
detect("My name is Hans.", auth_key = "my_key")

## End(Not run)

Language detection using DeepL API Free

Description

detect2 guesses the language of a text using DeepL API Free. Use available_languages to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

detect2(text, auth_key = "your_key")

Arguments

text

character vector with texts to classify. Only UTF8-encoded plain text is supported. An element can contain several sentences, but should not exceed 30kbytes.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free account (https://www.deepl.com/pro#developer).

References

DeepL API documentations

Examples

## Not run: 
detect2("My name is Hans.", auth_key = "my_key")

## End(Not run)

Fix and improve texts using DeepL API Pro

Description

pimp translates a text into a support language and back into the original language 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

pimp(text, source_lang, help_lang, auth_key = "your_key")

Arguments

text

character vector with texts to be improved. 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 improved. If input is of length 1, the same source language is applied to all elements.

help_lang

language used as a help language for reverse translation.

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).

References

DeepL API documentations

Examples

## Not run: 
pimp("In former times I lived in Zurich", source_lang = "EN", help_lang = "DE", auth_key = "my_key")

## End(Not run)

Fix and improve texts using DeepL API Free

Description

pimp2 translates a text into a support language and back into the original language using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

pimp2(text, source_lang, help_lang, auth_key = "your_key")

Arguments

text

character vector with texts to be improved. 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 improved. If input is of length 1, the same source language is applied to all elements.

help_lang

language used as a help language for reverse translation.

auth_key

authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free account (https://www.deepl.com/pro#developer).

References

DeepL API documentations

Examples

## Not run: 
pimp2(
    text = "In former times I lived in Zurich",
    source_lang = "EN",
    help_lang = "DE",
    auth_key = "my_key"
    )

## End(Not run)

Split texts into segments

Description

split_text splits texts into blocks of a maximum number of bytes.

Usage

split_text(text, max_size_bytes = 29000, tokenize = "sentences")

Arguments

text

character vector to be split.

max_size_bytes

maximum size of a single text segment in bytes.

tokenize

level of tokenization. Either "sentences" or "words".

Details

The function uses tokenizers::tokenize_sentences to split texts.

Value

Returns a (tibble) with the following columns:

  • text_id position of the text in the character vector.

  • segment_id ID of a text segment.

  • segment_text text segment that is smaller than max_size_bytes

Examples

## Not run: 
# Split long text
text <- paste0(rep("This is a very long text.", 10000), collapse = " ")
split_text(text)

## End(Not run)

Translate texts into Chinese using DeepL API Pro

Description

toChinese translates a text from an available language into Chinese 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

toChinese(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toChinese("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.")
toChinese(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Chinese using DeepL API Free

Description

toChinese2 translates a text from an available language into Chinese using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toChinese2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toChinese2("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.")
toChinese2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into English using DeepL API Pro

Description

toEnglish translates a text from an available language into English 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

toEnglish(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toEnglish("Hallo Welt!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "Je suis médecin.", "Ich komme aus der Schweiz.")
toEnglish(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into English using DeepL API Free

Description

toEnglish2 translates a text from an available language into English using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toEnglish2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toEnglish2("Hallo Welt!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "Je suis médecin.", "Ich komme aus der Schweiz.")
toEnglish2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into French using DeepL API Pro

Description

toFrench translates a text from an available language into French 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

toFrench(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toFrench("Hallo Welt!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "I'm a doctor.", "Ich komme aus der Schweiz.")
toFrench(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into French using DeepL API Free

Description

toFrench2 translates a text from an available language into French using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toFrench2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toFrench2("Hallo Welt!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "I'm a doctor.", "Ich komme aus der Schweiz.")
toFrench2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into German using DeepL API Pro

Description

toGerman translates a text from an available language into German 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

toGerman(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toGerman("Hello world!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "Je suis médecin.", "I'm from Brisbane.")
toGerman(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into German using DeepL API Free

Description

toGerman2 translates a text from an available language into German using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toGerman2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toGerman2("Hello world!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "Je suis médecin.", "I'm from Brisbane.")
toGerman2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Italian using DeepL API Pro

Description

toItalian translates a text from an available language into Italian 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

toItalian(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toItalian("Hallo Welt!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "Je suis médecin.", "Ich komme aus der Schweiz.")
toItalian(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Italian using DeepL API Free

Description

toItalian2 translates a text from an available language into Italian using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toItalian2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toItalian2("Hallo Welt!", auth_key = "my_key")

# Translate multiple texts and return the detected language
texts <- c("Me llamo Fred.", "Je suis médecin.", "Ich komme aus der Schweiz.")
toItalian2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Japanese using DeepL API Pro

Description

toJapanese translates a text from an available language into Japanese 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

toJapanese(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toJapanese("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.")
toJapanese(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Japanese using DeepL API Free

Description

toJapanese2 translates a text from an available language into Japanese using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toJapanese2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toJapanese2("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.")
toJapanese2(texts, get_detect = T, auth_key = "x")


## End(Not run)

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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

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)

Translate texts into Portuguese using DeepL API Free

Description

toPortuguese2 translates a text from an available language into Portuguese using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toPortuguese2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toPortuguese2("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.")
toPortuguese2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Russian using DeepL API Pro

Description

toRussian translates a text from an available language into Russian 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

toRussian(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toRussian("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.")
toRussian(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Russian using DeepL API Free

Description

toRussian2 translates a text from an available language into Russian using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toRussian2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toRussian2("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.")
toRussian2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Spanish using DeepL API Pro

Description

toSpanish translates a text from an available language into Spanish 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

toSpanish(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toSpanish("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.")
toSpanish(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts into Spanish using DeepL API Free

Description

toSpanish2 translates a text from an available language into Spanish using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

toSpanish2(
  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 is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
toSpanish2("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.")
toSpanish2(texts, get_detect = T, auth_key = "x")


## End(Not run)

Translate texts with DeepL API Pro

Description

translate translates texts between different languages 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

translate(
  text,
  target_lang = "EN",
  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.

target_lang

target language of the translation. If input is of length 1, all elements are translated into the same language.

source_lang

language of the text to be translated. If parameter is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
translate("I like to translate texts.", target_lang = "DE", auth_key = "x")

# Translate multiple texts into one target language
texts <- c("I like to translate texts.", "Ich übersetze gerne Texte.")
translate(texts, target_lang = "FR", auth_key = "x")

# Translate a single text into multiple target languages
translate("I like to translate texts.", target_lang = c("FR", "DE", "IT"), auth_key = "x")

# Translate multiple texts into different languages
texts <- c("I like to translate texts.", "Ich übersetze gerne Texte.")
translate(texts, target_lang = c("FR", "IT"), auth_key = "x")


## End(Not run)

Translate texts with DeepL API Free

Description

translate2 translates texts between different languages using DeepL API Free. Use available_languages2 to list all supported languages. An authentication key is required to use this service. With the DeepL API Free package, developers can translate up to 500,000 characters per month for free.

Usage

translate2(
  text,
  target_lang = "EN",
  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.

target_lang

target language of the translation. If input is of length 1, all elements are translated into the same language.

source_lang

language of the text to be translated. If parameter is.null, the API guesses the language of the source. If input is of length 1, the same source language is applied to all elements.

split_sentences

if TRUE, the translation engine splits the input into sentences. If only one sentence is translated, it is recommended to set to FALSE to prevent the engine from unintentionally splitting the sentence.

preserve_formatting

if TRUE, the translation engine tries to preserve some aspects (e.g. punctuation at the beginning and end of the sentence, upper/lower case at the beginning of the sentence) of the formatting.

get_detect

if TRUE, the language detected for the source text is included in the response.

auth_key

Authentication key.

Details

To get an authentication key, you need to register for a DeepL API Free 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

DeepL API documentations

Examples

## Not run: 
# Translate a single text
translate2("I like to translate texts.", target_lang = "DE", auth_key = "x")

# Translate multiple texts into one target language
texts <- c("I like to translate texts.", "Ich übersetze gerne Texte.")
translate2(texts, target_lang = "FR", auth_key = "x")

# Translate a single text into multiple target languages
translate2("I like to translate texts.", target_lang = c("FR", "DE", "IT"), auth_key = "x")

# Translate multiple texts into different languages
texts <- c("I like to translate texts.", "Ich übersetze gerne Texte.")
translate2(texts, target_lang = c("FR", "IT"), auth_key = "x")


## End(Not run)

Usage data of a DeepL API Pro account

Description

usage returns the character usage and the configured limit for the current period of a DeepL API Pro account.

Usage

usage(auth_key = "your_key")

Arguments

auth_key

authentication key of the corresponding DeepL API Pro account.

Details

To get an authentication key, you need to register for a DeepL API Pro account (https://www.deepl.com/pro#developer).

References

DeepL API documentations

Examples

## Not run: 
usage(auth_key = "my_key")

## End(Not run)

Usage data of a DeepL API Free account

Description

usage2 returns the character usage and the configured limit for the current period of a DeepL API Free account.

Usage

usage2(auth_key = "your_key")

Arguments

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).

References

DeepL API documentations

Examples

## Not run: 
usage(auth_key = "my_key")

## End(Not run)