translate: Translate a text, web, or help document.

Description Usage Arguments References Examples

View source: R/translate.R

Description

The input is translated to a specified language with Google Translate. For the translation of help document, the source document is derived from RDocumentation. See language for the available languages.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
translate(doc, to = "default", from = "auto", ...)

doc %to% to

## S3 method for class 'character'
translate(doc, to = "default", from = "auto", ...)

## S3 method for class 'help_files_with_topic'
translate(doc, to = "default", from = "auto", ...)

## S3 method for class 'transdoc_help'
translate(doc, to = "default", from = "auto", ...)

Arguments

doc

A character vector of text, a string of URL, or an object returned by help or ?.

to

doc is translated to the language specified to to (e.g., "en", "ja", "de"). The default value, "default", is equivalent to getOption("transdoc_to", "en"). For %to%, the non-standard evaluation takes place for to.

from

doc is translated from the specified language. Currently, "auto" is the only supported value and is the default value.

...

Arguments passed to the methods.

References

Google Translate https://translate.google.com/, RDocumentation https://www.rdocumentation.org/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# Translate a text document
translate("This text will be translated", "ja")
"This text will be translated" %to% ja

# Translate a web document
translate("https://transdoc.atusy.net/")
"https://transdoc.atusy.net/" %to% ja

# Translate a help document
translate(help(str))
help(str) %to% ja

## End(Not run)

atusy/transdoc documentation built on May 17, 2020, 4:38 p.m.