Skip to content

Docs written in another language: required headings, changelog marker, decision status and text metrics assume English #644

Open

Description

@raccioly

Summary

DocGuard 0.47.0 runs cleanly on documentation written in Portuguese: no errors, and FR-001 style requirement ids inside Portuguese sentences are recognized with file and line. But every structural label it looks for must be in English. A team that writes its docs in another language gets warnings it cannot clear without switching those labels to English, and in a strict setup (warnings as failures) they block.

Measured with a throwaway project, once with DocGuard's own headings left in English and once with them translated.

What happens

Input Result
Portuguese prose with accents inside sections Works, no finding
FR-001 inside a Portuguese sentence Recognized
## Visão geral do sistema in place of ## System Overview (same for Tech Stack, Component Map, Test Categories, Coverage Rules) Warning per section: missing section "## System Overview"
A spec with ## Requisitos funcionais and ## Feito quando Warnings: missing mandatory section User Scenarios, Requirements, Success Criteria; no SC-001 ids found
## [Não lançado] in CHANGELOG.md Warning: missing [Unreleased] section
**Status:** Aceito in a decision record Warning: status "Aceito" is not proposed, accepted, rejected, deprecated or superseded
Text-quality metrics (passive voice, negation, conditional, compound requirement) The patterns are English word lists (doc-quality.mjs), so the numbers are not meaningful for non-English text, and nothing says so

Minimal reproduction

mkdir ptbr && cd ptbr && git init -q
mkdir -p src docs/adr specs/001-exemplo
echo 'export function soma(a, b) { return a + b; }' > src/soma.js
echo '{"name":"ptbr","version":"0.1.0","type":"module"}' > package.json
docguard init --yes && docguard generate --plan --write

Then translate the generated ## headings in docs-canonical/ARCHITECTURE.md and docs-canonical/TEST-SPEC.md, add a spec whose sections are ## Problema, ## Requisitos funcionais (with FR-001), ## Feito quando, add docs/adr/0001-exemplo.md with **Status:** Aceito, and run docguard guard --format json.

Observed: WARN, 0 errors, with the warnings in the table above. With the English headings restored and Spec ID, User Scenarios & Testing, Requirements, Success Criteria and SC- ids used in the spec, the section warnings disappear while the body stays in Portuguese.

Workaround today

Keep the structural labels in English and write everything else in the team's language. It works, but it has to be discovered by trial.

Suggested changes

  1. Heading synonyms per language. A language (or headingAliases) setting in .docguard.json, with built-in sets for pt-BR and es to start, so ## Visão geral do sistema satisfies System Overview. The existing <!-- docguard:section system-overview … --> marker suggests an id-based anchor would also work: accept <!-- docguard:section system-overview --> under a heading in any language.
  2. Spec sections. The same aliases for the Spec Kit mandatory sections.
  3. Changelog marker. Accept a configured or aliased equivalent of [Unreleased].
  4. Decision status. Extend SYNONYM in decision-records.mjs with translated status words (aceito, proposto, rejeitado, obsoleto, substituído, and the Spanish forms), or make the map configurable.
  5. Text metrics. Detect or accept the document language, and when the word lists do not cover it, skip those metrics and say they were skipped instead of reporting a number.
  6. Docs. Until then, one paragraph in the README (and in README.pt-BR.md / README.es.md) stating which labels must stay in English.

Environment

DocGuard 0.47.0, Node, macOS. Not tested: WebSec Validator and TestGuard with non-English docs.

Activity

  1. raccioly commented on Nov 12, 2026

    @raccioly
    OwnerAuthor

    Triage: confirmed against the code, and accepted. Every row in the table matches what 0.47.0 does.

    One thing the code adds to the report: the heading matcher normalizes a heading by keeping only a-z0-9 (normalizeHeadingText in cli/shared.mjs), so accented letters are dropped before any comparison. Visão geral becomes vis o geral. Translated synonyms alone would not match until that normalization handles Unicode letters.

    Planned shape, to be written as its own spec after the strict-by-default work (#637) lands, because both touch the same validators:

    1. Language-neutral section ids first. <!-- docguard:section system-overview --> under a heading in any language satisfies the required section. No word list, works for every language, and the generators can write the id.
    2. Built-in aliases for pt-BR and es (the two languages the README ships in), plus a headingAliases setting for others, with Unicode-aware normalization.
    3. The same aliases for the Spec Kit section names; FR-/SC- ids already work in any language.
    4. An accepted equivalent of [Unreleased], and translated decision-status words.
    5. Text metrics say when they do not apply. With a language setting (or detection), a metric whose word list does not cover the language reports "not measured" with the reason, never a number. This is the same rule spec(097): strict by default #637 applies to validators: a check that examined nothing must not read as a result.

    Item 6 (say in the READMEs which labels must stay in English) is being done now as a documentation-only PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions