refactor(www): stabilize locale routing#16402
Open
akronb wants to merge 4 commits intoanomalyco:devfrom
Open
Conversation
Contributor
Author
|
@adamdotdevin could you take a look? |
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.
Issue for this PR
Closes #16278, closes #15984, closes #15194, closes #15904, closes #14997, closes #14409
Type of change
What does this PR do?
This PR fixes the docs locale architecture introduced in #12508, which made routing dependent on ambient locale state and treated English as a special-case root path. Rather than continuing to patch symptoms (#13109, #13608), this change addresses the root cause: docs URLs are now path-authoritative, English is promoted to an explicit
enlocale.Key changes:
defaultLocale: "root"todefaultLocale: "en"packages/web/src/content/docs/en/packages/web/src/lib/docs-locale.tswebmiddleware to:/docs->/docs/<locale>//docs/<slug>->/docs/<locale>/<slug>/docs/...to/docs/en/...oc_localeconsoledocs routing by centralizing proxy logic inpackages/console/app/src/lib/docs.tsHow did you verify your code works?
I verified this with targeted regression tests and package checks:
packages/console/app/test/language.test.tspackages/web/test/middleware.test.ts, including English, non-English, legacy root, and unknown locale-like pathsbun test test/language.test.tsinpackages/console/appbun test test/middleware.test.tsinpackages/webbun run astro checkinpackages/webbun run typecheckinpackages/console/appI also verified that the docs sync workflow and docs/translator agent references now point at the new English docs source path under
packages/web/src/content/docs/en/.Checklist
If you do not follow this template your PR will be automatically rejected.