fix(localization): don't load manifest.json as a locale - #1821
Merged
Conversation
manifest.json lists the supported languages; it is metadata rather than a
translation catalog. go-i18n derives a locale from the file name, so loading
it registers the file under language.Und. A request whose highest priority
Accept-Language tag is "und" then matches that entry instead of falling back
to English, the message is missing from it, and MustLocalize panics:
http: panic serving: message "making_sure_not_bot" not found in language "und"
Skip manifest.json when populating the bundle. Other unusual tags (und-US,
mul, zxx, and unknown subtags such as xx) already fell back correctly; only
the exact zero tag was affected.
The test asserts through T() rather than GetLang(): GetLang() swallows the
lookup error and reports "en" either way, so a test built on it would pass
both with and without this change.
Fixes TecharoHQ#1776
Assisted-by: Claude Opus 5 via Claude Code
Signed-off-by: Sihyeon Jeon <[email protected]>
Contributor
|
Just wondering so I can investigate further, but are you seeing bots passing the und language tag? |
Xe
approved these changes
Aug 6, 2026
Contributor
Author
|
No, I found it in the issue tracker and reproduced it locally. The traffic report is @Commod0re's in #1776. Only a bare |
Xe
approved these changes
Aug 6, 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.
Accept-Language: undpanics the challenge handler.NewLocalizationServiceloads everylocales/*.jsoninto the bundle, includingmanifest.json. go-i18n derives a locale from the file name, somanifest— which is not a language tag — registers underlanguage.Und. A request whose highest priority tag isundthen matches that entry instead of the"en"fallback appended inGetLocalizerFromRequest, the message is missing from it, andMustLocalizepanics:Skipping
manifest.jsonwhen populating the bundle removes the bogus locale. Other unusual tags already fell back correctly —und-US,mul,zxx,qaa, and unknown subtags such asxx— only the exact zero tag was affected.The test asserts through
T()rather thanGetLang()on purpose:GetLang()swallows the lookup error and reports"en"either way, so a test built on it would pass with and without this change. Reverting onlylocalization.gomakes it fail with the panic above.Fixes #1776
Checklist:
[Unreleased]section of docs/docs/CHANGELOG.mdnpm run test:integration(unsupported on Windows, please use WSL)npm run test,go vet ./...andstaticcheckall pass. I could not get the Playwright harness up locally:TestPlaywrightBrowserfails withcould not connect to remote browser: Connection closedon unmodifiedmainas well, so it looks environmental rather than related to this change.