mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #4100] [MERGED] Add Documentation Language selector with downloadable language pack (first pack: Spanish) #6234
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6234
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4100
Author: @kolacheee
Created: 7/25/2026
Status: ✅ Merged
Merged: 7/25/2026
Merged by: @SpicyMarinara
Base:
staging← Head:agent/docs-language-es📝 Commits (9)
4023dfdAdd Documentation Language selector with per-file English fallbacka2a3ce5Add Spanish (es) translations for all user-facing docs6597c02Rework Documentation Language to download-on-demand packs12195c8Harden docs pack switching from second review round04bb884Auto-refresh the selected docs pack after Engine updates039186fRender indented code fences correctly in shared markdown3717caaAdd Documentation Language feature to the changelog5a8a400Merge remote-tracking branch 'origin/staging' into agent/docs-language-es5d3e93cReference #4100 in the changelog entries📊 Changes
22 files changed (+1782 additions, -48 deletions)
View changed files
📝
.github/pull_request_template.md(+1 -0)📝
AGENTS.md(+1 -0)📝
CHANGELOG.md(+3 -0)📝
CLAUDE.md(+1 -0)📝
CONTRIBUTING.md(+8 -0)📝
docs/CONFIGURATION.md(+1 -0)📝
docs/UPGRADING.md(+2 -0)📝
package.json(+2 -1)📝
packages/client/src/components/modals/DocsViewerModal.tsx(+63 -12)📝
packages/client/src/components/onboarding/OnboardingTutorial.tsx(+99 -4)📝
packages/client/src/components/panels/SettingsPanel.tsx(+156 -0)➕
packages/client/src/hooks/use-docs-language.ts(+99 -0)📝
packages/client/src/hooks/use-docs.ts(+40 -14)📝
packages/client/src/lib/markdown.tsx(+11 -2)📝
packages/client/src/localization/locales/en.json(+23 -0)📝
packages/server/src/routes/docs.routes.ts(+370 -15)➕
packages/server/src/services/docs/docs-pack.service.ts(+483 -0)➕
packages/shared/src/constants/docs-languages.ts(+30 -0)📝
packages/shared/src/index.ts(+1 -0)➕
scripts/docs-i18n/build-manifest.mjs(+82 -0)...and 2 more files
📄 Description
Why
International users currently get English-only in-app guides. This PR adds a Documentation Language setting (Settings › General, plus a final step in the onboarding tutorial) with download-on-demand language packs, and ships the first full translation: Spanish, covering all 123 guides (developer docs included, so non-English-speaking contributors can build PRs and extensions too).
Packs live on the companion
docs-i18norphan branch — never in user checkouts. Launchers only fetchmain/stagingand the installer clones a single tag, so translations add zero checkout/image size: important for Termux and thin-client installs as FIGS(P)/CJK land later (~1.3 MB per language ≈ 13 MB at ten languages, downloaded at most once by the users who want it).How it works
docs-i18nintoDATA_DIR/doc-packs/<lang>— manifest first, then every file verified against a sha256 + byte size, written to a temp dir, atomically swapped in — then the setting flips and the replaced language's pack is deleted (only one downloaded language on disk, ever). English is built-in and never downloaded or deleted. Live progress (n/123 files) shows in the button while downloading.safeFetch(https-only, reserved/private-IP blocking — theDOCS_I18N_BASE_URLoverride for forks/mirrors can't become an SSRF vector), downloads are gated to the static supported-language list, and manifests get archive-grade path validation (traversal, Windows drive/ADS colons, case-folded duplicates, size caps)..tmp-/.old-folders that are swept at startup, install start, and Fix. A half-written pack can never serve: the manifest lands last and marks a pack installed.docker compose pull. A new English doc that the pack doesn't cover yet simply serves in English with anENbadge (per-file fallback) — features are never blocked on translations.docs-i18nmanifest and re-downloads it if the translations changed; a stored choice whose pack is missing (downgrade, data restore) is restored the same way. Offline boots keep the installed pack serving and retry next start (documented in UPGRADING.md).Drive-by fix
The shared markdown renderer accepted an indented code-fence opener but not an indented closer, so fences nested inside list items (e.g.
docs/development/architecture-map.md§ Migration rules) never closed and rendered their```markers as literal text. Close detection is now symmetric and, per CommonMark, the opener's indent is stripped from content lines so list-nested blocks don't render or copy phantom leading spaces. Column-zero fences (all chat content) are unchanged by construction.New API surface
GET /api/docs,/search,/content: optional?lang=, additivelanguagefields;rootnow reports the active language's on-disk folder.GET /api/docs/language— active/configured, supported languages with installed + coverage state, install progress (client polls at 1s during downloads), integrity flags. Never hashes on this path (cheap stat checks only).PUT /api/docs/language— validated switch; downloads when needed (400 unsupported / 409 install-in-progress / 502 download-failed).POST /api/docs/language/fix— the failsafe described above.DOCS_I18N_BASE_URL(documented in CONFIGURATION.md) for forks/mirrors.Validation done
pnpm checkgreen; reworkedpnpm regression:docslane (fixture pack in a temp DATA_DIR): two-root containment + traversal, manifest path-safety (zip-slip equivalents, case-folded dupes, size caps), truncation detection, build-manifest determinism, and a pinned invariant that doc content never renders viadangerouslySetInnerHTML(downloaded packs are less-trusted than in-repo docs).raw.githubusercontent.comrequest path.Summary by CodeRabbit
New Features
Bug Fixes
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.