Translates the Roxygen2 documentation to a different language

translate_roxygen

Description

Reads the Roxygen2 tags in the package and translates them. The translations are stored in R scripts. The default location of the new scripts is ‘man-lang’. They will be in a sub-folder representing the language the are translated to.

Usage


translate_roxygen(
  lang,
  lang_sub_folder = to_iso639(lang, silent = FALSE),
  lang_folder = path("man-lang"),
  r_script = NULL,
  r_folder = path("R")
)

Arguments

Arguments Description
lang The target language to translate help to
lang_sub_folder 2-letter language/source folder to save the new Roxygen scripts to. It defaults to taking the value from lang, and attempts to convert it into an ISO 639 two-letter designation
lang_folder The target base folder to save the Roxygen files. It defaults to ‘man-lang’. The final destination will be a combination of this and the folder from folder
r_script A single R script to translate. Defaults to NULL. If it is null, then every R script in the r_folder will be translated
r_folder The source R scripts. It defaults to the ‘R’ folder.

Details

This approach makes it easier to edit the translations by hand after the LLM does a first pass. It also allows for others to collaborate with improving the translation.