next-intl 3.22.0-canary.0 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/development/middleware/getAlternateLinksHeaderValue.js +1 -1
  2. package/dist/development/middleware/middleware.js +17 -20
  3. package/dist/development/middleware/resolveLocale.js +21 -30
  4. package/dist/development/middleware/syncCookie.js +7 -7
  5. package/dist/development/middleware/utils.js +4 -1
  6. package/dist/development/navigation/react-client/createLocalizedPathnamesNavigation.js +4 -2
  7. package/dist/development/navigation/react-client/createNavigation.js +1 -1
  8. package/dist/development/navigation/react-client/createSharedPathnamesNavigation.js +4 -2
  9. package/dist/development/navigation/react-client/useBaseRouter.js +3 -3
  10. package/dist/development/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -0
  11. package/dist/development/navigation/react-server/createSharedPathnamesNavigation.js +2 -0
  12. package/dist/development/navigation/shared/BaseLink.js +2 -1
  13. package/dist/development/navigation/shared/LegacyBaseLink.js +3 -1
  14. package/dist/development/navigation/shared/createSharedNavigationFns.js +2 -1
  15. package/dist/development/navigation/shared/syncLocaleCookie.js +26 -5
  16. package/dist/development/plugin.js +16 -6
  17. package/dist/development/react-client/index.js +3 -1
  18. package/dist/development/routing/config.js +18 -1
  19. package/dist/development/server/react-client/index.js +2 -0
  20. package/dist/development/server/react-server/RequestLocale.js +1 -1
  21. package/dist/development/server/react-server/RequestLocaleLegacy.js +1 -1
  22. package/dist/development/server/react-server/createRequestConfig.js +1 -1
  23. package/dist/development/server.react-client.js +1 -0
  24. package/dist/development/server.react-server.js +1 -0
  25. package/dist/development/shared/constants.js +0 -9
  26. package/dist/development/shared/utils.js +2 -2
  27. package/dist/esm/middleware/getAlternateLinksHeaderValue.js +1 -1
  28. package/dist/esm/middleware/middleware.js +1 -1
  29. package/dist/esm/middleware/resolveLocale.js +1 -1
  30. package/dist/esm/middleware/syncCookie.js +1 -1
  31. package/dist/esm/middleware/utils.js +1 -1
  32. package/dist/esm/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
  33. package/dist/esm/navigation/react-client/createNavigation.js +1 -1
  34. package/dist/esm/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
  35. package/dist/esm/navigation/react-client/useBaseRouter.js +1 -1
  36. package/dist/esm/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
  37. package/dist/esm/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
  38. package/dist/esm/navigation/shared/BaseLink.js +1 -1
  39. package/dist/esm/navigation/shared/LegacyBaseLink.js +1 -1
  40. package/dist/esm/navigation/shared/createSharedNavigationFns.js +1 -1
  41. package/dist/esm/navigation/shared/syncLocaleCookie.js +1 -1
  42. package/dist/esm/plugin.js +1 -1
  43. package/dist/esm/routing/config.js +1 -1
  44. package/dist/esm/server/react-client/index.js +1 -1
  45. package/dist/esm/server/react-server/RequestLocale.js +1 -1
  46. package/dist/esm/server/react-server/RequestLocaleLegacy.js +1 -1
  47. package/dist/esm/server.react-client.js +1 -1
  48. package/dist/esm/server.react-server.js +1 -1
  49. package/dist/esm/shared/constants.js +1 -1
  50. package/dist/production/middleware/getAlternateLinksHeaderValue.js +1 -1
  51. package/dist/production/middleware/middleware.js +1 -1
  52. package/dist/production/middleware/resolveLocale.js +1 -1
  53. package/dist/production/middleware/syncCookie.js +1 -1
  54. package/dist/production/middleware/utils.js +1 -1
  55. package/dist/production/navigation/react-client/createLocalizedPathnamesNavigation.js +1 -1
  56. package/dist/production/navigation/react-client/createNavigation.js +1 -1
  57. package/dist/production/navigation/react-client/createSharedPathnamesNavigation.js +1 -1
  58. package/dist/production/navigation/react-client/useBaseRouter.js +1 -1
  59. package/dist/production/navigation/react-server/createLocalizedPathnamesNavigation.js +1 -1
  60. package/dist/production/navigation/react-server/createSharedPathnamesNavigation.js +1 -1
  61. package/dist/production/navigation/shared/BaseLink.js +1 -1
  62. package/dist/production/navigation/shared/LegacyBaseLink.js +1 -1
  63. package/dist/production/navigation/shared/createSharedNavigationFns.js +1 -1
  64. package/dist/production/navigation/shared/syncLocaleCookie.js +1 -1
  65. package/dist/production/plugin.js +1 -1
  66. package/dist/production/routing/config.js +1 -1
  67. package/dist/production/server/react-client/index.js +1 -1
  68. package/dist/production/server/react-server/RequestLocale.js +1 -1
  69. package/dist/production/server/react-server/RequestLocaleLegacy.js +1 -1
  70. package/dist/production/server.react-client.js +1 -1
  71. package/dist/production/server.react-server.js +1 -1
  72. package/dist/production/shared/constants.js +1 -1
  73. package/dist/types/src/middleware/middleware.d.ts +10 -2
  74. package/dist/types/src/middleware/resolveLocale.d.ts +2 -3
  75. package/dist/types/src/middleware/syncCookie.d.ts +2 -2
  76. package/dist/types/src/middleware/utils.d.ts +1 -1
  77. package/dist/types/src/navigation/react-client/ClientLink.d.ts +1 -1
  78. package/dist/types/src/navigation/react-client/createLocalizedPathnamesNavigation.d.ts +5 -4
  79. package/dist/types/src/navigation/react-client/createNavigation.d.ts +14 -13
  80. package/dist/types/src/navigation/react-client/createSharedPathnamesNavigation.d.ts +5 -4
  81. package/dist/types/src/navigation/react-client/index.d.ts +1 -1
  82. package/dist/types/src/navigation/react-client/useBasePathname.d.ts +1 -1
  83. package/dist/types/src/navigation/react-client/useBaseRouter.d.ts +3 -2
  84. package/dist/types/src/navigation/react-server/ServerLink.d.ts +1 -1
  85. package/dist/types/src/navigation/react-server/createLocalizedPathnamesNavigation.d.ts +4 -3
  86. package/dist/types/src/navigation/react-server/createNavigation.d.ts +14 -13
  87. package/dist/types/src/navigation/react-server/createSharedPathnamesNavigation.d.ts +1 -1
  88. package/dist/types/src/navigation/shared/BaseLink.d.ts +2 -0
  89. package/dist/types/src/navigation/shared/LegacyBaseLink.d.ts +2 -0
  90. package/dist/types/src/navigation/shared/createSharedNavigationFns.d.ts +18 -14
  91. package/dist/types/src/navigation/shared/redirects.d.ts +1 -1
  92. package/dist/types/src/navigation/shared/syncLocaleCookie.d.ts +2 -1
  93. package/dist/types/src/react-client/index.d.ts +1 -1
  94. package/dist/types/src/react-server/getTranslator.d.ts +1 -1
  95. package/dist/types/src/routing/config.d.ts +30 -3
  96. package/dist/types/src/server/react-client/index.d.ts +2 -1
  97. package/dist/types/src/server/react-server/getRequestConfig.d.ts +1 -1
  98. package/dist/types/src/server/react-server/getTranslations.d.ts +1 -1
  99. package/dist/types/src/server/react-server/index.d.ts +4 -1
  100. package/dist/types/src/shared/constants.d.ts +0 -3
  101. package/dist/types/src/shared/utils.d.ts +4 -4
  102. package/package.json +5 -4
  103. package/dist/types/src/middleware/config.d.ts +0 -21
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-client/index.js");exports.getFormatter=e.getFormatter,exports.getLocale=e.getLocale,exports.getMessages=e.getMessages,exports.getNow=e.getNow,exports.getRequestConfig=e.getRequestConfig,exports.getTimeZone=e.getTimeZone,exports.getTranslations=e.getTranslations,exports.unstable_setRequestLocale=e.unstable_setRequestLocale;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-client/index.js");exports.getFormatter=e.getFormatter,exports.getLocale=e.getLocale,exports.getMessages=e.getMessages,exports.getNow=e.getNow,exports.getRequestConfig=e.getRequestConfig,exports.getTimeZone=e.getTimeZone,exports.getTranslations=e.getTranslations,exports.setRequestLocale=e.setRequestLocale,exports.unstable_setRequestLocale=e.unstable_setRequestLocale;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-server/getRequestConfig.js"),r=require("./server/react-server/getFormatter.js"),t=require("./server/react-server/getMessages.js"),s=require("./server/react-server/getNow.js"),a=require("./server/react-server/getTimeZone.js"),o=require("./server/react-server/getTranslations.js"),u=require("./server/react-server/getLocale.js"),g=require("./server/react-server/RequestLocaleCache.js");exports.getRequestConfig=e.default,exports.getFormatter=r.default,exports.getMessages=t.default,exports.getNow=s.default,exports.getTimeZone=a.default,exports.getTranslations=o.default,exports.getLocale=u.default,exports.unstable_setRequestLocale=g.setCachedRequestLocale;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./server/react-server/getRequestConfig.js"),r=require("./server/react-server/getFormatter.js"),t=require("./server/react-server/getMessages.js"),s=require("./server/react-server/getNow.js"),a=require("./server/react-server/getTimeZone.js"),o=require("./server/react-server/getTranslations.js"),u=require("./server/react-server/getLocale.js"),c=require("./server/react-server/RequestLocaleCache.js");exports.getRequestConfig=e.default,exports.getFormatter=r.default,exports.getMessages=t.default,exports.getNow=s.default,exports.getTimeZone=a.default,exports.getTranslations=o.default,exports.getLocale=u.default,exports.setRequestLocale=c.setCachedRequestLocale,exports.unstable_setRequestLocale=c.setCachedRequestLocale;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.COOKIE_LOCALE_NAME="NEXT_LOCALE",exports.COOKIE_MAX_AGE=31536e3,exports.COOKIE_SAME_SITE="lax",exports.HEADER_LOCALE_NAME="X-NEXT-INTL-LOCALE",exports.LOCALE_SEGMENT_NAME="locale";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.HEADER_LOCALE_NAME="X-NEXT-INTL-LOCALE",exports.LOCALE_SEGMENT_NAME="locale";
@@ -1,5 +1,13 @@
1
1
  import { NextRequest, NextResponse } from 'next/server';
2
2
  import { RoutingConfig } from '../routing/config';
3
3
  import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../routing/types';
4
- import { MiddlewareOptions } from './config';
5
- export default function createMiddleware<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode = 'always', AppPathnames extends Pathnames<AppLocales> = never, AppDomains extends DomainsConfig<AppLocales> = never>(routing: RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains> & MiddlewareOptions, options?: MiddlewareOptions): (request: NextRequest) => NextResponse<unknown>;
4
+ export default function createMiddleware<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode = 'always', AppPathnames extends Pathnames<AppLocales> = never, AppDomains extends DomainsConfig<AppLocales> = never>(routing: RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>,
5
+ /** @deprecated Should be passed via the first parameter `routing` instead (ideally defined with `defineRouting`) */
6
+ options?: {
7
+ /** @deprecated Should be passed via the first parameter `routing` instead (ideally defined with `defineRouting`) */
8
+ localeCookie?: RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>['localeCookie'];
9
+ /** @deprecated Should be passed via the first parameter `routing` instead (ideally defined with `defineRouting`) */
10
+ localeDetection?: RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>['localeDetection'];
11
+ /** @deprecated Should be passed via the first parameter `routing` instead (ideally defined with `defineRouting`) */
12
+ alternateLinks?: RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>['alternateLinks'];
13
+ }): (request: NextRequest) => NextResponse<unknown>;
@@ -1,9 +1,8 @@
1
1
  import { RequestCookies } from 'next/dist/server/web/spec-extension/cookies';
