<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title id="root">Translate documentation</title>
  <status stage="doc" state="work" audience="author"/>
  <p p="1">A translation is a separate package in the same shape as the original: same pages, same section names, same examples by reference, in another language. This page creates one and explains what makes it official.</p>
  <prompt id="translate-documentation" p="2">
    Create the package org.acme/notes-flow-docs-ru in the current VibeVM project, as an in-tree package under vibevm/vibepacks/, as the Russian translation of org.acme/notes-flow-docs. Mirror its page tree file for file, keep every anchor and block, and replace each example with a reference to the source example. Write the manifest with [translates] and the same [[documents]] subject. Run vibe doc check --translations.
    <needs>the vibevm skill installed for your agent; the source documentation package in the same project</needs>
    <outcome>the translation has the same files and anchors as the source, `[i18n] canonical = "ru"`, `[translates]` pointing at the source, and `vibe doc check --translations` reports no structural difference</outcome>
    <assert>grep -q "canonical = \"ru\"" vibevm/vibepacks/org.acme/notes-flow-docs-ru/v0.1.0/vibe.toml</assert>
    <assert>vibe doc check --translations --path vibevm/vibepacks/org.acme/notes-flow-docs-ru/v0.1.0</assert>
  </prompt>
  <section id="what-happens" title="What happens">
    <p p="3">The agent copies the source's page tree and translates the prose of each block in place, without adding or removing a block. It replaces every `example` with `example ref="&lt;id&gt;"` pointing at the source's example. It sets the package language, names the source in `[translates]` and the same [subject](../glossary/index.xml#subject) in `[[documents]]`. `vibe doc check --translations` then compares the two trees: the same paths, the same [anchors](../glossary/index.xml#anchor), the same number and kinds of blocks; a difference is an error. The site, seeing a `translates` edge from a package in the source's group named `&lt;source&gt;-ru`, shows the translation as official and offers it in the language selector.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#LOC-MIRROR" p="4"/>
  </section>
  <section id="the-manifest" title="The manifest">
    <p p="5">The language of the package is the existing `[i18n] canonical` field, a BCP-47 tag in lower case; there is no separate language field. `[translates]` names the source and a version range; `[[documents]]` repeats the source's subject, and vibe checks that the two agree.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#LOC-LANGUAGE-FIELD" p="6"/>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#LOC-DOCUMENTS-MATCH" p="7"/>
    <p p="8">The name `&lt;source&gt;-&lt;lang&gt;` in the source's group is what makes the translation official by default. A translation from another group is found and shown as a community translation, with its publisher.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#LOC-OFFICIAL-TRANSLATION" p="9"/>
    <p p="10">The default name of a translation is the documentation's name with the language tag in lower case, `vibevm-docs-ru` or `vibevm-docs-pt-br`, in the same group.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#COMPANION-TRANSLATION-NAME" p="11"/>
  </section>
  <section id="the-rules" title="The rules of a translation">
    <p p="12">A translation follows the source block for block, not sentence for sentence: within a block the translator writes what a native editor would write, replaces a joke with one that works in the language or drops it, and follows the glossary of the translation. It never authors examples: an example's output is checked once, on the source, and a translation points at it. It never adds an anchor, because a link into the source must land on the same block in every language, which is also what lets the reader switch languages without losing the place.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#LOC-EXAMPLE-REF" p="13"/>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#READER-LANGUAGE-SWITCH-KEEPS-PLACE" p="14"/>
    <p p="15">Rules quoted from a [specification](../glossary/index.xml#specification) stay in the specification's language, marked as such; translating normative text is not part of a documentation translation.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#LOC-NORMATIVE-STAYS" p="16"/>
  </section>
  <section id="staleness" title="When the source moves">
    <p p="17">A translation records no revision or hash of the source. When the source changes, the structural check still passes as long as the shape did, and whether the translation's meaning lags is a human's question, answered at the periodic reconciliation and shown on the page as the date it was last read. The site shows a page that has no translation yet in the source language under the translation's address, with a note, never as missing.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#LOC-NO-REVISION" p="18"/>
  </section>
  <section id="edge-cases" title="Edge cases and rules">
    <p p="19">Sidecar files inside the source package, `README.ru.md` beside `README.md`, are how specifications carry translations; documentation does not use them, because a manual's translation has its own author and its own rhythm.</p>
    <rule ref="spec://org.vibevm.core/vibevm/modules/vibe-resolver/PROP-003#I18N-DOC-PACKAGES" p="20"/>
    <p p="21">A translation inherits the source's images unless it declares its own.</p>
    <rule ref="spec://org.vibevm.core/vibevm/common/PROP-057#CARD-TRANSLATION-INHERITS" p="22"/>
  </section>
</spec>
