Repository navigation
docs(python): match the quickstart to the fixed SDK - #622
Open
Kevin-Liu-01 wants to merge 1 commit into
Open
Kevin-Liu-01 wants to merge 1 commit into
Kevin-Liu-01 wants to merge 1 commit into
Conversation
The Python pages described two SDK bugs as behavior: translations expiring after 60 s, and Flask ignoring the locales in gt.config.json. The quickstart also ran npx gt translate without --publish, so the CDN never had translations for the app to load. The quickstart now installs gt-flask>=0.3.1 or gt-fastapi>=0.3.1, runs npx gt translate --publish, and adds a step that checks a Spanish response. The configuring guide and the initialize_gt, I18nManager and gt.config.json references drop the two bug notes, describe the reload behavior, and document _branchId, a null cacheUrl, get_translations_blocking and load_all_translations_blocking. The page describes gt-flask and gt-fastapi 0.3.1, so it merges after that release is on PyPI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
The Python quickstart could not reach a translated response, and the reference pages described two SDK bugs as behavior:
t()falls back to the source text.localesargument, so the quickstart's app, which lists its locales ingt.config.json, never loads translations.cacheUrl, the CDN loader gets an empty base URL.npx gt translatewithout--publish, so the CDN never had translations for the app to load.gt-python 0.3.1 fixes the SDK bugs (generaltranslation/gt-python generaltranslation/gt-python#36 (
k/gt-i18n-cache-expiry) and generaltranslation/gt-python#37 (k/flask-fastapi-configured-locales)). These pages now describe that release:python/quickstart.mdx: installsgt-flask>=0.3.1orgt-fastapi>=0.3.1, says thatinitialize_gtloads the configured locales and reloads them in the background after 60 s, runsnpx gt translate --publishwith a note to enable the CDN first, and adds a step 6 that requests the app withAccept-Language: es. That step notes that Flask escapes non-ASCII characters in JSON and that Uvicorn serves on port 8000.python/guides/configuring.mdx: drops the two notes that described the bugs, describes the reload behavior and the empty-response rule, gives the CDN URL with the pinned version, and documents_branchIdand"cacheUrl": null.python/reference/classes/i18n-manager.mdx: documentsbranch_id, the CDN default and the emptycache_url, the newget_translations_blockingandload_all_translations_blocking, and whatget_translationsandget_translations_syncreturn after expiry.python/reference/config.mdx:cacheUrlisstring | nullwith the CDN as its default, the empty-base-URL note is gone, and_versionIdand the new_branchIdgive the CDN URL they produce.python/reference/functions/initialize-gt.mdx: eager loading uses the resolved locales on both frameworks, each request loads its configured locale, andcache_urldocuments the default and how to turn CDN loading off.Size: 5 files, +64/-28.
Decisions
>=0.3.1, because an older version still has the 60 s expiry, and a reader who already has 0.1.0 installed would otherwise keep it.--publish. Local files remain documented in "Storing translations locally", which the step 5 note links.Test plan
Run on this branch (
k/python-quickstart-loads-translationsat 6272fd4, on origin/main f93de7c), inscripts/afternpm ci:validate-links: all links validvalidate:unsafe-htmlandvalidate:callouts: 546 MDX files each, cleanvalidate:reference-links: 500 MDX files against 301 reference symbol aliases, cleanvalidate:structure,validate:blog-orderandvalidate:kb: cleantest: 7 scripts, 155 cases passedtypecheck: cleanjavascript:URLs in MDX finds nothing.Not run: the CI
build-contentjob, which builds the whole content app.Earlier, on the combined SDK fix: the quickstart's app, run exactly as these pages print it against a stand-in CDN, answered in Spanish.
Merge order
k/publish-missing-versions)).🤖 Generated with Claude Code