← Back to all sparks
L

lang

ANALYTICS
Velocity0.0

Uses LLMs to translate R help docs on the fly. Contribute to mlverse/lang development by creating an account on GitHub.

R help pages translated on demand by whichever LLM you point it at.

llmlocalizationdocumentationr-packagedeveloper-experience
Current state
lang translates R help documentation at read time using a language model of the user's choosing, rendering the result directly in the RStudio or Positron help pane rather than producing translated files. The two releases since launch have both targeted translation quality rather than reach: 0.1.1 added a context_size argument that summarizes the full help page and injects it into every field's prompt so terminology stays consistent across sections, and rewrote Rd parsing around a structured intermediate representation instead of regex. Version 0.1.2 then made that context conditional, omitting it for inputs of ten words or fewer.
Where it's heading
The work is converging on the failure modes specific to running documentation translation through a model rather than a translation service. The Rd rewrite through rd_to_list() and list_to_rd() removes a class of formatting corruption that regex manipulation invited. The context-window tuning addresses the opposite problem — a local model handed a context summary longer than the field it is translating paraphrases the context instead. Both fixes are about making small, weaker, locally hosted models behave, which suggests that is the deployment the package expects.
Prediction
Given that both post-launch releases tune prompt construction for local models, expect further per-field prompt heuristics rather than new output targets.

Recent moves

  1. 2mo ago

    Context summary dropped for very short fields

    Omits the context summary from the translation prompt when the input runs ten words or fewer. The failure it fixes is specific to local models: handed a context far longer than the field itself, they paraphrase the context rather than translating the input. A direct walk-back of the feature 0.1.1 introduced, applied where it hurt.

    View source ↗
  2. 2mo ago

    Page-level context injection and structured Rd parsing

    Adds context_size to lang_use() and lang_help(), generating a short summary of the whole help page and injecting it into each field's prompt so terminology stays consistent across sections, defaulting to 100 words. Rd parsing moves from regex text manipulation to a structured intermediate list via rd_to_list() and list_to_rd(), removing a class of formatting edge cases.

    View source ↗
  3. 9mo ago

    R help pages translated live in the IDE help pane

    ⚡ SPARK

    The initial release: R documentation translated on the fly by a user-chosen language model, surfacing in the RStudio and Positron help panes. It makes translation a read-time property of the reader's session rather than something package authors or translators have to produce and ship.

    View source ↗