2
2
  import { ResolvedRoutingConfig } from '../routing/config';
3
- import { Locales, Pathnames, DomainsConfig, DomainConfig, LocalePrefixMode } from '../routing/types';
4
- import { ResolvedMiddlewareOptions } from './config';
3
+ import { DomainConfig, DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../routing/types';
5
4
  export declare function getAcceptLanguageLocale<AppLocales extends Locales>(requestHeaders: Headers, locales: AppLocales, defaultLocale: string): string | undefined;
6
- export default function resolveLocale<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined>(routing: Omit<ResolvedRoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'pathnames'>, options: ResolvedMiddlewareOptions, requestHeaders: Headers, requestCookies: RequestCookies, pathname: string): {
5
+ export default function resolveLocale<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined>(routing: Omit<ResolvedRoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'pathnames'>, requestHeaders: Headers, requestCookies: RequestCookies, pathname: string): {
7
6
  locale: AppLocales[number];
8
7
  domain?: DomainConfig<AppLocales>;
9
8
  };
@@ -1,3 +1,3 @@
1
1
  import { NextRequest, NextResponse } from 'next/server';
2
- import { MiddlewareOptions } from './config';
3
- export default function syncCookie(request: NextRequest, response: NextResponse, locale: string, localeCookie: MiddlewareOptions['localeCookie']): void;
2
+ import { LocaleCookieConfig } from '../routing/config';
3
+ export default function syncCookie(request: NextRequest, response: NextResponse, locale: string, localeCookie: LocaleCookieConfig): void;
@@ -1,4 +1,4 @@
1
- import { Locales, LocalePrefixConfigVerbose, DomainConfig, Pathnames, DomainsConfig, LocalePrefixMode } from '../routing/types';
1
+ import { DomainConfig, DomainsConfig, LocalePrefixConfigVerbose, LocalePrefixMode, Locales, Pathnames } from '../routing/types';
2
2
  export declare function getFirstPathnameSegment(pathname: string): string;
3
3
  export declare function getInternalTemplate<AppLocales extends Locales, AppPathnames extends Pathnames<AppLocales>>(pathnames: AppPathnames, pathname: string, locale: AppLocales[number]): [AppLocales[number] | undefined, keyof AppPathnames | undefined];
4
4
  export declare function formatTemplatePathname(sourcePathname: string, sourceTemplate: string, targetTemplate: string, prefix?: string): string;
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps, ReactElement } from 'react';
2
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
2
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
3
3
  import LegacyBaseLink from '../shared/LegacyBaseLink';
4
4
  type Props<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode> = Omit<ComponentProps<typeof LegacyBaseLink>, 'locale' | 'prefix' | 'localePrefixMode'> & {
5
5
  locale?: AppLocales[number];
@@ -4,7 +4,7 @@ import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../../routi
4
4
  import { HrefOrHrefWithParams } from '../shared/utils';
5
5
  import ClientLink from './ClientLink';
6
6
  /**
7
- * @deprecated Consider switching to `createNavigation` (see https://github.com/amannn/next-intl/pull/1316)
7
+ * @deprecated Consider switching to `createNavigation` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#create-navigation)
8
8
  **/
9
9
  export default function createLocalizedPathnamesNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode = 'always', AppPathnames extends Pathnames<AppLocales> = never, AppDomains extends DomainsConfig<AppLocales> = never>(routing: RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): {
10
10
  Link: <Pathname extends keyof AppPathnames>(props: (Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
@@ -14,7 +14,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
14
14
  scroll?: boolean;
15
15
  shallow?: boolean;
16
16
  passHref?: boolean;
17
- prefetch?: boolean;
17
+ prefetch?: boolean | null;
18
18
  locale?: string | false;
19
19
  legacyBehavior?: boolean;
20
20
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -27,7 +27,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
27
27
  scroll?: boolean;
28
28
  shallow?: boolean;
29
29
  passHref?: boolean;
30
- prefetch?: boolean;
30
+ prefetch?: boolean | null;
31
31
  locale?: string | false;
32
32
  legacyBehavior?: boolean;
33
33
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -39,6 +39,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
39
39
  locale: string;
40
40
  prefix: string;
41
41
  localePrefixMode: LocalePrefixMode;
42
+ localeCookie: import("../../routing/config").InitializedLocaleCookieConfig;
42
43
  }, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale" | "prefix" | "localePrefixMode"> & {
43
44
  locale?: string | undefined;
44
45
  localePrefix: {
@@ -52,7 +53,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
52
53
  };
53
54
  } & {
54
55
  ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
55
- }, "localePrefix" | "href" | "name"> & {
56
+ }, "name" | "localePrefix" | "localeCookie" | "href"> & {
56
57
  href: Pathname extends `${string}[[...${string}` ? Pathname | ({
57
58
  pathname: Pathname;
58
59
  params?: import("../shared/StrictParams").default<Pathname> | undefined;
@@ -2,23 +2,23 @@ import { RoutingConfigLocalizedNavigation, RoutingConfigSharedNavigation } from
2
2
  import { DomainsConfig, LocalePrefixMode, Locales, Pathnames } from '../../routing/types';
3
3
  export default function createNavigation<const AppLocales extends Locales, const AppLocalePrefixMode extends LocalePrefixMode = 'always', const AppPathnames extends Pathnames<AppLocales> = never, const AppDomains extends DomainsConfig<AppLocales> = never>(routing?: [AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): {
4
4
  Link: import("react").ForwardRefExoticComponent<Omit<{
5
- locale?: string;
5
+ locale?: string | undefined;
6
6
  slot?: string | undefined;
7
7
  style?: import("react").CSSProperties | undefined;
8
8
  title?: string | undefined;
9
9
  onError?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
10
10
  children?: import("react").ReactNode | undefined;
11
11
  ref?: import("react").LegacyRef<HTMLAnchorElement> | undefined;
12
- replace?: boolean;
13
- as?: string | import("url").UrlObject;
14
- scroll?: boolean;
15
- shallow?: boolean;
16
- passHref?: boolean;
17
- prefetch?: boolean;
18
- legacyBehavior?: boolean;
19
- onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement>;
20
- onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement>;
21
- onClick?: import("react").MouseEventHandler<HTMLAnchorElement>;
12
+ replace?: boolean | undefined;
13
+ as?: (string | import("url").UrlObject) | undefined;
14
+ scroll?: boolean | undefined;
15
+ shallow?: boolean | undefined;
16
+ passHref?: boolean | undefined;
17
+ prefetch?: (boolean | null) | undefined;
18
+ legacyBehavior?: boolean | undefined;
19
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
20
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
21
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
22
22
  download?: any;
23
23
  hrefLang?: string | undefined;
24
24
  media?: string | undefined;
@@ -31,12 +31,14 @@ export default function createNavigation<const AppLocales extends Locales, const
31
31
  suppressContentEditableWarning?: boolean | undefined;
32
32
  suppressHydrationWarning?: boolean | undefined;
33
33
  accessKey?: string | undefined;
34
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
34
35
  autoFocus?: boolean | undefined;
35
36
  className?: string | undefined;
36
37
  contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
37
38
  contextMenu?: string | undefined;
38
39
  dir?: string | undefined;
39
40
  draggable?: (boolean | "true" | "false") | undefined;
41
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
40
42
  hidden?: boolean | undefined;
41
43
  id?: string | undefined;
42
44
  lang?: string | undefined;
@@ -57,7 +59,6 @@ export default function createNavigation<const AppLocales extends Locales, const
57
59
  rev?: string | undefined;
58
60
  typeof?: string | undefined;
59
61
  vocab?: string | undefined;
60
- autoCapitalize?: string | undefined;
61
62
  autoCorrect?: string | undefined;
62
63
  autoSave?: string | undefined;
63
64
  color?: string | undefined;
@@ -77,7 +78,7 @@ export default function createNavigation<const AppLocales extends Locales, const
77
78
  onToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
78
79
  onBeforeToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
79
80
  inert?: boolean | undefined;
80
- tw?: string;
81
+ tw?: string | undefined;
81
82
  "aria-activedescendant"?: string | undefined;
82
83
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
83
84
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
@@ -2,7 +2,7 @@ import React, { ReactElement } from 'react';
2
2
  import { RoutingConfigSharedNavigation } from '../../routing/config';
3
3
  import { DomainsConfig, LocalePrefixMode, Locales } from '../../routing/types';
4
4
  /**
5
- * @deprecated Consider switching to `createNavigation` (see https://github.com/amannn/next-intl/pull/1316)
5
+ * @deprecated Consider switching to `createNavigation` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#create-navigation)
6
6
  **/
7
7
  export default function createSharedPathnamesNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppDomains extends DomainsConfig<AppLocales> = never>(routing?: RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains>): {
8
8
  Link: (props: Omit<Omit<Omit<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
@@ -12,7 +12,7 @@ export default function createSharedPathnamesNavigation<AppLocales extends Local
12
12
  scroll?: boolean;
13
13
  shallow?: boolean;
14
14
  passHref?: boolean;
15
- prefetch?: boolean;
15
+ prefetch?: boolean | null;
16
16
  locale?: string | false;
17
17
  legacyBehavior?: boolean;
18
18
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -25,7 +25,7 @@ export default function createSharedPathnamesNavigation<AppLocales extends Local
25
25
  scroll?: boolean;
26
26
  shallow?: boolean;
27
27
  passHref?: boolean;
28
- prefetch?: boolean;
28
+ prefetch?: boolean | null;
29
29
  locale?: string | false;
30
30
  legacyBehavior?: boolean;
31
31
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -37,12 +37,13 @@ export default function createSharedPathnamesNavigation<AppLocales extends Local
37
37
  locale: string;
38
38
  prefix: string;
39
39
  localePrefixMode: LocalePrefixMode;
40
+ localeCookie: import("../../routing/config").InitializedLocaleCookieConfig;
40
41
  }, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale" | "prefix" | "localePrefixMode"> & {
41
42
  locale?: AppLocales[number] | undefined;
42
43
  localePrefix: import("../../routing/types").LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
43
44
  } & {
44
45
  ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
45
- }, "localePrefix"> & {
46
+ }, "localePrefix" | "localeCookie"> & {
46
47
  ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
47
48
  }) => ReactElement;
48
49
  redirect: (pathname: string, type?: import("next/navigation").RedirectType | undefined) => never;
@@ -1,6 +1,6 @@
1
1
  export { default as createSharedPathnamesNavigation } from './createSharedPathnamesNavigation';
2
2
  export { default as createLocalizedPathnamesNavigation } from './createLocalizedPathnamesNavigation';
3
3
  export { default as createNavigation } from './createNavigation';
4
- import type { Pathnames as PathnamesDeprecatedExport, Locales } from '../../routing/types';
4
+ import type { Locales, Pathnames as PathnamesDeprecatedExport } from '../../routing/types';
5
5
  /** @deprecated Please import from `next-intl/routing` instead. */
6
6
  export type Pathnames<AppLocales extends Locales> = PathnamesDeprecatedExport<AppLocales>;
@@ -1,2 +1,2 @@
1
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
1
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
2
2
  export default function useBasePathname<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>): string | null;
@@ -1,4 +1,5 @@
1
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
1
+ import { InitializedLocaleCookieConfig } from '../../routing/config';
2
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
2
3
  type IntlNavigateOptions<AppLocales extends Locales> = {
3
4
  locale?: AppLocales[number];
4
5
  };
@@ -21,7 +22,7 @@ type IntlNavigateOptions<AppLocales extends Locales> = {
21
22
  * router.push('/about', {locale: 'de'});
22
23
  * ```
23
24
  */
24
- export default function useBaseRouter<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>): {
25
+ export default function useBaseRouter<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>, localeCookie: InitializedLocaleCookieConfig): {
25
26
  push: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & IntlNavigateOptions<AppLocales>) | undefined) => void;
26
27
  replace: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").NavigateOptions & IntlNavigateOptions<AppLocales>) | undefined) => void;
27
28
  prefetch: (href: string, options?: (import("next/dist/shared/lib/app-router-context.shared-runtime").PrefetchOptions & IntlNavigateOptions<AppLocales>) | undefined) => void;
@@ -1,5 +1,5 @@
1
1
  import React, { ComponentProps } from 'react';
2
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
2
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
3
3
  import LegacyBaseLink from '../shared/LegacyBaseLink';
4
4
  type Props<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode> = Omit<ComponentProps<typeof LegacyBaseLink>, 'locale' | 'prefix' | 'localePrefixMode'> & {
5
5
  locale?: AppLocales[number];
@@ -10,7 +10,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
10
10
  scroll?: boolean;
11
11
  shallow?: boolean;
12
12
  passHref?: boolean;
13
- prefetch?: boolean;
13
+ prefetch?: boolean | null;
14
14
  locale?: string | false;
15
15
  legacyBehavior?: boolean;
16
16
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -23,7 +23,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
23
23
  scroll?: boolean;
24
24
  shallow?: boolean;
25
25
  passHref?: boolean;
26
- prefetch?: boolean;
26
+ prefetch?: boolean | null;
27
27
  locale?: string | false;
28
28
  legacyBehavior?: boolean;
29
29
  onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
@@ -35,6 +35,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
35
35
  locale: string;
36
36
  prefix: string;
37
37
  localePrefixMode: LocalePrefixMode;
38
+ localeCookie: import("../../routing/config").InitializedLocaleCookieConfig;
38
39
  }, "ref"> & React.RefAttributes<HTMLAnchorElement>, "locale" | "prefix" | "localePrefixMode"> & {
39
40
  locale?: string | undefined;
40
41
  localePrefix: {
@@ -46,7 +47,7 @@ export default function createLocalizedPathnamesNavigation<AppLocales extends Lo
46
47
  mode: "as-needed";
47
48
  prefixes?: Partial<Record<string, string>> | undefined;
48
49
  };
49
- }, "localePrefix" | "href" | "name"> & {
50
+ }, "name" | "localePrefix" | "localeCookie" | "href"> & {
50
51
  href: Pathname extends `${string}[[...${string}` ? Pathname | ({
51
52
  pathname: Pathname;
52
53
  params?: import("../shared/StrictParams").default<Pathname> | undefined;
@@ -4,23 +4,23 @@ export default function createNavigation<const AppLocales extends Locales, const
4
4
  usePathname: () => never;
5
5
  useRouter: () => never;
6
6
  Link: import("react").ForwardRefExoticComponent<Omit<{
7
- locale?: string;
7
+ locale?: string | undefined;
8
8
  slot?: string | undefined;
9
9
  style?: import("react").CSSProperties | undefined;
10
10
  title?: string | undefined;
11
11
  onError?: import("react").ReactEventHandler<HTMLAnchorElement> | undefined;
12
12
  children?: import("react").ReactNode | undefined;
13
13
  ref?: import("react").LegacyRef<HTMLAnchorElement> | undefined;
14
- replace?: boolean;
15
- as?: string | import("url").UrlObject;
16
- scroll?: boolean;
17
- shallow?: boolean;
18
- passHref?: boolean;
19
- prefetch?: boolean;
20
- legacyBehavior?: boolean;
21
- onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement>;
22
- onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement>;
23
- onClick?: import("react").MouseEventHandler<HTMLAnchorElement>;
14
+ replace?: boolean | undefined;
15
+ as?: (string | import("url").UrlObject) | undefined;
16
+ scroll?: boolean | undefined;
17
+ shallow?: boolean | undefined;
18
+ passHref?: boolean | undefined;
19
+ prefetch?: (boolean | null) | undefined;
20
+ legacyBehavior?: boolean | undefined;
21
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
22
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
23
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
24
24
  download?: any;
25
25
  hrefLang?: string | undefined;
26
26
  media?: string | undefined;
@@ -33,12 +33,14 @@ export default function createNavigation<const AppLocales extends Locales, const
33
33
  suppressContentEditableWarning?: boolean | undefined;
34
34
  suppressHydrationWarning?: boolean | undefined;
35
35
  accessKey?: string | undefined;
36
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
36
37
  autoFocus?: boolean | undefined;
37
38
  className?: string | undefined;
38
39
  contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
39
40
  contextMenu?: string | undefined;
40
41
  dir?: string | undefined;
41
42
  draggable?: (boolean | "true" | "false") | undefined;
43
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
42
44
  hidden?: boolean | undefined;
43
45
  id?: string | undefined;
44
46
  lang?: string | undefined;
@@ -59,7 +61,6 @@ export default function createNavigation<const AppLocales extends Locales, const
59
61
  rev?: string | undefined;
60
62
  typeof?: string | undefined;
61
63
  vocab?: string | undefined;
62
- autoCapitalize?: string | undefined;
63
64
  autoCorrect?: string | undefined;
64
65
  autoSave?: string | undefined;
65
66
  color?: string | undefined;
@@ -79,7 +80,7 @@ export default function createNavigation<const AppLocales extends Locales, const
79
80
  onToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
80
81
  onBeforeToggle?: import("react").ToggleEventHandler<HTMLAnchorElement> | undefined;
81
82
  inert?: boolean | undefined;
82
- tw?: string;
83
+ tw?: string | undefined;
83
84
  "aria-activedescendant"?: string | undefined;
84
85
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
85
86
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
@@ -3,7 +3,7 @@ import { RoutingConfigSharedNavigation } from '../../routing/config';
3
3
  import { DomainsConfig, LocalePrefixMode, Locales } from '../../routing/types';
4
4
  import ServerLink from './ServerLink';
5
5
  export default function createSharedPathnamesNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppDomains extends DomainsConfig<AppLocales> = never>(routing?: RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains>): {
6
- Link: (props: Omit<ComponentProps<typeof ServerLink<AppLocales, AppLocalePrefixMode>>, "localePrefix">) => React.JSX.Element;
6
+ Link: (props: Omit<ComponentProps<typeof ServerLink<AppLocales, AppLocalePrefixMode>>, "localePrefix" | "localeCookie">) => React.JSX.Element;
7
7
  redirect: (pathname: string, type?: import("next/navigation").RedirectType | undefined) => never;
8
8
  permanentRedirect: (pathname: string, type?: import("next/navigation").RedirectType | undefined) => never;
9
9
  usePathname: () => never;
@@ -1,8 +1,10 @@
1
1
  import NextLink from 'next/link';
2
2
  import React, { ComponentProps } from 'react';
3
+ import { InitializedLocaleCookieConfig } from '../../routing/config';
3
4
  type Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {
4
5
  locale?: string;
5
6
  defaultLocale?: string;
7
+ localeCookie: InitializedLocaleCookieConfig;
6
8
  /** Special case for `localePrefix: 'as-needed'` and `domains`. */
7
9
  unprefixed?: {
8
10
  domains: {
@@ -1,10 +1,12 @@
1
1
  import NextLink from 'next/link';
2
2
  import React, { ComponentProps } from 'react';
3
+ import { InitializedLocaleCookieConfig } from '../../routing/config';
3
4
  import { LocalePrefixMode } from '../../routing/types';
4
5
  type Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {
5
6
  locale: string;
6
7
  prefix: string;
7
8
  localePrefixMode: LocalePrefixMode;
9
+ localeCookie: InitializedLocaleCookieConfig;
8
10
  };
9
11
  declare const LegacyBaseLinkWithRef: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
10
12
  export default LegacyBaseLinkWithRef;
@@ -7,7 +7,7 @@ type PromiseOrValue<Type> = Type | Promise<Type>;
7
7
  * Shared implementations for `react-server` and `react-client`
8
8
  */
9
9
  export default function createSharedNavigationFns<const AppLocales extends Locales, const AppPathnames extends Pathnames<AppLocales> = never, const AppLocalePrefixMode extends LocalePrefixMode = 'always', const AppDomains extends DomainsConfig<AppLocales> = never>(getLocale: () => PromiseOrValue<AppLocales extends never ? string : AppLocales[number]>, routing?: [AppPathnames] extends [never] ? RoutingConfigSharedNavigation<AppLocales, AppLocalePrefixMode, AppDomains> | undefined : RoutingConfigLocalizedNavigation<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>): {
10
- config: Omit<{}, "localePrefix"> & {
10
+ config: Omit<{}, "localePrefix" | "localeCookie" | "alternateLinks" | "localeDetection"> & {
11
11
  localePrefix: {
12
12
  mode: "never";
13
13
  } | {
@@ -17,25 +17,28 @@ export default function createSharedNavigationFns<const AppLocales extends Local
17
17
  mode: "as-needed";
18
18
  prefixes?: Partial<Record<string, string>> | undefined;
19
19
  };
20
+ localeCookie: import("../../routing/config").InitializedLocaleCookieConfig;
21
+ localeDetection: NonNullable<boolean | undefined>;
22
+ alternateLinks: NonNullable<boolean | undefined>;
20
23
  };
21
24
  Link: React.ForwardRefExoticComponent<Omit<{
22
- locale?: string;
25
+ locale?: string | undefined;
23
26
  slot?: string | undefined;
24
27
  style?: React.CSSProperties | undefined;
25
28
  title?: string | undefined;
26
29
  onError?: React.ReactEventHandler<HTMLAnchorElement> | undefined;
27
30
  children?: React.ReactNode | undefined;
28
31
  ref?: React.LegacyRef<HTMLAnchorElement> | undefined;
29
- replace?: boolean;
30
- as?: string | import("url").UrlObject;
31
- scroll?: boolean;
32
- shallow?: boolean;
33
- passHref?: boolean;
34
- prefetch?: boolean;
35
- legacyBehavior?: boolean;
36
- onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>;
37
- onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>;
38
- onClick?: React.MouseEventHandler<HTMLAnchorElement>;
32
+ replace?: boolean | undefined;
33
+ as?: (string | import("url").UrlObject) | undefined;
34
+ scroll?: boolean | undefined;
35
+ shallow?: boolean | undefined;
36
+ passHref?: boolean | undefined;
37
+ prefetch?: (boolean | null) | undefined;
38
+ legacyBehavior?: boolean | undefined;
39
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
40
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
41
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
39
42
  download?: any;
40
43
  hrefLang?: string | undefined;
41
44
  media?: string | undefined;
@@ -48,12 +51,14 @@ export default function createSharedNavigationFns<const AppLocales extends Local
48
51
  suppressContentEditableWarning?: boolean | undefined;
49
52
  suppressHydrationWarning?: boolean | undefined;
50
53
  accessKey?: string | undefined;
54
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
51
55
  autoFocus?: boolean | undefined;
52
56
  className?: string | undefined;
53
57
  contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
54
58
  contextMenu?: string | undefined;
55
59
  dir?: string | undefined;
56
60
  draggable?: (boolean | "true" | "false") | undefined;
61
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
57
62
  hidden?: boolean | undefined;
58
63
  id?: string | undefined;
59
64
  lang?: string | undefined;
@@ -74,7 +79,6 @@ export default function createSharedNavigationFns<const AppLocales extends Local
74
79
  rev?: string | undefined;
75
80
  typeof?: string | undefined;
76
81
  vocab?: string | undefined;
77
- autoCapitalize?: string | undefined;
78
82
  autoCorrect?: string | undefined;
79
83
  autoSave?: string | undefined;
80
84
  color?: string | undefined;
@@ -94,7 +98,7 @@ export default function createSharedNavigationFns<const AppLocales extends Local
94
98
  onToggle?: React.ToggleEventHandler<HTMLAnchorElement> | undefined;
95
99
  onBeforeToggle?: React.ToggleEventHandler<HTMLAnchorElement> | undefined;
96
100
  inert?: boolean | undefined;
97
- tw?: string;
101
+ tw?: string | undefined;
98
102
  "aria-activedescendant"?: string | undefined;
99
103
  "aria-atomic"?: (boolean | "true" | "false") | undefined;
100
104
  "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
@@ -1,4 +1,4 @@
1
- import { Locales, LocalePrefixConfigVerbose, LocalePrefixMode } from '../../routing/types';
1
+ import { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types';
2
2
  export declare const baseRedirect: <AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(params: {
3
3
  pathname: string;
4
4
  locale: Locales[number];
@@ -1,6 +1,7 @@
1
+ import { InitializedLocaleCookieConfig } from '../../routing/config';
1
2
  /**
2
3
  * We have to keep the cookie value in sync as Next.js might
3
4
  * skip a request to the server due to its router cache.
4
5
  * See https://github.com/amannn/next-intl/issues/786.
5
6
  */
6
- export default function syncLocaleCookie(pathname: string | null, locale: string, nextLocale?: string): void;
7
+ export default function syncLocaleCookie(localeCookie: InitializedLocaleCookieConfig, pathname: string | null, locale: string, nextLocale?: string): void;
@@ -7,7 +7,7 @@
7
7
  * - Make sure everything exported from this module is
8
8
  * supported in all Next.js versions that are supported.
9
9
  */
10
- import { useTranslations as base_useTranslations, useFormatter as base_useFormatter } from 'use-intl';
10
+ import { useFormatter as base_useFormatter, useTranslations as base_useTranslations } from 'use-intl';
11
11
  export * from 'use-intl';
12
12
  export declare const useTranslations: typeof base_useTranslations;
13
13
  export declare const useFormatter: typeof base_useFormatter;
@@ -1,5 +1,5 @@
1
1
  import { ReactElement, ReactNodeArray } from 'react';
2
- import { Formats, TranslationValues, RichTranslationValues, MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf, createTranslator, MarkupTranslationValues } from 'use-intl/core';
2
+ import { Formats, MarkupTranslationValues, MessageKeys, NamespaceKeys, NestedKeyOf, NestedValueOf, RichTranslationValues, TranslationValues, createTranslator } from 'use-intl/core';
3
3
  declare function getTranslatorImpl<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(config: Parameters<typeof createTranslator>[0], namespace?: NestedKey): {
4
4
  <TargetKey extends MessageKeys<NestedValueOf<{
5
5
  '!': IntlMessages;
@@ -1,4 +1,6 @@
1
- import { Locales, LocalePrefix, LocalePrefixConfigVerbose, DomainsConfig, Pathnames, LocalePrefixMode } from './types';
1
+ import type { NextResponse } from 'next/server';
2
+ import { DomainsConfig, LocalePrefix, LocalePrefixConfigVerbose, LocalePrefixMode, Locales, Pathnames } from './types';
3
+ type CookieAttributes = Pick<NonNullable<Parameters<typeof NextResponse.prototype.cookies.set>['2']>, 'maxAge' | 'domain' | 'partitioned' | 'path' | 'priority' | 'sameSite' | 'secure' | 'name'>;
2
4
  export type RoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined> = {
3
5
  /**
4
6
  * All available locales.
@@ -20,6 +22,21 @@ export type RoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extend
20
22
  * @see https://next-intl-docs.vercel.app/docs/routing#domains
21
23
  **/
22
24
  domains?: AppDomains;
25
+ /**
26
+ * Can be used to disable the locale cookie or to customize it.
27
+ * @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-cookie
28
+ */
29
+ localeCookie?: boolean | CookieAttributes;
30
+ /**
31
+ * Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http
32
+ * @see https://next-intl-docs.vercel.app/docs/routing/middleware#alternate-links
33
+ **/
34
+ alternateLinks?: boolean;
35
+ /**
36
+ * By setting this to `false`, the cookie as well as the `accept-language` header will no longer be used for locale detection.
37
+ * @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-detection
38
+ **/
39
+ localeDetection?: boolean;
23
40
  } & ([AppPathnames] extends [never] ? {} : {
24
41
  /**
25
42
  * A map of localized pathnames per locale.
@@ -31,10 +48,13 @@ export type RoutingConfigSharedNavigation<AppLocales extends Locales, AppLocaleP
31
48
  export type RoutingConfigLocalizedNavigation<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales>, AppDomains extends DomainsConfig<AppLocales> = never> = Omit<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'defaultLocale' | 'pathnames'> & Partial<Pick<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'defaultLocale'>> & {
32
49
  pathnames: AppPathnames;
33
50
  };
34
- export type ResolvedRoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined> = Omit<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'localePrefix'> & {
51
+ export type ResolvedRoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined> = Omit<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>, 'localePrefix' | 'localeCookie' | 'alternateLinks' | 'localeDetection'> & {
35
52
  localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
53
+ localeCookie: InitializedLocaleCookieConfig;
54
+ alternateLinks: boolean;
55
+ localeDetection: boolean;
36
56
  };
37
- export declare function receiveRoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined, Config extends Partial<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>>>(input: Config): Omit<Config, "localePrefix"> & {
57
+ export declare function receiveRoutingConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode, AppPathnames extends Pathnames<AppLocales> | undefined, AppDomains extends DomainsConfig<AppLocales> | undefined, Config extends Partial<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>>>(input: Config): Omit<Config, "localePrefix" | "localeCookie" | "alternateLinks" | "localeDetection"> & {
38
58
  localePrefix: {
39
59
  mode: "never";
40
60
  } | {
@@ -44,5 +64,12 @@ export declare function receiveRoutingConfig<AppLocales extends Locales, AppLoca
44
64
  mode: "as-needed";
45
65
  prefixes?: Partial<Record<AppLocales[number], string>> | undefined;
46
66
  };
67
+ localeCookie: InitializedLocaleCookieConfig;
68
+ localeDetection: boolean | NonNullable<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>["localeDetection"]>;
69
+ alternateLinks: boolean | NonNullable<RoutingConfig<AppLocales, AppLocalePrefixMode, AppPathnames, AppDomains>["alternateLinks"]>;
47
70
  };
71
+ export declare function receiveLocaleCookie(localeCookie?: boolean | CookieAttributes): InitializedLocaleCookieConfig;
72
+ export type InitializedLocaleCookieConfig = false | LocaleCookieConfig;
73
+ export type LocaleCookieConfig = Omit<CookieAttributes, 'name' | 'maxAge' | 'sameSite'> & Required<Pick<CookieAttributes, 'name' | 'maxAge' | 'sameSite'>>;
48
74
  export declare function receiveLocalePrefixConfig<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(localePrefix?: LocalePrefix<AppLocales, AppLocalePrefixMode>): LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>;
75
+ export {};
@@ -1,4 +1,4 @@
1
- import type { getRequestConfig as getRequestConfig_type, getFormatter as getFormatter_type, getNow as getNow_type, getTimeZone as getTimeZone_type, getMessages as getMessages_type, getLocale as getLocale_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
1
+ import type { getFormatter as getFormatter_type, getLocale as getLocale_type, getMessages as getMessages_type, getNow as getNow_type, getRequestConfig as getRequestConfig_type, getTimeZone as getTimeZone_type, setRequestLocale as setRequestLocale_type, unstable_setRequestLocale as unstable_setRequestLocale_type } from '../react-server';
2
2
  export declare function getRequestConfig(...args: Parameters<typeof getRequestConfig_type>): ReturnType<typeof getRequestConfig_type>;
3
3
  export declare const getFormatter: typeof getFormatter_type;
4
4
  export declare const getNow: typeof getNow_type;
@@ -7,3 +7,4 @@ export declare const getMessages: typeof getMessages_type;
7
7
  export declare const getLocale: typeof getLocale_type;
8
8
  export declare const getTranslations: () => never;
9
9
  export declare const unstable_setRequestLocale: typeof unstable_setRequestLocale_type;
10
+ export declare const setRequestLocale: typeof setRequestLocale_type;
@@ -14,7 +14,7 @@ export type RequestConfig = Omit<IntlConfig, 'locale'> & {
14
14
  };
15
15
  export type GetRequestConfigParams = {
16
16
  /**
17
- * Deprecated in favor of `requestLocale` (see https://github.com/amannn/next-intl/pull/1383).
17
+ * Deprecated in favor of `requestLocale` (see https://next-intl-docs.vercel.app/blog/next-intl-3-22#await-request-locale).
18
18
  *
19
19
  * The locale that was matched by the `[locale]` path segment. Note however
20
20
  * that this can be overridden in async APIs when the `locale` is explicitly