thatsgolden

Smarter fallback for split-script languages (zh, sr, no, ku)
TL;DR: If you have both variants of a split language installed (e.g. Simplified + Traditional Chinese), a visitor whose browser just says zh now gets routed to the more common variant instead of falling back to your forum's default language.
The problem
language-detection matches a visitor's browser locale against your installed language packs using a tiered lookup (exact match → progressive truncation → sibling match), following RFC 4647-style "lookup" behavior.
A handful of languages are published as multiple, separate packs rather than one:
- Chinese →
zh-Hans (Simplified) / zh-Hant (Traditional)
- Serbian →
sr-Cyrl (Cyrillic) / sr-Latn (Latin)
- Norwegian →
nb (Bokmål) / nn (Nynorsk)
- Kurdish →
ckb (Sorani) / kmr (Kurmanji)
Browsers, meanwhile, often just send the bare macrolanguage code — zh, sr, no, ku — with no hint of which variant the visitor actually wants.
Previously, if only one of a pair was installed, the matcher correctly resolved to it. But if both were installed, the request was genuinely ambiguous, so it was declined — and the visitor fell all the way through to your forum's default_locale, even if that had nothing to do with the language they asked for. A zh visitor on a forum with both Chinese packs installed and English as default would land on English, not Chinese.
The fix
For these four macrolanguages specifically, ambiguity now resolves to the more widely-spoken variant instead of being declined:
| Requested | Resolves to (when both installed) | Why |
zh | zh-Hans (Simplified) | Used by far more readers (mainland China, Singapore); the two scripts are close enough that a "wrong" guess is still largely readable. |
sr | sr-Latn (Latin) | Dominates everyday digital/online use, even though Cyrillic is the official script. |
no | nb (Bokmål) | Used by roughly 85–90% of Norwegians. |
ku | kmr (Kurmanji) | Spoken by roughly 65% of Kurds vs. 20% for Sorani. |
Everything else about the matching logic is unchanged: exact matches, region-based hints (e.g. zh-CN → Simplified, zh-TW → Traditional — these were already resolved unambiguously via region and aren't affected by this change), and truncation all still take priority. This fallback only kicks in when the request is genuinely down to "which flavor of this language" with no other signal to go on.
If only one variant of a given language is installed, behavior is exactly as before — that single pack still wins by default, no ambiguity involved.
Why not treat all split languages this way?
We keep this exception scoped to these four rather than generalizing it. For truly distinct written standards — different alphabets or heavily diverged grammar/vocabulary — guessing wrong can hand a visitor text they genuinely can't read, which is worse than falling back to the site default. These four were judged to have variants close enough (or one clearly dominant enough) that a same-language guess beats a different-language fallback. Happy to hear arguments for expanding or adjusting the list.