# NOT RUN {
# Simple translation
toEnglish("Hallo Welt!", auth_key = "my_key")
# Customized translator applied to multiple strings
txt1 <- c("Mein Name ist Albert.", "Ich bin Physiker.", "Ich wurde 1879 in Ulm geboren.")
translator1 <- function(t) toEnglish(text = t, auth_key = "x")
purrr::map_chr(txt1, translator1)
# Customized translator applied to multiple strings (with language detection response)
txt2 <- c("Me llamo Fred.", "Je suis m<U+00E9>decin.", "Ich komme aus der Schweiz.")
translator2 <- function(t) toEnglish(text = t, get_detect = T, auth_key = "x")
purrr::map_df(txt2, translator2)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab