v0.5.5
Highlights
-
CF-IPCountrynow decides the default locale on bare URLs — a TW visitor on an English-UI browser was sendingAccept-Language: en-US,en;q=0.9, the CLDR matcher locked it toenwith high confidence, andCF-IPCountry: TWnever got reached. Visitors saw the English surface even though the deployment is TW-market focused. v0.5.4 only fixed the explicit?lang=zhoverride path; this release fixes the default-detection path.Resolution chain is now
?lang=→CF-IPCountry→en. Accept-Language is no longer consulted. Trade-off: a Japanese tourist on a TW IP getszh-TWunless they say?lang=en— accepted in exchange for the local audience getting the right script by default.
Behavior delta
| Visitor | Before v0.5.5 | After v0.5.5 |
|---|---|---|
TW IP, Accept-Language: en-US,en;q=0.9, bare URL |
en (the bug) |
zh-TW |
TW IP, Accept-Language: zh-TW, bare URL |
zh-TW |
zh-TW |
US IP, Accept-Language: zh-TW, bare URL |
zh-TW |
en |
Any visitor, ?lang=… override |
unchanged | unchanged |
Other changes
LocaleDetectorno longer appendsVary: Accept-Languageto responses, removing CDN edge-cache fragmentation by rawAccept-Languagevalue.- Removed dead code from
internal/i18n/i18n.go:matchAcceptLanguage,matcherTags/matcherIndexToLocale/matcher,AcceptLanguageInfluenced,alInfluencedKey,headerVary/headerAcceptLanguage, and thegolang.org/x/text/languageimport. internal/i18n/i18n_test.gorewritten to pin the new contract: AL alone →en;AL + CF-IPCountry: TW→zh-TW;Vary: Accept-Languageis never emitted.docs/localization.mdupdated: 3-step negotiation table, new "Why Accept-Language is not consulted" subsection, removed Cloudflare-normalization advice (no longer relevant).
Container image
ghcr.io/cmj0121/imagelet:0.5.5