English · Русский Plain GeoIP shows a Ukrainian in Warsaw a Polish page, and someone on a US VPN an English one. Sherlang reads the person instead — browser languages, installed keyboards, typed script letters, the device clock, real diaspora data, and 25 IP mirrors. Sure? It switches silently. Unsure? It asks in their most likely language. Text overview of the hero banner and key numbers (accessible version)…
Deduces the interface language your visitor actually wants — from browser languages, keyboard layouts, timezone, IP mirrors and VPN tells. Probabilities, not guesses.
Plain GeoIP shows a Ukrainian in Warsaw a Polish page, and someone on a US VPN an English one.
Sherlang reads the person instead — browser languages, installed keyboards, typed script letters, the device clock, real diaspora data, and 25 IP mirrors. Sure? It switches silently. Unsure? It asks in their most likely language.
Text overview of the hero banner and key numbers (accessible version)
Headline numbers:148 languages with endonyms and smart fallbacks · 1,515 diaspora routes across 250 countries · 25 IP mirrors with parallel quorum and failover · 58 KB gzipped with all world data and 0 runtime dependencies.
Asymmetric literacy: Ukrainians read Russian, Russians rarely read Ukrainian — so ru + uk keyboards mean Ukrainian, while ru alone means Russian.
Diasporas, not borders: ~1M Ukrainians in Poland, Turks in Berlin, Brazilians in Lisbon, Belarusians in Vilnius.
Sees through VPNs: Datacenter exits, clocks set to match the VPN, iCloud Private Relay, Starlink gateways, roaming SIMs, and Tor are read honestly.
Keyboards that talk: Installed layouts plus telltale typed letters (ї, ы, ą, ß) — never the text itself, never password or card fields.
Asks, never guesses: Under 80% confidence, shows a clean two-option card written in the visitor’s most likely language.
Before vs After One Ukrainian in Warsaw, two completely different outcomes — real engine output.
20 Real Cases Expats, VPNs, Starlink, roaming SIMs, and bots — tested against plain GeoIP.
Live Passport Lab Open 20 staged travellers or click Use my device right in your browser.
How It Thinks The five human rules that beat every IP-to-language lookup table.
Quick Start Five lines in JS, one <script> tag without a bundler, plus AI agent skills.
Before vs After
Same visitor, same second. Plain GeoIP looks up an Orange Polska IP, stamps Polski, and stops thinking. Sherlang spots the Ukrainian layout next to Polish, weighs the ~1M Ukrainian diaspora in Poland, treats Polish as the country’s language rather than the person’s comfort zone, and asks politely — in Ukrainian:
Exact input signals and raw engine verdict
analyze({languages:['pl-PL','pl','uk','en-US','en'],layouts:['pl','uk'],timezone:'Europe/Warsaw',ip:{country:'PL',type:'residential',org:'Orange Polska S.A.',asn:5617},},{supported:['en','uk','ru','pl','de']});// language: 'uk', confidence: 0.62, ask: true// options: Українська 62% · Polski 31%// origin: Ukraine 86% · Poland 14% location: Poland 100%// reasons: Keyboard: pl, uk → Ukraine ×13 vs Poland// Browser languages pl-PL, pl, uk, en-US, en → Ukraine ×11 vs Poland// Polski is the local language of Poland: readable, rarely the comfort zone
Three Visitors, One US Clock
The hardest traffic on the internet: US IP, US device clock, and nothing useful in the browser language list. Plain GeoIP forces English on all three. A VPN subscription can fake your IP and timezone — it cannot hide the keyboard installed on your laptop. And because language knowledge is asymmetric, adding a single Ї key flips the entire verdict:
The Cases
Every bar and number below is live output from analyze() on the 20 built-in lab travellers — locked down by npm test (38/38 green):
Visitor
Plain GeoIP
Sherlang
Ukrainian in Warsaw (pl-PL browser, pl + uk keys, Orange Polska)
Forces Polish
Asks Українська 62% / Polski 31% (origin UA 86%, in PL 100%)
Russian on a US VPN (M247 datacenter, New York clock, ru keys)
Forces English
Русский 86%, switches automatically
Ukrainian on the same VPN (same clock, ru + uk keys)
Forces English
Українська 83%, switches automatically (origin UA 90%)
Starlink near the front (gateway in Poland, Kyiv clock)
Forces Polish
Українська 89%, knows they are in Ukraine (94%)
Moscow behind Aeza (Dutch datacenter owned by a Russian host)
Forces Dutch
Русский 92%, knows they are in Russia (100%)
Tehran behind Hetzner NL (Dutch datacenter, Persian browser & keys)
Forces Dutch
فارسی 92%, switches automatically
Brazilian in Lisbon (pt-BR browser, Portuguese residential IP)
Forces pt-PT
Asks Português (BR) 73% / pt-PT 18%
Taipei (zh-TW browser, Zhuyin layout)
Generic “Chinese”
繁體中文 92%, never falls back to Simplified
All 20 lab travellers side-by-side with plain GeoIP
Visitor
Plain GeoIP
Sherlang
Ukrainian in Warsaw (pl-PL, pl + uk, Orange Polska)
Polish
Asks Українська 62% / Polski 31% (origin UA 86%)
Ukrainian at home in Chicago (Comcast, en-US, ru + uk)
English
Asks English 49% / Українська 45% (respects chosen EN browser)
Belarusian in Vilnius (Russian browser & keys, Lithuanian IP)
Lithuanian
Русский 89%(origin Belarus 61%, in Lithuania 99%)
Brazilian in Lisbon (pt-BR, Portuguese residential IP)
pt-PT
Asks pt-BR 73% / pt-PT 18%
Turkish-German in Berlin (de-DE, tr, de + tr, Telekom)
German
Asks Deutsch 49% / Türkçe 47%
Indian in Dubai (en-IN, hi, UAE residential IP)
Arabic
English 100%(origin India 98%, in UAE 100%)
Russian on a US VPN (M247 datacenter, NY clock, ru)
English
Русский 86%, auto
Ukrainian on the same VPN (M247 datacenter, NY clock, ru + uk)
English
Українська 83%, auto (origin UA 90%)
Moscow behind Aeza (Dutch datacenter of a Russian host)
Dutch
Русский 92%, physically in Russia 100%
Shanghai behind AWS US (US datacenter, Shanghai clock)
English
简体中文 98%, auto
Tehran behind Hetzner NL (Dutch datacenter, Persian clues)
Dutch
فارسی 92%, auto
iCloud Private Relay (Safari, Germany)
Sometimes wrong city
Deutsch 99% — a relay keeps the region honest, not a VPN
Tor Browser (all signals spoofed to en-US / UTC)
Exit-node language
Never guesses — opens the chooser with the full language list
Русский 88%, auto (respects explicit Russian choice)
Taipei (zh-TW, Zhuyin layout)
“Chinese”
繁體中文 92%, never Simplified
Roaming SIM (Kyivstar UA IP, Warsaw clock)
Ukrainian by luck
Українська 88%, knows they are physically in Poland 99%
Starlink near the front (Poland gateway, Kyiv clock)
Polish
Українська 89%, physically in Ukraine 94%
Googlebot (US AWS datacenter, crawler UA)
Whatever
Default language quietly — zero popup, zero redirect
Try It Live: The Passport Lab
Open the interactive Passport Lab to stage any of the 20 travellers, toggle keyboards and VPNs in real time, or hit Use my device to see what Sherlang deduces from your own browser (or run it locally with npm run demo):
How It Thinks
Every visitor is scored across pairs of (where they are from × where they are right now) using real diaspora counts, network classification, and five human rules that no IP table understands:
IP and clock are always judged together. A datacenter IP whose clock matches the exit city is still a datacenter VPN; a roaming SIM points home while its clock gives away the current country; iCloud Private Relay preserves the real region; and a Dutch server owned by a Russian host (like Aeza) is recognized for what it is.
The Smart Chooser
When confidence is 80% or higher, Sherlang switches immediately and gets out of the way.
Below 80%, it refuses to gamble. It opens a compact two-option card written in the visitor’s most likely language, adds their native language if it slipped outside the top two, and saves their click to both localStorage and a cookie.
An explicit click — or ?lang= in the URL — always overrides every signal.
The built-in card renders inside Shadow DOM across 67 languages (matching light or dark mode automatically), so your site CSS can never break it and it can never break yours. Want your own design instead? Every analyze() result already includes translated title, subtitle, and options in result.prompt.
Everything Else You Expect (Yes, It’s Built In)
No plugin zoo, no paid GeoIP subscription required — one zero-dependency package from browser to edge:
<scriptsrc="https://cdn.jsdelivr.net/gh/AnnenkovLabs/sherlang@main/dist/sherlang.iife.js"></script><script>const r = Sherlang.analyze({languages: navigator.languages,timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,});</script>
Ready-to-paste examples for React, Next.js middleware, Cloudflare Workers, and Express live in examples/; full TypeScript definitions ship in types/.
What analyze() returns
{language:'uk',confidence:0.62,ask:true,options:[{tag:'uk',label:'Українська',p:0.62},{tag:'pl',label:'Polski',p:0.31},],prompt:{lang:'uk',title:'Оберіть мову',subtitle:'Виберіть ту, якою вам зручніше',options:[/* … */],},origin:[{country:'UA',p:0.86},{country:'PL',p:0.14}],location:[{country:'PL',p:1}],network:{type:'residential',anonymized:0.001,asn:5617,reasons:[/* … */]},reasons:[{kind:'kbd',text:'Keyboard: pl, uk → Ukraine ×13 vs Poland'},/* … */],}
sherlang-integrate — wires Sherlang cleanly into Vanilla HTML, React, Next.js, Vue, Svelte, Astro, Express, or Cloudflare Workers, styling the language chooser to match your design system.
sherlang-translate — translates websites and UI copy into natural human language without textbook stiffness, plus a zero-dependency locale validator.
When the Network Lies & Privacy
Works even with no IP. Browser languages, keyboards, and the clock still decide — offline, inside iframes, in SSR, and in strict single-language browsers (Safari, Brave).
25 IP mirrors, one fast answer. Queried in parallel with a 2.5 s timeout, merged by quorum, with broken mirrors benched by a circuit breaker and results cached for the session.
Zero third-party calls on the server. Reads native geo headers from Cloudflare, Vercel, CloudFront, Netlify, App Engine, Akamai, and Fastly straight off the request.
GDPR & privacy first. Prefer your own server or CDN headers over public IP mirrors (and note it in your privacy policy). Zero WebRTC leaks, zero fingerprinting tricks, and typed-letter detection only counts script characters — never reading text, never touching password or card inputs.
评论