Software
lang

lang

Uses LLMs to translate R help docs on the fly

lang is an R package that uses a large language model to translate R function help pages into other languages on the fly. It overrides the ? and help() functions so that translated documentation appears directly in the Help pane of RStudio or Positron.

The package supports both cloud LLMs via ellmer (e.g., OpenAI’s GPT-4o) and local models through Ollama, and it automatically detects the target language from your locale environment variables. Translations are cached within a session to avoid redundant API calls, and the cache location can be fixed to persist across sessions. To handle translation quality, lang summarizes the full help page first and uses that summary as context when translating individual sections, which helps the LLM produce more consistent results.

Contributors#