Skip to content
Myr

docs(language): add JSDoc @example to languageDetector (#5081)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Muhammad Bilal · committed by GitHub · parent 24547a6 · Browse files · 1 file+18 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−0 removed

  • other:+18 added−0 removed

1 file+18 added−0 removed

modified:src/middleware/language/language.ts+18 added
259 unmodified lines
260/**261 * Language detector middleware factory262 * @param userOptions Configuration options for the language detector263 * @returns Hono middleware function264 *265 * @example266 * ```ts267 * type Variables = LanguageVariables268 * const app = new Hono<{ Variables: Variables }>()269 *270 * app.use(271 * languageDetector({272 * supportedLanguages: ['en', 'ja'], // Must include fallback273 * fallbackLanguage: 'en', // Required274 * })275 * )276 *277 * app.get('/', (c) => {278 * const lang = c.get('language')279 * return c.text(`Current language: ${lang}`)280 * })281 * ```282 */283export const languageDetector = (userOptions: Partial<DetectorOptions>): MiddlewareHandler => {284 const options: DetectorOptions = {285 ...DEFAULT_OPTIONS,
15 unmodified lines