Skip to content

ci(i18n): enforce translator hint conventions - #9364

Open
vitormattos wants to merge 5 commits into
fix/clarify-document-approval-ux-20261104from
fix/translator-hints-policy-20261104
Open

vitormattos wants to merge 5 commits into
fix/clarify-document-approval-ux-20261104from
fix/translator-hints-policy-20261104

Conversation

@vitormattos

@vitormattos vitormattos commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Apply one consistent LibreSign convention for translator hints across the frontend and PHP backend, fix ambiguous translation calls, and prevent repeated or malformed hints in CI.

Depends on #9360. That PR corrects the approval workflow and removes the triplicated hints on the Approved and Pending filters. This follow-up standardizes the rest of the project and protects the convention automatically.

LibreSign convention

  • Use // TRANSLATORS Explain the context. in JavaScript, TypeScript and PHP, or <!-- TRANSLATORS Explain the context. --> in Vue templates.
  • No colon after the TRANSLATORS marker. This is a LibreSign code-style decision; Nextcloud supports the optional punctuation.
  • Use one context hint immediately before each relevant t() or n() call. Never repeat hints consecutively above a single translation.
  • Split conditional or nested translation calls into distinct source lines so each message can receive its own context.
  • When the same text is translated at different call sites, separate hints are acceptable if each is attached to a different translation call.

Changes

  • Normalize 42 remaining translator hints in Vue/TypeScript/PHP code to the project's colonless convention. Six hints and four duplicated comments are corrected in the prerequisite fix(approval): clarify document review and sign-off #9360.
  • Preserve the earlier refactor of 13 ambiguous same-line translation sites (document validation, envelopes, policy dialogs, filters, accessible labels).
  • Extend scripts/check-translator-hints.mjs and its existing npm run lint CI integration to block:
    • multiple LibreSign translations on one source line;
    • a colon immediately after the TRANSLATORS marker;
    • consecutive translator hints above a single translation.
  • Check tracked Vue/JS/TS/PHP sources under src, lib, appinfo, tests, and scripts (excluding the checker's own deliberately malformed test fixtures and generated OpenAPI types).
  • Add regression tests for the exact three identical hints reported on the approval filter, malformed colon punctuation, and legitimate independent translation calls.
  • Keep CONTRIBUTING.md and AGENTS.md as brief pointers to the canonical developer-manual Translation page, maintained by LibreSign/documentation#124. Remove the duplicated tutorial from the application repository.

Documentation dependency: LibreSign/documentation#124 contains the complete contributor explanation, with rendered screenshots and a warning-free Sphinx build. The automated checker stays in this LibreSign application PR.

Validation

  • node --test scripts/tests/check-translator-hints.test.mjs: 8 tests passed.
  • node scripts/check-translator-hints.mjs: passed across tracked application sources.
  • npm run ts:check: passed.
  • php -l for each of the five affected PHP files using the Nextcloud development container: passed.
  • npm run lint: passed (pre-existing non-blocking lint warnings only).
  • Existing focused Vitest comparison: 247 passed, 23 baseline failures reproduced identically on the unchanged parent; not introduced by the translator-hint changes.

Scope: Comments, contributor guidance, localization call organization and CI safeguards. No generated translation catalog changes, new dependencies or modifications to signing behavior. No squash or merge requested.

@vitormattos
vitormattos requested a review from a team as a code owner November 5, 2026 02:53
@vitormattos vitormattos changed the title ci(i18n): document translator hints and reject ambiguous calls ci(i18n): enforce translator hint conventions Nov 5, 2026
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos
vitormattos force-pushed the fix/translator-hints-policy-20261104 branch from 6427634 to fcf0aaa Compare November 5, 2026 14:52

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant