roxygen2
roxygen2 copied to clipboard
The language is not respected when running inline code
My system language is French, but when I redocument packages, I'd like the language set in DESCRIPTION to be respected.
Given the following reprex
library(roxygen2)
roc_proc_text(rd_roclet(), "
#' Title
#'
#' ```{r}
#' try(mean(x))
#' ```
#' @export
foo <- function() {}"
)
$foo.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in ./<text>
\name{foo}
\alias{foo}
\title{Title}
\usage{
foo()
}
\description{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{try(mean(x))
#> Error in eval(expr, envir, enclos) : objet 'x' introuvable
}\if{html}{\out{</div>}}
}
As you can see, the error is in French. objet 'x' introuvable
When I redocument rlang, I get some changes in the Rd file, so I have to be careful not to commit them. So I wonder if roxygen2 could set the locale internally so that this doesn't happen
Actually could take inspiration from https://github.com/r-lib/roxygen2/pull/1621/files and add local_language()
or local_locale()