The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

gtranslate

The goal of gtranslate is to translate between different languages without any Google API authentication which is pain and you must pay for the key, gtranslate is free and lightweight.

gtranslate is inspired by deep-translator package.

Installation

You can install the development version of gtranslate from GitHub with:

# install.packages("devtools")
devtools::install_github("mohamed-180/gtranslate")

Example

This is a basic example which shows you how to use the package:

library(gtranslate)

translate("How are you?", from = "auto", to = "ar")

#[1] "كيف حالك؟"

You can pass character vector as text argument

library(gtranslate)

txt <- c("What time is it?", "Go home!", "I'm 30 years old.")

translate(txt, from = "auto", to = "hi") # hi for hindi

#[1] "ये वक़्त क्या है?"   "घर जाओ!"        "मैं 30 साल का हूँ।"

You can also pass any list-like object

library(gtranslate)
library(stringr)

translate(fruit[1:5], to = 'de') # de for German

#[1] "Apfel"    "Aprikose" "Avocado"  "Banane"   "Paprika"

Codes for supported languages

You can use lang_codes list to get the codes of the available languages instead of abbreviations characters as follows

library(gtranslate)

translate("R is a beatiful language.", from = lang_codes$english, to = lang_codes$turkish)

#[1] "R güzel bir dildir."

Limitations

There are two limitations to gtranslate:

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.