Language detection
Decide the language of a request with languageDetector()
import { , , type } from "@senrijs/senri";
const = <>();
.(({ : ["ja", "en"], : "en" }));
.("/", (, ) => (.("language") === "ja" ? "こんにちは" : "Hello"));- It looks at the query (
lang), the cookie (language) andAccept-Language, in this order c.get("language")is always one ofsupportedLanguages. If none matches, it isfallbackLanguage- It does not write the cookie. To remember the language, call
setCookie()yourself
Options
Prop
Type