Skip to contents

Translate text using google translate

Usage

google_translate(text, target_language = "en", source_language = "auto")

Arguments

text

This is the text that you want to translate.

target_language

This is the language that you want to translate the text into. The default value for this argument is "en" for English.

source_language

This is the language of the text that you want to translate. The default value for this argument is "auto", which means that the function will try to automatically detect the language of the text.

Value

Translated text.

Examples

# \donttest{
google_translate("I love languages", target_language = "es")
#> [1] "me encantan los idiomas"
text_to_translate <- c("the", "quick", "brown")
google_translate(text_to_translate, "fr", "en")
#> [[1]]
#> [1] "le"
#> 
#> [[2]]
#> [1] "rapide"
#> 
#> [[3]]
#> [1] "brun"
#> 
# }