/Knowledge/sources/honojs__hono/llms-full/language-middleware-basic-usage--9d97af90638d.md
Language Middleware: Basic Usage - hono-docs
Language Middleware: Basic Usage Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt basic usage Summary D...
Language Middleware: Basic Usage
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#basic-usage
Summary
Detect language from query string, cookie, and header (default order), with fallback to English: ```ts const app = new Hono() app.use( languageDetector({ supportedLanguages: ['en', 'ar', 'ja'], // Must include fallback fallbackLanguage:...
Content
Detect language from query string, cookie, and header (default order), with fallback to English:
const app = new Hono()
app.use(
languageDetector({
supportedLanguages: ['en', 'ar', 'ja'], // Must include fallback
fallbackLanguage: 'en', // Required
})
)
app.get('/', (c) => {
const lang = c.get('language')
return c.text(`Hello! Your language is ${lang}`)
})
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#basic-usage",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Language Middleware > Basic Usage",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 199,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Language Middleware: Basic Usage",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}