/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-progressive-locale--79b367c00080-progressive-locale-matching-s0206-c0000.md
Progressive Locale Matching - hono-docs
Progressive Locale Matching Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt progressive locale ma...
Progressive Locale Matching
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#progressive-locale-matching
Summary
When a detected locale code like ja-JP is not in supportedLanguages, the middleware progressively truncates subtags to find a match. For example, zh-Hant-CN will try zh-Hant, then zh. An exact match is always preferred. ```ts a...
Content
When a detected locale code like ja-JP is not in supportedLanguages, the middleware progressively truncates subtags to find a match. For example, zh-Hant-CN will try zh-Hant, then zh. An exact match is always preferred.
app.use(
languageDetector({
supportedLanguages: ['en', 'ja', 'zh-Hant'],
fallbackLanguage: 'en',
})
)
// Accept-Language: ja-JP → matches 'ja'
// Accept-Language: zh-Hant-CN → matches 'zh-Hant'