Skip to content

Translate in R using opensource frontends for common translations engines

License

Notifications You must be signed in to change notification settings

myanesp/opentranslatr

Repository files navigation

opentranslatr

CodeFactor Project Status: Active - The project has reached a stable, usable state and is being actively developed. Github last-commit Github license

Translate in R using opensource frontends for common translations engines

This R package allows you to translate text directly from R: from dataframes to strings, it lets you to use common translations engines like Google Translate using a frontend, which it is a benefit in terms of privacy.

For now, these are the supported ones:

  • SimplyTranslate. It supports Google Translate, Reverso and inCIBA.
  • Lingva. It supports Google Translate.
  • gtranslate. Lightweight frontend for Google Translate. You can selfhost it with my Docker image.
  • Mozhi. Fork of SimplyTranslate, now supports more features and translation engines, such as Deepl, LibreTranslate or DuckDuckGo.

Features

  • Translate texts, strings of R objects without leaving R using frontends for Google Translate or Reverso.
  • Automatically detect languages.
  • Get a list of available languages.

Installation

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/opentranslatr")
# And then load into your current session
library(opentranslatr)

Examples and usage

lingva(from = "es", to = "fr", str = "hola, ¿cómo estamos?")
[1] "Bonjour, comment allez-vous?"

simplytranslate(from = "en", to = "de", str = "welcome!")
[1] "Willkommen!"

simplytranslate(from = "en", to = "fr", str = "welcome!", engine = "reverso") # select engine
[1] "bienvenue!"

mozhi(from = "en", to = "de", str = "beach", instance = "http://localhost:3000")
[1] "Strand"

gtrannslate(from = "en", to = "es", str = "table")
[1] "mesa"

get_languages() # Get available languagues for the frontend you choose

get_mozhi_engines() # Get available languages for the Mozhi instance you choose

About

Translate in R using opensource frontends for common translations engines

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages