
polyglotr
R package for text translation via free APIs — no API keys needed for most services.
Supports Google Translate, Apertium, MyMemory, PONS, QCRI, and Wikimedia Translation.
Installation
install.packages("polyglotr")
# development version
remotes::install_github("Tomeriko96/polyglotr")Usage
library(polyglotr)
google_translate("Hello, world!", target_language = "fr")
apertium_translate("Hello, world!", target_language = "es", source_language = "en")Translate multiple texts into multiple languages at once:
texts <- c("Hello, how are you?", "I love programming!", "This is a test.")
languages <- c("es", "fr", "de")
create_translation_table(texts, languages)
#> Original_word es fr de
#> 1 Hello, how are you? ¿Hola, cómo estás? Bonjour comment allez-vous? Hallo, wie geht's dir?
#> 2 I love programming! ¡Me encanta programar! J'adore programmer ! Ich liebe Programmieren!
#> 3 This is a test. Esto es una prueba. C'est un test. Das ist ein Test.See the reference page for all functions and the vignettes for detailed examples.
License
MIT — see LICENSE.
Citation
Iwan, T. (2023). polyglotr: Multilingual Text Translation in R.
https://github.com/Tomeriko96/polyglotr
Related
- googleLanguageR: R client for the Google Translation API, Cloud Natural Language API, Cloud Speech API, and Cloud Text-to-Speech API