i18n: rename locale cookie to NEXT_LOCALE (Next.js convention)

This commit is contained in:
2026-08-24 19:06:06 +02:00
parent 21b948a4f8
commit f919c288b2
7 changed files with 95 additions and 7 deletions
+8 -1
View File
@@ -1,6 +1,13 @@
import type { I18nConfig } from './types.js';
/** Cookie name the template uses to persist a visitor's locale choice. */
export declare const LOCALE_COOKIE_NAME = "ipal-locale";
/**
* Cookie name for the persisted locale choice. Uses NEXT_LOCALE — the convention
* Next.js and its i18n ecosystem expect — so the cookie is interoperable with
* other libraries that read the active locale (instead of a plugin-specific
* name). Written only under functional consent; cleared when that consent is
* withdrawn (see consent cookieMap).
*/
export declare const LOCALE_COOKIE_NAME = "NEXT_LOCALE";
type NegotiateLocaleArgs = {
/** Raw Accept-Language header value */
acceptLanguage?: null | string;
+7 -1
View File
@@ -1,5 +1,11 @@
import { getLocaleCodes, isValidLocale } from './helpers.js';
/** Cookie name the template uses to persist a visitor's locale choice. */ export const LOCALE_COOKIE_NAME = 'ipal-locale';
/** Cookie name the template uses to persist a visitor's locale choice. */ /**
* Cookie name for the persisted locale choice. Uses NEXT_LOCALE — the convention
* Next.js and its i18n ecosystem expect — so the cookie is interoperable with
* other libraries that read the active locale (instead of a plugin-specific
* name). Written only under functional consent; cleared when that consent is
* withdrawn (see consent cookieMap).
*/ export const LOCALE_COOKIE_NAME = 'NEXT_LOCALE';
/**
* Resolves which locale to serve, in priority order:
* 1. Cookie (explicit prior choice)
File diff suppressed because one or more lines are too long