new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Better Auth · Plugins · all subjects

i18n/configuration

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

i18n locale detection strategies

The plugin supports four detection strategies: header (uses Accept-Language HTTP header, default), cookie (reads locale from a cookie), session (reads locale from authenticated user's stored preference), and callback (uses a custom function). Multiple strategies can be configured in priority order via the detection array option.

i18n cookie-based detection setup

To use cookie-based detection, add 'cookie' to the detection strategies array and optionally configure the cookie name using localeCookie option. Example: i18n({ translations: {...}, detection: ['cookie', 'header'], localeCookie: 'lang' }).

i18n session-based detection setup

To detect locale from user session, store the locale preference in a user field via additionalFields, configure detection to include 'session', and optionally set userLocaleField. Example: betterAuth({ user: { additionalFields: { locale: { type: 'string', required: false } } }, plugins: [i18n({ translations: {...}, detection: ['session', 'header'], userLocaleField: 'locale' })] }).

i18n custom detection callback example

For advanced locale detection, use the callback strategy with getLocale function. Example: i18n({ translations: {...}, detection: ['callback', 'header'], getLocale: (ctx) => { if (!ctx.request) return null; const url = new URL(ctx.request.url); return url.searchParams.get('lang'); } }).

i18n Accept-Language header parsing

The plugin automatically parses the Accept-Language HTTP header including quality values. For example, 'Accept-Language: fr-CA, fr;q=0.9, en;q=0.8' would first try fr-CA (mapped to fr), then fr, then en.

Give your agent this brain