Skip to content

docs(quickstarts): fix first-run failures on the python, react, cli, and node pages#391

Merged
JoshKappler merged 4 commits into
mainfrom
docs-python-quickstart
Jul 20, 2026
Merged

docs(quickstarts): fix first-run failures on the python, react, cli, and node pages#391
JoshKappler merged 4 commits into
mainfrom
docs-python-quickstart

Conversation

@JoshKappler

@JoshKappler JoshKappler commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Type: fix. One PR, four quickstart pages, seven files. Each change closes a reproducible first-run failure found by walking all nine quickstarts end to end in clean sandboxes and re-verifying every finding in a second pass. This started as four single-page PRs; #392, #393, and #394 are folded into this one, which began as the python PR. Combined so the review is one sitting instead of four.

These pages were created in the #354 docs refactor merged July 16 and had not been walked end to end yet. The docs bots do mechanical sync and grammar passes (open PR #390 is a grammar-only edit that also touches one of these pages), so first-run defects survive them.

Python quickstart (docs/en-US/python/quickstart.mdx)

  • The version callout says gt-i18n, gt-flask, and gt-fastapi "are all at version 0.3.0". PyPI's latest for all three is 0.1.0; 0.3.0 was never published. Dropped the hardcoded number rather than pin a new one, kept what the callout is for: experimental SDK, Python 3.10+.
  • Step 5 runs gt translate, but gt is the Node CLI and the page only ever runs pip install. Following the page as written gives command not found: gt. Fixed to npx gt translate with a note linking the CLI quickstart.
  • The Flask and FastAPI samples define app but the page never starts the server. Added run commands inside each tab: flask --app app run, and uvicorn main:app with the pip install "uvicorn[standard]" line it needs (gt-fastapi does not pull in an ASGI server).
  • Added one sentence that placeholder credentials return source-language strings by design, so nobody files that as a bug.

React quickstarts (4 pages): missing _gt files break the first run

loadTranslations imports _gt/${locale}.json before anything on the page has created those files; npx gt generate is only mentioned later, inside a collapsed accordion. Symptom verified per page, twice, in clean sandboxes:

  • Next.js App Router: first npm run dev returns HTTP 500. Empty {} stubs flip it to 200 with no other change.
  • TanStack Start: default locale renders, but the first language switch returns HTTP 500.
  • React Native: Metro refuses to bundle at all until the files exist.
  • Next.js Pages Router: loader has a try/catch, so it degrades to a build warning and untranslated content.

The change is one callout per page at the point the failing code is introduced, stating that the files do not exist yet, how to create them, and the exact symptom for that page. Three pages get a Warning; the Pages Router page gets a Note because nothing breaks there. Pure insertions, no steps reordered.

CLI quickstart: non-interactive setup for CI (docs/en-US/cli/quickstart.mdx)

Step 4 tells readers to run gt translate in their CI pipeline, but the setup step cannot run in CI: gt init only prompts, and npx gt init < /dev/null exits 0 without writing gt.config.json or credentials, so a CI script sees a false success. Added a warning callout at step 2, a "Non-interactive setup for CI" section (minimal hand-written gt.config.json, the GT_API_KEY and GT_PROJECT_ID env vars, npx gt translate --config gt.config.json), and fixed the step 3 code block title from .env to .env.local, which is what the wizard writes. Every flag, filename, and config field checked against the CLI source in packages/cli.

Node quickstart: not completable as written (docs/en-US/node/quickstart.mdx)

npm init -y writes "type": "commonjs", so the page's first ESM sample fails with SyntaxError: Cannot use import statement outside a module. Beyond that: express is imported but never installed, no block calls app.listen and no step runs the server, and npx gt translate dead-ends without the config or credentials the page never creates. Added the "type": "module" note in step 1, express in all four package-manager tabs, app.listen plus a "Run and verify" step (node server.js, a curl, and the expected response), a one-line note to run npx gt init before the translate step, and fixed code fences tagged ts on plain-JS blocks. Verified by scaffolding the page from scratch and curling the running server: HTTP 200 with {"message":"Hello, Alice!"}.

Verification

Run on the combined branch: validate:unsafe-html (418 MDX files) pass, validate-links pass, pnpm build:content pass (434 pages, all four quickstarts render). The four commits are the original reviewed commits, one per source PR, cherry-picked unchanged; the file sets are disjoint. All four react files merge-checked against the open bot PRs touching them (#381, #383, #390, #372).

Coordination with #389

Draft #389 rewrites the Node page's step 2 (credentials), blocked on a gt-node release. This PR leaves step 2 untouched, including its one ts fence, since #389 is actively rewriting that block. Merge-order note: the new "Run and verify" step expects a source-string echo, which is correct on current main; when #389 lands its real dev key, that expected output needs a one-line follow-up in either merge order.

If any of this was deliberate

Each section keeps its escape hatch. Python: if the packages are versioned on a private index where 0.3.0 is real, I will reword the callout to point there instead. React: if the intent is that readers reach generate before running, I can rescope to reordering steps instead of callouts. CLI: if CI setup belongs in the Configuring guide, I can move the section there and leave a callout and link. Node: if the page assumes an existing Express app, I can rescope to state that assumption up front. Say the word on any of them.

@JoshKappler JoshKappler changed the title docs(python): fix quickstart version claim, CLI invocation, and run instructions docs(quickstarts): fix first-run failures on the python, react, cli, and node pages Jul 20, 2026

@pie575 pie575 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow

@JoshKappler
JoshKappler merged commit e64c0f9 into main Jul 20, 2026
7 checks passed
@JoshKappler
JoshKappler deleted the docs-python-quickstart branch July 20, 2026 21:45
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.

2 participants