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.

deepRstudio: Seamless Language Translation in RStudio using DeepL API and rstudioapi

Lifecycle: maturing CRAN CRAN_latest_release_date CRAN :total status badge deepRstudio status badge

GitHub/deepRstudio

Description

Enhancing cross-language compatibility within the RStudio environment and supporting seamless language understanding, the deepRstudio package leverages the power of the ‘DeepL’ API (see https://www.deepl.com/docs-api) to enable seamless, fast, accurate, and affordable translation of code comments, documents, and text. This package offers the ability to translate selected text into English, as well as from English (EN) into various languages, namely Japanese (JA), Chinese (ZH), Spanish (ES), French (FR), Russian (RU), Portuguese (PT), and Indonesian (ID). With much of the text being written in English, the emphasis is on compatibility from English. It is also designed for developers working on multilingual projects and data analysts collaborating with international teams, simplifying the translation process and making code more accessible and comprehensible to people with diverse language backgrounds. This package uses ‘rstudioapi’ package and ‘DeepL’ API, and is simply implemented, executed from addins or via shortcuts on RStudio. With just a few steps, content can be translated between supported languages, promoting better collaboration and expanding the global reach of work.

The functionality of this package works only on RStudio using rstudioapi.

DeepL API Docs : https://www.deepl.com/docs-api

To obtain your DeepL API key, you must register for an account at the DeepL website. You can register for a free account. This package is built for use with the free version of the Web API.

Demo video

Installation of the deepRstudio package

1. Start R / RStudio console.

2. Run the following commands in the R console:

CRAN-version installation

# CRAN-version installation
install.packages("deepRstudio")
library(deepRstudio)

Note: Once restart R (Restart R on the Session or .rs.restartR()) is recommended.

Dev-version installation

#v0.0.5
devtools::install_github("kumeS/deepRstudio", ref = "v0.0.5")
library(deepRstudio)

Note: Once restart R (Restart R on the Session or .rs.restartR()) is recommended.

3. Set the API key according to DeepL Web API.

Please register for a membership (either free or paid) on the DeepL website (https://www.deepl.com/docs-api) to obtain your API key.

Step 1: log in to the DeepL website.

GitHub Logo1

Step 2: click on the Account item.

GitHub Logo2

Step 3: Scroll down in the Account section and you will see your DeepL API key.

GitHub Logo3

Note: DeepL API Free plan offers free translation of up to 500,000 words/characters per month.

# Set your key for the DeepL API
Sys.setenv(DeepL_API_KEY = "Your API key")

Create an .Rprofile file in your home directory and add your API key (using the code above) into it.

# Create a file
file.create("~/.Rprofile") 

# [MacOS X] Open the file and edit it
system(paste("open ~/.Rprofile"))

Note: Please be aware of newline character inconsistencies across different operating systems.

Here is an example of .Rprofile configuration.

GitHub Logo1

Functions in deepRstudio

Function Description Script
deepel DeepL Translation Function Script
deepel_from_EN Translate English Text to Other Languages via DeepL API in your clipboard Script
deepel_rstudioapi_2EN Translate Selected Text to English via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_2ZH Translate Selected Text to Chinese via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_2ES Translate Selected Text to Spanish via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_2FR Translate Selected Text to French via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_2RU Translate Selected Text to Russian via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_2PT Translate Selected Text to Portuguese (all Portuguese varieties mixed) via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_2ID Translate Selected Text to Indonesian via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_2JA Translate Selected Text to Japanese via DeepL API (as RStudio Addins) Script
deepel_rstudioapi_speakInJA Translate and Speak in Japanese via DeepL API (as RStudio Addins / MacOS X) Script

License

Copyright (c) 2023 Satoshi Kume. Released under the Artistic License 2.0.

Cite

Kume S. (2023) deepRstudio: Seamless Language Translation in RStudio using DeepL API and rstudioapi

#BibTeX
@misc{Kume2023deepRstudio,
  title={deepRstudio: Seamless Language Translation in RStudio using DeepL API and rstudioapi},
  author={Kume, Satoshi}, year={2023},
  publisher={GitHub}, note={R Package},
  howpublished={\url{https://github.com/kumeS/deepRstudio}},
}

Contributors

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.