lang_help: Translates help documentation to another language

View source: R/lang-help.R

lang_helpR Documentation

Translates help documentation to another language

Description

Translates a given topic into a target language. It uses the lang argument to determine which language to translate to. If not passed, this function will look for a target language in the LANG and LANGUAGE environment variables, or if something has been passed to the .lang argument in lang_use(), to determine the target language. If the target language is English, no translation will be processed, so the help returned will be the original package's documentation.

Usage

lang_help(
  topic,
  package = NULL,
  lang = NULL,
  context_size = NULL,
  type = getOption("help_type")
)

Arguments

topic

A character string specifying the help topic to translate.

package

The R package to look for the topic, if not provided the function will attempt to find the topic based on the loaded packages.

lang

A character vector language to translate the topic to

context_size

Maximum number of words for the context summary included with each translation request. Set to 0 to disable context-aware translation. When NULL, the value set via lang_use() is used (default 100).

type

Produce "html" or "text" output for the help. It defaults to getOption("help_type")

Value

Original or translated version of the help documentation in the output type specified

Examples

## Not run: 
# Requires an interactive session with Ollama running locally
library(lang)

lang_use("ollama", "llama3.2", seed = 100)

lang_help("lang_help", lang = "spanish", type = "text")

## End(Not run)


lang documentation built on June 5, 2026, 5:08 p.m.