Title: | Seamless Language Translation in 'RStudio' using 'DeepL' API and 'Rstudioapi' |
---|---|
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 (EN), as well as from English 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 the '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'. |
Authors: | Satoshi Kume [aut, cre] |
Maintainer: | Satoshi Kume <[email protected]> |
License: | Artistic-2.0 |
Version: | 0.0.9 |
Built: | 2024-11-19 03:24:22 UTC |
Source: | https://github.com/kumes/deeprstudio |
This function translates text using the DeepL API.
deepel( input, target_lang = "EN", Auth_Key = Sys.getenv("DeepL_API_KEY"), free_mode = TRUE )
deepel( input, target_lang = "EN", Auth_Key = Sys.getenv("DeepL_API_KEY"), free_mode = TRUE )
input |
The text to be translated. |
target_lang |
The target language code for translation. The language into which the text should be translated. Options are: BG - Bulgarian, CS - Czech, DA - Danish, DE - German, EL - Greek, EN - English (unspecified variant for backward compatibility; please select EN-GB or EN-US instead), EN-GB - English (British), EN-US - English (American), ES - Spanish, ET - Estonian, FI - Finnish, FR - French, HU - Hungarian, ID - Indonesian, IT - Italian, JA - Japanese, KO - Korean, LT - Lithuanian, LV - Latvian, NB - Norwegian (Bokmål), NL - Dutch, PL - Polish, PT - Portuguese (unspecified variant for backward compatibility; please select PT-BR or PT-PT instead), PT-BR - Portuguese (Brazilian), PT-PT - Portuguese (all Portuguese varieties excluding Brazilian Portuguese), RO - Romanian, RU - Russian, SK - Slovak, SL - Slovenian, SV - Swedish, TR - Turkish, UK - Ukrainian, ZH - Chinese (simplified). |
Auth_Key |
Your DeepL API authentication key. Defaults to the value of the environment variable "DeepL_API_KEY". |
free_mode |
A boolean value; set to TRUE if using the free DeepL API, FALSE if using the paid version. Default is TRUE. |
A data frame containing the detected source language, target language, and translated text.
Satoshi Kume
## Not run: Auth_Key <- "your_deepl_api_key" input <- "Hello, how are you?" target_lang <- "JA" translated_text <- deepel(input, target_lang, Auth_Key) print(translated_text) ## End(Not run)
## Not run: Auth_Key <- "your_deepl_api_key" input <- "Hello, how are you?" target_lang <- "JA" translated_text <- deepel(input, target_lang, Auth_Key) print(translated_text) ## End(Not run)
Translate English text from the clipboard into the specified target language using the DeepL API.
deepel_from_EN( target_lang = "JA", Auth_Key = Sys.getenv("DeepL_API_KEY"), free_mode = TRUE )
deepel_from_EN( target_lang = "JA", Auth_Key = Sys.getenv("DeepL_API_KEY"), free_mode = TRUE )
target_lang |
The language into which the text should be translated. Options are:
BG - Bulgarian, CS - Czech, DA - Danish, DE - German, EL - Greek,
EN - English (unspecified variant for backward compatibility; please select EN-GB or EN-US instead),
EN-GB - English (British), EN-US - English (American), ES - Spanish, ET - Estonian,
FI - Finnish, FR - French, HU - Hungarian, ID - Indonesian, IT - Italian,
JA - Japanese, KO - Korean, LT - Lithuanian, LV - Latvian, NB - Norwegian (Bokmål),
NL - Dutch, PL - Polish, PT - Portuguese (unspecified variant for backward compatibility; please select PT-BR or PT-PT instead),
PT-BR - Portuguese (Brazilian), PT-PT - Portuguese (all Portuguese varieties excluding Brazilian Portuguese),
RO - Romanian, RU - Russian, SK - Slovak, SL - Slovenian, SV - Swedish,
TR - Turkish, UK - Ukrainian, ZH - Chinese (simplified).
|
Auth_Key |
The authentication key for the DeepL API. |
free_mode |
A logical value indicating whether to use the free or paid DeepL API. Default is TRUE. |
Translate English Text to Other Languages via DeepL API
This function takes English text from the clipboard and translates it into the specified target language using the DeepL API. The translated text is then placed back into the clipboard, ready to be pasted wherever needed.
The translated text is placed into the clipboard and the function returns the result of clipr::write_clip
.
Satoshi Kume
## Not run: #Copy English text into your clipboard to excute the function. Then paste your clipboard. deepel_from_EN(target_lang = 'JA') ## End(Not run)
## Not run: #Copy English text into your clipboard to excute the function. Then paste your clipboard. deepel_from_EN(target_lang = 'JA') ## End(Not run)
Translate the selected text in RStudio into English using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2EN()
deepel_rstudioapi_2EN()
Translate Selected Text to English via DeepL API
This function uses the rstudioapi to execute English translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into English. First, select the text and execute "DeepL Translation into English" from addins. As a result, the selected part will be translated into English.
No value is returned.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into English" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into English" from RStudio addins. ## End(Not run)
Translate the selected text in RStudio into Spanish using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2ES()
deepel_rstudioapi_2ES()
Translate Selected Text to Spanish via DeepL API
This function uses the rstudioapi to execute Spanish translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into Spanish. First, select the text and execute "DeepL Translation into Spanish" from addins. As a result, the selected part will be translated into Spanish.
A message indicating the completion of the translation. No value is returned.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Spanish" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Spanish" from RStudio addins. ## End(Not run)
Translate the selected text in RStudio into French using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2FR()
deepel_rstudioapi_2FR()
Translate Selected Text to French via DeepL API
This function uses the rstudioapi to execute French translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into French. First, select the text and execute "DeepL Translation into French" from addins. As a result, the selected part will be translated into French.
A message indicating the completion of the translation. No value is returned.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into French" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into French" from RStudio addins. ## End(Not run)
Translate the selected text in RStudio into Indonesian using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2ID()
deepel_rstudioapi_2ID()
Translate Selected Text to Indonesian via DeepL API
This function uses the rstudioapi to execute Indonesian translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into Indonesian. First, select the text and execute "DeepL Translation into Indonesian" from addins. As a result, the selected part will be translated into Indonesian.
A message indicating the completion of the translation. No value is returned.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Indonesian" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Indonesian" from RStudio addins. ## End(Not run)
Translate the selected text in RStudio into Japanese using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2JA()
deepel_rstudioapi_2JA()
Translate Selected Text to Japanese via DeepL API
This function uses the rstudioapi to execute Japanese translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into Japanese. First, select the text and execute "DeepL Translation into Japanese" from addins. As a result, the selected part will be translated into Japanese.
A message indicating the completion of the translation. No value is returned.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Japanese" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Japanese" from RStudio addins. ## End(Not run)
Translate the selected text in RStudio into Portuguese using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2PT()
deepel_rstudioapi_2PT()
Translate Selected Text to Portuguese via DeepL API
This function uses the rstudioapi to execute Portuguese translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into Portuguese. First, select the text and execute "DeepL Translation into Portuguese" from addins. As a result, the selected part will be translated into Portuguese.
A message indicating the completion of the translation.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Portuguese" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Portuguese" from RStudio addins. ## End(Not run)
Translate the selected text in RStudio into Russian using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2RU()
deepel_rstudioapi_2RU()
Translate Selected Text to Russian via DeepL API
This function uses the rstudioapi to execute Russian translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into Russian. First, select the text and execute "DeepL Translation into Russian" from addins. As a result, the selected part will be translated into Russian.
A message indicating the completion of the translation.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Russian" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Russian" from RStudio addins. ## End(Not run)
Translate the selected text in RStudio into Chinese using the DeepL API with auto-detection of the source language. This function uses free-version DeepL API (https://api-free.deepl.com/v2/translate).
deepel_rstudioapi_2ZH()
deepel_rstudioapi_2ZH()
Translate Selected Text to Chinese via DeepL API
This function uses the rstudioapi to execute Chinese translation of the selected text using the DeepL API. It will attempt to auto-detect the language of the text and translate it into Chinese. First, select the text and execute "DeepL Translation into Chinese" from addins. As a result, the selected part will be translated into Chinese.
A message indicating the completion of the translation.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Chinese" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "DeepL Translation into Chinese" from RStudio addins. ## End(Not run)
This function takes the selected text in RStudio, translates it into Japanese using the DeepL API, and then speaks the translated text using MacOS's speech system.
deepel_rstudioapi_speakInJA()
deepel_rstudioapi_speakInJA()
Translate Selected Text and Speak in Japanese via DeepL API and MacOS system
A message indicating that the translation and speech process has finished.
Satoshi Kume
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "Translation and Speak in Japanese : deepRstudio" from RStudio addins. ## End(Not run)
## Not run: #Select the following text: "La selección está traducida al inglés." #Then, execute "Translation and Speak in Japanese : deepRstudio" from RStudio addins. ## End(Not run)
Translate English text from the clipboard into the specified target language using the DeepL API.
deepel_X2X( target_lang = "JA", Auth_Key = Sys.getenv("DeepL_API_KEY"), free_mode = TRUE )
deepel_X2X( target_lang = "JA", Auth_Key = Sys.getenv("DeepL_API_KEY"), free_mode = TRUE )
target_lang |
The language into which the text should be translated. Options are:
BG - Bulgarian, CS - Czech, DA - Danish, DE - German, EL - Greek,
EN - English (unspecified variant for backward compatibility; please select EN-GB or EN-US instead),
EN-GB - English (British), EN-US - English (American), ES - Spanish, ET - Estonian,
FI - Finnish, FR - French, HU - Hungarian, ID - Indonesian, IT - Italian,
JA - Japanese, KO - Korean, LT - Lithuanian, LV - Latvian, NB - Norwegian (Bokmål),
NL - Dutch, PL - Polish, PT - Portuguese (unspecified variant for backward compatibility; please select PT-BR or PT-PT instead),
PT-BR - Portuguese (Brazilian), PT-PT - Portuguese (all Portuguese varieties excluding Brazilian Portuguese),
RO - Romanian, RU - Russian, SK - Slovak, SL - Slovenian, SV - Swedish,
TR - Turkish, UK - Ukrainian, ZH - Chinese (simplified).
|
Auth_Key |
The authentication key for the DeepL API. |
free_mode |
A logical value indicating whether to use the free or paid DeepL API. Default is TRUE. |
Translate X to X via DeepL API
This function takes text from the clipboard and translates it into the specified target language using the DeepL API. The translated text is then placed back into the clipboard, ready to be pasted wherever needed.
The translated text is placed into the clipboard and the function returns the result of clipr::write_clip
.
Satoshi Kume
## Not run: #Copy text into your clipboard to excute the function. Then paste your clipboard. deepel_X2X(target_lang = 'JA') ## End(Not run)
## Not run: #Copy text into your clipboard to excute the function. Then paste your clipboard. deepel_X2X(target_lang = 'JA') ## End(Not run)
Determines if the current system is running on Mac OS (Darwin).
is_mac()
is_mac()
Check if the System is Running on Mac OS
This function determines whether the current system is running on Mac OS. It utilizes the system information provided by R to check the operating system name, and returns TRUE if it is Mac OS (Darwin), and FALSE otherwise.
Logical value indicating whether the system is Mac OS. Returns TRUE if Mac OS, FALSE otherwise.
Satoshi Kume
## Not run: if (is_mac()) { print("This is a Mac OS system.") } else { print("This is not a Mac OS system.") } ## End(Not run)
## Not run: if (is_mac()) { print("This is a Mac OS system.") } else { print("This is not a Mac OS system.") } ## End(Not run)
Prints the characters of the input text string one by one, with a specified delay between each character. If the random parameter is set to TRUE, the delay will be a random value between 0.0001 and 0.3 seconds. Otherwise, the delay will be the value specified by the delay parameter.
slow_print(text, random = FALSE, delay = 0.125)
slow_print(text, random = FALSE, delay = 0.125)
text |
A string representing the text to be printed. Must be a non-NA string. |
random |
A logical value indicating whether the delay between characters should be random. Default is FALSE. |
delay |
A numeric value representing the fixed delay between characters in seconds. Default is 0.125. Must be a non-negative number. |
Slowly Print Text
This function prints the characters of a given text string one by one, with a specified delay between each character. The delay can be either fixed or random.
Invisible NULL. The function prints the text to the console.
Satoshi Kume
## Not run: slow_print("Hello, World!") slow_print("Hello, World!", random = TRUE) slow_print("Hello, World!", delay = 0.1) ## End(Not run)
## Not run: slow_print("Hello, World!") slow_print("Hello, World!", random = TRUE) slow_print("Hello, World!", delay = 0.1) ## End(Not run)