translate_manuscript: Translate Mansucript File

Description Usage Arguments Value Note Examples

View source: R/translate_manuscript.R

Description

Translate Mansucript File

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
translate_manuscript(
  file,
  target = "es",
  chunk = TRUE,
  fix_header = TRUE,
  verbose = TRUE,
  ...
)

translate_script(
  file,
  target = "es",
  chunk = TRUE,
  fix_header = FALSE,
  verbose = TRUE,
  ...
)

chunk_google_translate(
  file,
  chunk = TRUE,
  target = "es",
  fix_header = TRUE,
  ...
)

gl_detect_file(file, max_nchar = 2000)

check_manuscript_backticks(file)

Arguments

file

Manuscript markdown file

target

target language, see googleLanguageR::gl_translate

chunk

Should the calls to Google Translate be chunked?

fix_header

should the header information be fixed, such as ' course-completeness: 100 '.

verbose

Print diagnostic messages

...

additional arguments to pass to googleLanguageR::gl_translate

max_nchar

number of characters to use for detection.

Value

A 'data.frame' of the text and translated text

Note

The following changes of the translated text are attempted: Change '] (' without spaces for links Keep links to be the link from original text Replace asterisks and underscores for bolding Keep back-ticked code as is

Examples

1
2
3
4
5
6
7
8
9
auth_file = "~/Dropbox/Projects/cbds_translate/RClass-Translator.json"
if (file.exists(auth_file)) {
googleLanguageR::gl_auth(auth_file)
target = "es"
verbose = TRUE
 chunk = TRUE
file = system.file("extdata", "00_template.md", package = "didactr")
df = translate_manuscript(file)
}

muschellij2/didactr documentation built on March 17, 2021, 12:45 p.m.