Binding to LibreTranslate API for R: translate, detect languages, obtain the available languages to translate from and to. Enhanced with a user-friendly wizard process.
API Docs | LibreTranslate GitHub Repository | Official instance | List of instances
This package is not yet available on CRAN. So you must install from GitHub using remotes
package.
if (!require("remotes")) install.packages("remotes")
remotes::install_github("myanesp/libretranslateR")
# And then load into your current session
library(libretranslateR)
set_config() # Config wizard for setting the instance you're going to use and your API key
translate(q = "hola, amigos", to = "en") # Autodetect language
translate(q = "hola", from = "es", to = "fr")
translate_file(file = 'my-text.odt', to = "es") # Translate file
get_languages() # Display available languages
detect_language("do you know what i'm talking about?") # Detect language and the level of confidence
You can follow the official instructions located at LibreTranslate’s repository to host your own instance. You can do it through the Python’s package or through a docker container.
get_languages()
to real user-friendly names