Geo-locale auto-detect
Edge-level language detection that routes visitors to the right localized storefront.
Overview
Katura serves storefronts in 24 languages. The right way to deliver them is to detect the visitor's preferred language at the edge, before any HTML is rendered, and route them to the localized URL β not to flash a default language and then re-render after a client-side check. K99's geo-locale layer does exactly that.
How detection works
- Request hits Vercel's edge in the visitor's nearest region.
- Edge middleware reads, in order: a
localecookie, theAccept-Languageheader, and the geo-IP country. - The first signal that maps to one of the 24 supported locales wins.
- If the visitor is on the bare path (
/,/products/...) the middleware issues a 308 redirect to the locale-prefixed URL (/es,/es/products/...). - If they're already on a locale-prefixed URL, no redirect β they get rendered immediately in that locale.
The locale cookie
We set a locale cookie the first time a visitor explicitly chooses a language from the language switcher. After that, the cookie wins over geo-IP β so a Spanish-speaker travelling in Germany still sees Spanish. The cookie has a one-year TTL and is per-host (so different stores can have different defaults).
SEO implications
- Every localized page emits
hreflangtags pointing at all 24 variants. - Each locale has its own canonical URL.
- Sitemaps are generated per-locale and submitted to Google Search Console.
- The redirect from the bare path to the locale path is a 308, which preserves PageRank.
Tip
If you don't want geo-routing on day one (e.g. you only sell in one country), set storefront.geoRoute = false in /admin/settings/i18n. Visitors will then always land on your default locale.
