next-intl 3.0.0-beta.7 → 3.0.0-beta.8

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 (57) hide show
  1. package/client.d.ts +1 -1
  2. package/dist/client/next-intl.esm.js +21 -6
  3. package/dist/client/next-intl.esm.js.map +1 -1
  4. package/dist/client/useRouter.d.ts +3 -3
  5. package/dist/next-intl.cjs.development.js +23 -8
  6. package/dist/next-intl.cjs.development.js.map +1 -1
  7. package/dist/next-intl.cjs.production.min.js +1 -1
  8. package/dist/next-intl.cjs.production.min.js.map +1 -1
  9. package/dist/react-client/next-intl.esm2.js +1 -1
  10. package/dist/react-client/next-intl.esm2.js.map +1 -1
  11. package/dist/react-client/next-intl.esm3.js +1 -1
  12. package/dist/react-client/next-intl.esm3.js.map +1 -1
  13. package/dist/react-client/useLocalizedRouter.d.ts +3 -3
  14. package/dist/react-server/getBaseTranslator.d.ts +42 -0
  15. package/dist/src/client/useRouter.d.ts +3 -3
  16. package/dist/src/client/useRouter.js +6 -6
  17. package/dist/src/client/useRouter.js.map +1 -1
  18. package/dist/src/react-client/Link.js +1 -1
  19. package/dist/src/react-client/useLocalizedRouter.d.ts +3 -3
  20. package/dist/src/react-client/useLocalizedRouter.js +1 -1
  21. package/dist/src/react-client/useLocalizedRouter.js.map +1 -1
  22. package/dist/src/react-server/Link.js +1 -1
  23. package/dist/src/react-server/getBaseTranslator.d.ts +42 -0
  24. package/dist/src/react-server/getBaseTranslator.js +39 -0
  25. package/dist/src/react-server/getBaseTranslator.js.map +1 -0
  26. package/dist/src/react-server/useTranslations.js +2 -4
  27. package/dist/src/react-server/useTranslations.js.map +1 -1
  28. package/dist/src/server/getFormatter.js +2 -2
  29. package/dist/src/server/getIntl.js +1 -1
  30. package/dist/src/server/getLocale.js +1 -1
  31. package/dist/src/server/getLocaleFromHeader.js +1 -1
  32. package/dist/src/server/getLocaleFromHeader.js.map +1 -1
  33. package/dist/src/server/getNow.js +2 -2
  34. package/dist/src/server/getTimeZone.js +2 -2
  35. package/dist/src/server/getTranslations.js +4 -13
  36. package/dist/src/server/getTranslations.js.map +1 -1
  37. package/dist/src/server/getTranslator.js +4 -13
  38. package/dist/src/server/getTranslator.js.map +1 -1
  39. package/link.d.ts +3 -1
  40. package/middleware.d.ts +3 -1
  41. package/package.json +28 -13
  42. package/plugin.d.ts +4 -1
  43. package/server.d.ts +1 -1
  44. package/src/client/useRouter.tsx +6 -6
  45. package/src/react-client/Link.tsx +1 -1
  46. package/src/react-client/useLocalizedRouter.tsx +1 -1
  47. package/src/react-server/Link.tsx +1 -1
  48. package/src/react-server/getBaseTranslator.tsx +128 -0
  49. package/src/react-server/useTranslations.tsx +6 -5
  50. package/src/server/getFormatter.tsx +2 -2
  51. package/src/server/getIntl.tsx +1 -1
  52. package/src/server/getLocale.tsx +1 -1
  53. package/src/server/getLocaleFromHeader.tsx +1 -1
  54. package/src/server/getNow.tsx +2 -2
  55. package/src/server/getTimeZone.tsx +2 -2
  56. package/src/server/getTranslations.tsx +4 -16
  57. package/src/server/getTranslator.tsx +4 -16
package/client.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './dist/src/client';
1
+ export * from './dist/client';
@@ -28,14 +28,29 @@ function useRouter() {
28
28
  return localizeHref(href, locale, locale, window.location.pathname);
29
29
  }
30
30
  return _extends({}, router, {
31
- push: function push(href) {
32
- return router.push(localize(href));
31
+ push: function push() {
32
+ for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
33
+ _ref[_key] = arguments[_key];
34
+ }
35
+ var href = _ref[0],
36
+ args = _ref.slice(1);
37
+ return router.push.apply(router, [localize(href)].concat(args));
33
38
  },
34
- replace: function replace(href) {
35
- return router.replace(localize(href));
39
+ replace: function replace() {
40
+ for (var _len2 = arguments.length, _ref2 = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
41
+ _ref2[_key2] = arguments[_key2];
42
+ }
43
+ var href = _ref2[0],
44
+ args = _ref2.slice(1);
45
+ return router.replace.apply(router, [localize(href)].concat(args));
36
46
  },
37
- prefetch: function prefetch(href) {
38
- return router.prefetch(localize(href));
47
+ prefetch: function prefetch() {
48
+ for (var _len3 = arguments.length, _ref3 = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
49
+ _ref3[_key3] = arguments[_key3];
50
+ }
51
+ var href = _ref3[0],
52
+ args = _ref3.slice(1);
53
+ return router.prefetch.apply(router, [localize(href)].concat(args));
39
54
  }
40
55
  });
41
56
  }, [locale, router]);
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.esm.js","sources":["../../src/client/useRouter.tsx"],"sourcesContent":["import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(href: string) {\n return router.push(localize(href));\n },\n replace(href: string) {\n return router.replace(localize(href));\n },\n prefetch(href: string) {\n return router.prefetch(localize(href));\n }\n };\n }, [locale, router]);\n}\n"],"names":["useRouter","router","useNextRouter","locale","useClientLocale","useMemo","localize","href","localizeHref","window","location","pathname","_extends","push","replace","prefetch"],"mappings":";;;;;;AAKA;;;;;;;;;;;;;;;AAeG;AACW,SAAUA,SAASA,GAAA;AAC/B,EAAA,IAAMC,MAAM,GAAGC,WAAa,EAAE,CAAA;AAC9B,EAAA,IAAMC,MAAM,GAAGC,eAAe,EAAE,CAAA;EAEhC,OAAOC,OAAO,CAAC,YAAK;IAClB,SAASC,QAAQA,CAACC,IAAY,EAAA;AAC5B,MAAA,OAAOC,YAAY,CAACD,IAAI,EAAEJ,MAAM,EAAEA,MAAM,EAAEM,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AACrE,KAAA;IAEA,OAAAC,QAAA,KACKX,MAAM,EAAA;MACTY,IAAI,EAAA,SAAAA,IAACN,CAAAA,IAAY,EAAA;QACf,OAAON,MAAM,CAACY,IAAI,CAACP,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAA;OACnC;MACDO,OAAO,EAAA,SAAAA,OAACP,CAAAA,IAAY,EAAA;QAClB,OAAON,MAAM,CAACa,OAAO,CAACR,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAA;OACtC;MACDQ,QAAQ,EAAA,SAAAA,QAACR,CAAAA,IAAY,EAAA;QACnB,OAAON,MAAM,CAACc,QAAQ,CAACT,QAAQ,CAACC,IAAI,CAAC,CAAC,CAAA;AACxC,OAAA;AAAC,KAAA,CAAA,CAAA;AAEL,GAAC,EAAE,CAACJ,MAAM,EAAEF,MAAM,CAAC,CAAC,CAAA;AACtB;;;;"}
1
+ {"version":3,"file":"next-intl.esm.js","sources":["../../src/client/useRouter.tsx"],"sourcesContent":["import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(...[href, ...args]: Parameters<typeof router.push>) {\n return router.push(localize(href), ...args);\n },\n replace(...[href, ...args]: Parameters<typeof router.replace>) {\n return router.replace(localize(href), ...args);\n },\n prefetch(...[href, ...args]: Parameters<typeof router.prefetch>) {\n return router.prefetch(localize(href), ...args);\n }\n };\n }, [locale, router]);\n}\n"],"names":["useRouter","router","useNextRouter","locale","useClientLocale","useMemo","localize","href","localizeHref","window","location","pathname","_extends","push","_len","arguments","length","_ref","Array","_key","args","slice","apply","concat","replace","_len2","_ref2","_key2","prefetch","_len3","_ref3","_key3"],"mappings":";;;;;;AAKA;;;;;;;;;;;;;;;AAeG;AACW,SAAUA,SAASA,GAAA;AAC/B,EAAA,IAAMC,MAAM,GAAGC,WAAa,EAAE,CAAA;AAC9B,EAAA,IAAMC,MAAM,GAAGC,eAAe,EAAE,CAAA;EAEhC,OAAOC,OAAO,CAAC,YAAK;IAClB,SAASC,QAAQA,CAACC,IAAY,EAAA;AAC5B,MAAA,OAAOC,YAAY,CAACD,IAAI,EAAEJ,MAAM,EAAEA,MAAM,EAAEM,MAAM,CAACC,QAAQ,CAACC,QAAQ,CAAC,CAAA;AACrE,KAAA;IAEA,OAAAC,QAAA,KACKX,MAAM,EAAA;MACTY,IAAI,EAAA,SAAAA,OAAmD;AAAA,QAAA,KAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,GAAAC,IAAAA,KAAA,CAAAJ,IAAA,GAAAK,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,EAAA,EAAA;AAAAF,UAAAA,IAAA,CAAAE,IAAA,CAAAJ,GAAAA,SAAA,CAAAI,IAAA,CAAA,CAAA;AAAA,SAAA;QAAA,IAA9CZ,IAAI,GAAAU,IAAA,CAAA,CAAA,CAAA;UAAKG,IAAI,GAAAH,IAAA,CAAAI,KAAA,CAAA,CAAA,CAAA,CAAA;AACpB,QAAA,OAAOpB,MAAM,CAACY,IAAI,CAAAS,KAAA,CAAXrB,MAAM,EAAA,CAAMK,QAAQ,CAACC,IAAI,CAAC,CAAA,CAAAgB,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A;AAAC,KAAA,CAAA,CAAA;AAEL,GAAC,EAAE,CAACjB,MAAM,EAAEF,MAAM,CAAC,CAAC,CAAA;AACtB;;;;"}
@@ -15,9 +15,9 @@
15
15
  * ```
16
16
  */
17
17
  export default function useRouter(): {
18
- push(href: string): void;
19
- replace(href: string): void;
20
- prefetch(href: string): void;
18
+ push(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
19
+ replace(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
20
+ prefetch(href: string, options?: import("next/dist/shared/lib/app-router-context").PrefetchOptions | undefined): void;
21
21
  back(): void;
22
22
  forward(): void;
23
23
  refresh(): void;
@@ -190,7 +190,7 @@ var hasWarned$1 = false;
190
190
  /** @deprecated Is available as `import Link from 'next-intl/link'` now. */
191
191
  function LinkDeprecated(props) {
192
192
  if (!hasWarned$1) {
193
- console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n");
193
+ console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n");
194
194
  hasWarned$1 = true;
195
195
  }
196
196
  return React__default["default"].createElement(Link$1, _extends({}, props));
@@ -254,14 +254,29 @@ function useRouter() {
254
254
  return localizeHref(href, locale, locale, window.location.pathname);
255
255
  }
256
256
  return _extends({}, router, {
257
- push: function push(href) {
258
- return router.push(localize(href));
257
+ push: function push() {
258
+ for (var _len = arguments.length, _ref = new Array(_len), _key = 0; _key < _len; _key++) {
259
+ _ref[_key] = arguments[_key];
260
+ }
261
+ var href = _ref[0],
262
+ args = _ref.slice(1);
263
+ return router.push.apply(router, [localize(href)].concat(args));
259
264
  },
260
- replace: function replace(href) {
261
- return router.replace(localize(href));
265
+ replace: function replace() {
266
+ for (var _len2 = arguments.length, _ref2 = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
267
+ _ref2[_key2] = arguments[_key2];
268
+ }
269
+ var href = _ref2[0],
270
+ args = _ref2.slice(1);
271
+ return router.replace.apply(router, [localize(href)].concat(args));
262
272
  },
263
- prefetch: function prefetch(href) {
264
- return router.prefetch(localize(href));
273
+ prefetch: function prefetch() {
274
+ for (var _len3 = arguments.length, _ref3 = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
275
+ _ref3[_key3] = arguments[_key3];
276
+ }
277
+ var href = _ref3[0],
278
+ args = _ref3.slice(1);
279
+ return router.prefetch.apply(router, [localize(href)].concat(args));
265
280
  }
266
281
  });
267
282
  }, [locale, router]);
@@ -272,7 +287,7 @@ function useRouter() {
272
287
  var hasWarned = false;
273
288
  function useLocalizedRouterDeprecated() {
274
289
  if (!hasWarned) {
275
- console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\n\n");
290
+ console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\n\n");
276
291
  hasWarned = true;
277
292
  }
278
293
  return useRouter();
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.cjs.development.js","sources":["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/client/useRouter.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(href: string) {\n return router.push(localize(href));\n },\n replace(href: string) {\n return router.replace(localize(href));\n },\n prefetch(href: string) {\n return router.prefetch(localize(href));\n }\n };\n }, [locale, router]);\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","locale","params","useParams","useLocale","isRelativeHref","href","pathname","startsWith","isLocalHref","host","hostname","hasProtocol","test","localizeHref","defaultLocale","isSwitchingLocale","isPathnamePrefixed","hasPathnamePrefixed","shouldPrefix","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","prefix","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","process","console","error","React","createElement","NextLink","forwardRef","Link","hasWarned","LinkDeprecated","props","warn","NextIntlClientProvider","children","now","router","useRouter","Date","Error","IntlProvider","useNextRouter","useMemo","localize","window","location","push","replace","useLocalizedRouterDeprecated","LocalizedLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAOA;AACO,IAAMA,mBAAmB,GAAG,QAAQ;;ACJ7B,SAAUC,eAAeA,GAAA;AACrC,EAAA,IAAIC,MAAM,CAAA;AAEV;AACA;AACA,EAAA,IAAMC,MAAM,GAAGC,oBAAS,EAAyC,CAAA;AAEjE,EAAA,IAAID,MAAM,IAANA,IAAAA,IAAAA,MAAM,CAAGH,mBAAmB,CAAC,EAAE;AACjCE,IAAAA,MAAM,GAAGC,MAAM,CAACH,mBAAmB,CAAC,CAAA;AACrC,GAAA,MAAM;AACL;IACAE,MAAM,GAAGG,iBAAS,EAAE,CAAA;AACrB,GAAA;AAED,EAAA,OAAOH,MAAM,CAAA;AACf;;ACbM,SAAUI,cAAcA,CAACC,IAAU,EAAA;EACvC,IAAMC,QAAQ,GAAG,OAAOD,IAAI,KAAK,QAAQ,GAAGA,IAAI,CAACC,QAAQ,GAAGD,IAAI,CAAA;EAChE,OAAOC,QAAQ,IAAI,IAAI,IAAI,CAACA,QAAQ,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AACtD,CAAA;AAEM,SAAUC,WAAWA,CAACH,IAAU,EAAA;AACpC,EAAA,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAOA,IAAI,CAACI,IAAI,IAAI,IAAI,IAAIJ,IAAI,CAACK,QAAQ,IAAI,IAAI,CAAA;AAClD,GAAA,MAAM;AACL,IAAA,IAAMC,WAAW,GAAG,WAAW,CAACC,IAAI,CAACP,IAAI,CAAC,CAAA;AAC1C,IAAA,OAAO,CAACM,WAAW,CAAA;AACpB,GAA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CAAA;AACtB;;ACzCA;AACA;AAEA,IAAIP,SAAS,GAAG,KAAK,CAAA;AAEP,SAAUmB,4BAA4BA,GAAA;EAClD,IAAI,CAACnB,SAAS,EAAE;IACdP,OAAO,CAACU,IAAI,CAAA,8RAC4R,CACvS,CAAA;AACDH,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOQ,SAAS,EAAE,CAAA;AACpB;;AChBA;;;;;;;;AAQG;AAUH;AACO,IAAMY,aAAa,GAAGrB;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"next-intl.cjs.development.js","sources":["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/client/useRouter.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(...[href, ...args]: Parameters<typeof router.push>) {\n return router.push(localize(href), ...args);\n },\n replace(...[href, ...args]: Parameters<typeof router.replace>) {\n return router.replace(localize(href), ...args);\n },\n prefetch(...[href, ...args]: Parameters<typeof router.prefetch>) {\n return router.prefetch(localize(href), ...args);\n }\n };\n }, [locale, router]);\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","locale","params","useParams","useLocale","isRelativeHref","href","pathname","startsWith","isLocalHref","host","hostname","hasProtocol","test","localizeHref","defaultLocale","isSwitchingLocale","isPathnamePrefixed","hasPathnamePrefixed","shouldPrefix","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","prefix","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","process","console","error","React","createElement","NextLink","forwardRef","Link","hasWarned","LinkDeprecated","props","warn","NextIntlClientProvider","children","now","router","useRouter","Date","Error","IntlProvider","useNextRouter","useMemo","localize","window","location","push","_len","arguments","length","Array","_key","args","slice","apply","concat","replace","_len2","_ref2","_key2","_len3","_ref3","_key3","useLocalizedRouterDeprecated","LocalizedLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAOA;AACO,IAAMA,mBAAmB,GAAG,QAAQ;;ACJ7B,SAAUC,eAAeA,GAAA;AACrC,EAAA,IAAIC,MAAM,CAAA;AAEV;AACA;AACA,EAAA,IAAMC,MAAM,GAAGC,oBAAS,EAAyC,CAAA;AAEjE,EAAA,IAAID,MAAM,IAANA,IAAAA,IAAAA,MA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-1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("next/navigation"),n=require("use-intl"),r=require("next/link"),o=require("next/router");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),i=a(r);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(o[n]=e[n]);return o}var f="locale";function s(){var e=t.useParams();return null!=e&&e[f]?e[f]:n.useLocale()}function p(e){return"object"==typeof e?null==e.host&&null==e.hostname:!/^[a-z]+:/i.test(e)}function d(e,t,n,r){if(void 0===n&&(n=t),!p(e)||function(e){var t="object"==typeof e?e.pathname:e;return null!=t&&!t.startsWith("/")}(e))return e;var o=t!==n,a=null==t||function(e,t){var n="/"+e;return t===n||t.startsWith(n+"/")}(t,r);return(a||o)&&null!=t?h(e,t):e}function h(e,t){var n;return"string"==typeof e?n=v(t,e):(n=l({},e),e.pathname&&(n.pathname=v(t,e.pathname))),n}function v(e,t){var n="/"+e;return"/"!==t&&(n+=t),n}var m=["href","locale","prefetch"];function x(n,r){var o=n.href,a=n.locale,f=n.prefetch,v=c(n,m),x=t.usePathname(),y=s(),w=a!==y,b=e.useState((function(){return p(o)&&a?h(o,a):o})),P=b[0],g=b[1];return e.useEffect((function(){x&&g(d(o,a,y,null!=x?x:void 0))}),[y,o,a,x]),w&&(f=!1),u.default.createElement(i.default,l({ref:r,href:P,prefetch:f},v))}var y=e.forwardRef(x),w=["locale"];function b(e,t){var n=e.locale,r=c(e,w),o=s();return u.default.createElement(y,l({ref:t,locale:n||o},r))}var P=e.forwardRef(b),g=!1;function O(e){return g||(console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n"),g=!0),u.default.createElement(P,l({},e))}var E=["children","locale","now"];function R(e){var t,r=e.children,a=e.locale,i=e.now,f=c(e,E);try{t=o.useRouter()}catch(e){}if(!a&&t&&(a=t.locale),"string"==typeof i&&(i=new Date(i)),!a)throw new Error(void 0);return u.default.createElement(n.IntlProvider,l({locale:a,now:i},f),r)}var j=!1,k=O;exports.Link=O,exports.LocalizedLink=k,exports.NextIntlClientProvider=R,exports.NextIntlProvider=R,exports.useLocalizedRouter=function(){return j||(console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\n\n"),j=!0),function(){var n=t.useRouter(),r=s();return e.useMemo((function(){function e(e){return d(e,r,r,window.location.pathname)}return l({},n,{push:function(t){return n.push(e(t))},replace:function(t){return n.replace(e(t))},prefetch:function(t){return n.prefetch(e(t))}})}),[r,n])}()},Object.keys(n).forEach((function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})}));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("next/navigation"),t=require("use-intl"),n=require("next/link"),o=require("next/router");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(e),i=a(n);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},u.apply(this,arguments)}function c(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}var f="locale";function s(){var e=r.useParams();return null!=e&&e[f]?e[f]:t.useLocale()}function p(e){return"object"==typeof e?null==e.host&&null==e.hostname:!/^[a-z]+:/i.test(e)}function v(e,r,t,n){if(void 0===t&&(t=r),!p(e)||function(e){var r="object"==typeof e?e.pathname:e;return null!=r&&!r.startsWith("/")}(e))return e;var o=r!==t,a=null==r||function(e,r){var t="/"+e;return r===t||r.startsWith(t+"/")}(r,n);return(a||o)&&null!=r?d(e,r):e}function d(e,r){var t;return"string"==typeof e?t=h(r,e):(t=u({},e),e.pathname&&(t.pathname=h(r,e.pathname))),t}function h(e,r){var t="/"+e;return"/"!==r&&(t+=r),t}var m=["href","locale","prefetch"];function y(t,n){var o=t.href,a=t.locale,f=t.prefetch,h=c(t,m),y=r.usePathname(),x=s(),w=a!==x,g=e.useState((function(){return p(o)&&a?d(o,a):o})),b=g[0],P=g[1];return e.useEffect((function(){y&&P(v(o,a,x,null!=y?y:void 0))}),[x,o,a,y]),w&&(f=!1),l.default.createElement(i.default,u({ref:n,href:b,prefetch:f},h))}var x=e.forwardRef(y),w=["locale"];function g(e,r){var t=e.locale,n=c(e,w),o=s();return l.default.createElement(x,u({ref:r,locale:t||o},n))}var b=e.forwardRef(g),P=!1;function O(e){return P||(console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n"),P=!0),l.default.createElement(b,u({},e))}var E=["children","locale","now"];function R(e){var r,n=e.children,a=e.locale,i=e.now,f=c(e,E);try{r=o.useRouter()}catch(e){}if(!a&&r&&(a=r.locale),"string"==typeof i&&(i=new Date(i)),!a)throw new Error(void 0);return l.default.createElement(t.IntlProvider,u({locale:a,now:i},f),n)}var j=!1,k=O;exports.Link=O,exports.LocalizedLink=k,exports.NextIntlClientProvider=R,exports.NextIntlProvider=R,exports.useLocalizedRouter=function(){return j||(console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\n\n"),j=!0),function(){var t=r.useRouter(),n=s();return e.useMemo((function(){function e(e){return v(e,n,n,window.location.pathname)}return u({},t,{push:function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var a=n[0],l=n.slice(1);return t.push.apply(t,[e(a)].concat(l))},replace:function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var a=n[0],l=n.slice(1);return t.replace.apply(t,[e(a)].concat(l))},prefetch:function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var a=n[0],l=n.slice(1);return t.prefetch.apply(t,[e(a)].concat(l))}})}),[n,t])}()},Object.keys(t).forEach((function(e){"default"===e||exports.hasOwnProperty(e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}));
2
2
  //# sourceMappingURL=next-intl.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.cjs.production.min.js","sources":["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx","../src/client/useRouter.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(href: string) {\n return router.push(localize(href));\n },\n replace(href: string) {\n return router.replace(localize(href));\n },\n prefetch(href: string) {\n return router.prefetch(localize(href));\n }\n };\n }, [locale, router]);\n}\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","params","useParams","useLocale","isLocalHref","href","host","hostname","test","localizeHref","locale","defaultLocale","pathname","startsWith","isRelativeHref","isSwitchingLocale","isPathnamePrefixed","prefix","hasPathnamePrefixed","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","React","createElement","NextLink","BaseLink$1","forwardRef","Link","Link$1","hasWarned","LinkDeprecated","props","console","warn","NextIntlClientProvider","router","children","now","useRouter","error","Date","Error","IntlProvider","LocalizedLink","useNextRouter","useMemo","localize","window","location","push","replace"],"mappings":"goBAQO,IAAMA,EAAsB,SCJrB,SAAUC,IACtB,IAIMC,EAASC,EAAAA,YASf,OAPID,MAAAA,GAAAA,EAASF,GACFE,EAAOF,GAGPI,EAASA,WAItB,CCRM,SAAUC,E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IACHG,QAAQC,KAAI,gSAGZJ,GAAY,GESF,WACZ,IAAMM,EAASS,EAAAA,YACTlD,EAASV,IAEf,OAAO6D,EAAOA,SAAC,WACb,SAASC,EAASzD,GAChB,OAAOI,EAAaJ,EAAMK,EAAQA,EAAQqD,OAAOC,SAASpD,SAC5D,CAEA,OAAAU,KACK6B,EAAM,CACTc,KAAI,SAAC5D,GACH,OAAO8C,EAAOc,KAAKH,EAASzD,GAC7B,EACD6D,QAAO,SAAC7D,GACN,OAAO8C,EAAOe,QAAQJ,EAASzD,GAChC,EACDuB,SAAQ,SAACvB,GACP,OAAO8C,EAAOvB,SAASkC,EAASzD,GAClC,GAEJ,GAAG,CAACK,EAAQyC,GACd,CF5BSG,EACT"}
1
+ {"version":3,"file":"next-intl.cjs.production.min.js","sources":["../src/shared/constants.tsx","../src/client/useClientLocale.tsx","../src/shared/utils.tsx","../src/shared/BaseLink.tsx","../src/link/Link.tsx","../src/react-client/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/react-client/useLocalizedRouter.tsx","../src/react-client/index.tsx","../src/client/useRouter.tsx"],"sourcesContent":["// Reuse the legacy cookie name\n// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie\nexport const COOKIE_LOCALE_NAME = 'NEXT_LOCALE';\n\n// Should take precedence over the cookie\nexport const HEADER_LOCALE_NAME = 'X-NEXT-INTL-LOCALE';\n\n// In a URL like \"/en-US/about\", the locale segment is \"en-US\"\nexport const LOCALE_SEGMENT_NAME = 'locale';\n","import {useParams} from 'next/navigation';\nimport {useLocale} from 'use-intl';\nimport {LOCALE_SEGMENT_NAME} from '../shared/constants';\n\nexport default function useClientLocale(): string {\n let locale;\n\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const params = useParams() as ReturnType<typeof useParams> | null;\n\n if (params?.[LOCALE_SEGMENT_NAME]) {\n locale = params[LOCALE_SEGMENT_NAME];\n } else {\n // eslint-disable-next-line react-hooks/rules-of-hooks -- Reading from context conditionally is fine\n locale = useLocale();\n }\n\n return locale;\n}\n","import {UrlObject} from 'url';\nimport NextLink from 'next/link';\nimport {ComponentProps} from 'react';\n\ntype Href = ComponentProps<typeof NextLink>['href'];\n\nexport function isRelativeHref(href: Href) {\n const pathname = typeof href === 'object' ? href.pathname : href;\n return pathname != null && !pathname.startsWith('/');\n}\n\nexport function isLocalHref(href: Href) {\n if (typeof href === 'object') {\n return href.host == null && href.hostname == null;\n } else {\n const hasProtocol = /^[a-z]+:/i.test(href);\n return !hasProtocol;\n }\n}\n\nexport function localizeHref(\n href: string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string,\n pathname: string\n): UrlObject | string;\nexport function localizeHref(\n href: UrlObject | string,\n locale: string,\n defaultLocale: string = locale,\n pathname: string\n) {\n if (!isLocalHref(href) || isRelativeHref(href)) {\n return href;\n }\n\n const isSwitchingLocale = locale !== defaultLocale;\n const isPathnamePrefixed =\n locale == null || hasPathnamePrefixed(locale, pathname);\n const shouldPrefix = isPathnamePrefixed || isSwitchingLocale;\n\n if (shouldPrefix && locale != null) {\n return prefixHref(href, locale);\n }\n\n return href;\n}\n\nexport function prefixHref(href: string, locale: string): string;\nexport function prefixHref(\n href: UrlObject | string,\n locale: string\n): UrlObject | string;\nexport function prefixHref(href: UrlObject | string, locale: string) {\n let prefixedHref;\n if (typeof href === 'string') {\n prefixedHref = localizePathname(locale, href);\n } else {\n prefixedHref = {...href};\n if (href.pathname) {\n prefixedHref.pathname = localizePathname(locale, href.pathname);\n }\n }\n\n return prefixedHref;\n}\n\nexport function unlocalizePathname(pathname: string, locale: string) {\n return pathname.replace(new RegExp(`^/${locale}`), '') || '/';\n}\n\nexport function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n\nexport function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return pathname === prefix || pathname.startsWith(`${prefix}/`);\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport {isLocalHref, localizeHref, prefixHref} from './utils';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale: string;\n};\n\nfunction BaseLink({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n // The types aren't entirely correct here. Outside of Next.js\n // `useParams` can be called, but the return type is `null`.\n const pathname = usePathname() as ReturnType<typeof usePathname> | null;\n\n const defaultLocale = useClientLocale();\n const isChangingLocale = locale !== defaultLocale;\n\n const [localizedHref, setLocalizedHref] = useState<typeof href>(() =>\n isLocalHref(href) && locale\n ? // Potentially the href shouldn't be prefixed, but to determine this we\n // need a) the default locale and b) the information if we use prefixed\n // routing. During the server side render (both in RSC as well as SSR),\n // we don't have this information. Therefore we always prefix the href\n // since this will always result in a valid URL, even if it might cause\n // a redirect. This is better than pointing to a non-localized href\n // during the server render, which would potentially be wrong. The final\n // href is determined in the effect below.\n prefixHref(href, locale)\n : href\n );\n\n useEffect(() => {\n if (!pathname) return;\n\n setLocalizedHref(\n localizeHref(href, locale, defaultLocale, pathname ?? undefined)\n );\n }, [defaultLocale, href, locale, pathname]);\n\n if (isChangingLocale) {\n if (prefetch && process.env.NODE_ENV !== 'production') {\n console.error(\n 'The `prefetch` prop is currently not supported when using the `locale` prop on `Link` to switch the locale.`'\n );\n }\n prefetch = false;\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(BaseLink);\n","import React, {ComponentProps, forwardRef} from 'react';\nimport useClientLocale from '../client/useClientLocale';\nimport BaseLink from '../shared/BaseLink';\n\ntype Props = Omit<ComponentProps<typeof BaseLink>, 'locale'> & {\n locale?: string;\n};\n\nfunction Link({locale, ...rest}: Props, ref: Props['ref']) {\n const defaultLocale = useClientLocale();\n return <BaseLink ref={ref} locale={locale || defaultLocale} {...rest} />;\n}\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale if\n * necessary.\n *\n * @example\n * ```tsx\n * import {Link} from 'next-intl';\n *\n * // When the user is on `/en`, the link will point to `/en/about`\n * <Link href=\"/about\">About</Link>\n *\n * // You can override the `locale` to switch to another language\n * <Link href=\"/\" locale=\"de\">Switch to German</Link>\n * ```\n *\n * Note that when a `locale` prop is passed to switch the locale, the `prefetch`\n * prop is not supported. This is because Next.js would prefetch the page and\n * the `set-cookie` response header would cause the locale cookie on the current\n * page to be overwritten before the user even decides to change the locale.\n */\nexport default forwardRef(Link);\n","import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n","'use client';\n\nimport {useRouter} from 'next/router';\nimport React, {ComponentProps} from 'react';\nimport {IntlProvider} from 'use-intl';\n\ntype Props = Omit<ComponentProps<typeof IntlProvider>, 'locale' | 'now'> & {\n locale?: string;\n /** If a string is supplied, make sure this conforms to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ */\n now?: Date | string;\n};\n\nexport default function NextIntlClientProvider({\n children,\n locale,\n now,\n ...rest\n}: Props) {\n let router;\n try {\n // Reading from context is practically ok to do conditionally\n // eslint-disable-next-line react-hooks/rules-of-hooks\n router = useRouter();\n } catch (error) {\n // Calling `useRouter` is not supported in the app folder\n }\n\n // The router can be undefined if used in a context outside\n // of Next.js (e.g. unit tests, Storybook, ...)\n if (!locale && router) {\n locale = router.locale;\n }\n\n // Currently RSC serialize dates to strings, therefore make sure we have\n // a date object. We might be able to remove this once more types have\n // first-class serialization support (https://github.com/facebook/react/issues/25687)\n if (typeof now === 'string') {\n now = new Date(now);\n }\n\n if (!locale) {\n throw new Error(\n process.env.NODE_ENV !== 'production'\n ? \"Couldn't determine locale. Please pass an explicit `locale` prop the provider, or if you're using the `pages` folder, use internationalized routing (https://nextjs.org/docs/advanced-features/i18n-routing).\"\n : undefined\n );\n }\n\n return (\n <IntlProvider locale={locale} now={now} {...rest}>\n {children}\n </IntlProvider>\n );\n}\n","import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n","/**\n * This is the main entry file when non-'react-server'\n * environments import from 'next-intl'.\n *\n * Maintainer notes:\n * - Make sure this mirrors the API from 'react-server'.\n * - Make sure everything exported from this module is\n * supported in all Next.js versions that are supported.\n */\n\nimport Link from './Link';\n\nexport * from 'use-intl';\nexport {default as NextIntlClientProvider} from '../shared/NextIntlClientProvider';\n\n// Legacy export (TBD if we'll deprecate this in favour of `NextIntlClientProvider`)\nexport {default as NextIntlProvider} from '../shared/NextIntlClientProvider';\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport const LocalizedLink = Link;\nexport {default as Link} from './Link';\n\nexport {default as useLocalizedRouter} from './useLocalizedRouter';\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport {localizeHref} from '../shared/utils';\nimport useClientLocale from './useClientLocale';\n\n/**\n * Returns a wrapped instance of `useRouter` from `next/navigation` that\n * will automatically localize the `href` parameters it receives.\n *\n * @example\n * ```tsx\n * 'use client';\n *\n * import {useRouter} from 'next-intl/client';\n *\n * const router = useRouter();\n *\n * // When the user is on `/en`, the router will navigate to `/en/about`\n * router.push('/about');\n * ```\n */\nexport default function useRouter() {\n const router = useNextRouter();\n const locale = useClientLocale();\n\n return useMemo(() => {\n function localize(href: string) {\n return localizeHref(href, locale, locale, window.location.pathname);\n }\n\n return {\n ...router,\n push(...[href, ...args]: Parameters<typeof router.push>) {\n return router.push(localize(href), ...args);\n },\n replace(...[href, ...args]: Parameters<typeof router.replace>) {\n return router.replace(localize(href), ...args);\n },\n prefetch(...[href, ...args]: Parameters<typeof router.prefetch>) {\n return router.prefetch(localize(href), ...args);\n }\n };\n }, [locale, router]);\n}\n"],"names":["LOCALE_SEGMENT_NAME","useClientLocale","params","useParams","useLocale","isLocalHref","href","host","hostname","test","localizeHref","locale","defaultLocale","pathname","startsWith","isRelativeHref","isSwitchingLocale","isPathnamePrefixed","prefix","hasPathnamePrefixed","prefixHref","prefixedHref","localizePathname","_extends","localizedHref","_excluded","BaseLink","_ref","ref","prefetch","rest","_objectWithoutPropertiesLoose","usePathname","isChangingLocale","_useState","useState","setLocalizedHref","useEffect","undefined","React","createElement","NextLink","BaseLink$1","forwardRef","Link","Link$1","hasWarned","LinkDeprecated","props","console","warn","NextIntlClientProvider","router","children","now","useRouter","error","Date","Error","IntlProvider","LocalizedLink","useNextRouter","useMemo","localize","window","location","push","_len","arguments","length","Array","_key","args","slice","apply","concat","replace","_len2","_ref2","_key2","_len3","_ref3","_key3"],"mappings":"goBAQO,IAAMA,EAAsB,SCJrB,SAAUC,IACtB,IAIMC,EAASC,EAAAA,YASf,OAPID,MAAAA,GAAAA,EAASF,GACFE,EAAOF,GAGPI,EAASA,WAItB,CCRM,SAAUC,EAAYC,GAC1B,MAAoB,iBAAT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J,GAAY,GESF,WACZ,IAAMM,EAASS,EAAAA,YACTlD,EAASV,IAEf,OAAO6D,EAAOA,SAAC,WACb,SAASC,EAASzD,GAChB,OAAOI,EAAaJ,EAAMK,EAAQA,EAAQqD,OAAOC,SAASpD,SAC5D,CAEA,OAAAU,KACK6B,EAAM,CACTc,KAAI,WAAmD,IAAA,IAAAC,EAAAC,UAAAC,OAAA1C,EAAA2C,IAAAA,MAAAH,GAAAI,EAAA,EAAAA,EAAAJ,EAAAI,IAAA5C,EAAA4C,GAAAH,UAAAG,GAAA,IAA9CjE,EAAIqB,EAAA,GAAK6C,EAAI7C,EAAA8C,MAAA,GACpB,OAAOrB,EAAOc,KAAIQ,MAAXtB,EAAM,CAAMW,EAASzD,IAAKqE,OAAKH,GACvC,EACDI,QAAO,WAAsD,IAAA,IAAAC,EAAAT,UAAAC,OAAAS,EAAAR,IAAAA,MAAAO,GAAAE,EAAA,EAAAA,EAAAF,EAAAE,IAAAD,EAAAC,GAAAX,UAAAW,GAAA,IAAjDzE,EAAIwE,EAAA,GAAKN,EAAIM,EAAAL,MAAA,GACvB,OAAOrB,EAAOwB,QAAOF,MAAdtB,EAAM,CAASW,EAASzD,IAAKqE,OAAKH,GAC1C,EACD3C,SAAQ,WAAuD,IAAA,IAAAmD,EAAAZ,UAAAC,OAAAY,EAAAX,IAAAA,MAAAU,GAAAE,EAAA,EAAAA,EAAAF,EAAAE,IAAAD,EAAAC,GAAAd,UAAAc,GAAA,IAAlD5E,EAAI2E,EAAA,GAAKT,EAAIS,EAAAR,MAAA,GACxB,OAAOrB,EAAOvB,SAAQ6C,MAAftB,EAAM,CAAUW,EAASzD,IAAKqE,OAAKH,GAC5C,GAEJ,GAAG,CAAC7D,EAAQyC,GACd,CF5BSG,EACT"}
@@ -5,7 +5,7 @@ import useRouter from '../client/next-intl.esm.js';
5
5
  var hasWarned = false;
6
6
  function useLocalizedRouterDeprecated() {
7
7
  if (!hasWarned) {
8
- console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\n\n");
8
+ console.warn("\n\nDEPRECATION WARNING: The `useLocalizedRouter` import from `next-intl` is deprecated and will be removed in the stable release of next-intl. Please import `useLocalizedRouter` from `next-intl/client` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\n\n");
9
9
  hasWarned = true;
10
10
  }
11
11
  return useRouter();
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.esm2.js","sources":["../../src/react-client/useLocalizedRouter.tsx"],"sourcesContent":["import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n"],"names":["hasWarned","useLocalizedRouterDeprecated","console","warn","useRouter"],"mappings":";;AAEA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAEP,SAAUC,4BAA4BA,GAAA;EAClD,IAAI,CAACD,SAAS,EAAE;IACdE,OAAO,CAACC,IAAI,CAAA,8RAC4R,CACvS,CAAA;AACDH,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOI,SAAS,EAAE,CAAA;AACpB;;;;"}
1
+ {"version":3,"file":"next-intl.esm2.js","sources":["../../src/react-client/useLocalizedRouter.tsx"],"sourcesContent":["import useRouter from '../client/useRouter';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\nexport default function useLocalizedRouterDeprecated() {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The \\`useLocalizedRouter\\` import from \\`next-intl\\` is deprecated and will be removed in the stable release of next-intl. Please import \\`useLocalizedRouter\\` from \\`next-intl/client\\` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\\n\\n`\n );\n hasWarned = true;\n }\n\n return useRouter();\n}\n"],"names":["hasWarned","useLocalizedRouterDeprecated","console","warn","useRouter"],"mappings":";;AAEA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAEP,SAAUC,4BAA4BA,GAAA;EAClD,IAAI,CAACD,SAAS,EAAE;IACdE,OAAO,CAACC,IAAI,CAAA,iTAC+S,CAC1T,CAAA;AACDH,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOI,SAAS,EAAE,CAAA;AACpB;;;;"}
@@ -8,7 +8,7 @@ var hasWarned = false;
8
8
  /** @deprecated Is available as `import Link from 'next-intl/link'` now. */
9
9
  function LinkDeprecated(props) {
10
10
  if (!hasWarned) {
11
- console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n");
11
+ console.warn("\n\nDEPRECATION WARNING: The import for `Link` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n");
12
12
  hasWarned = true;
13
13
  }
14
14
  return React.createElement(Link, _extends({}, props));
@@ -1 +1 @@
1
- {"version":3,"file":"next-intl.esm3.js","sources":["../../src/react-client/Link.tsx"],"sourcesContent":["import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n"],"names":["hasWarned","LinkDeprecated","props","console","warn","React","createElement","Link","_extends"],"mappings":";;;;AAGA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAErB;AACwB,SAAAC,cAAcA,CAACC,KAAkC,EAAA;EACvE,IAAI,CAACF,SAAS,EAAE;IACdG,OAAO,CAACC,IAAI,CAAA,kSAMoG,CAC/G,CAAA;AACDJ,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOK,KAAC,CAAAC,aAAA,CAAAC,IAAI,EAAAC,QAAA,CAAA,EAAA,EAAKN,KAAK,EAAI,CAAA;AAC5B;;;;"}
1
+ {"version":3,"file":"next-intl.esm3.js","sources":["../../src/react-client/Link.tsx"],"sourcesContent":["import React, {ComponentProps} from 'react';\nimport Link from '../link';\n\n// TODO: Only available for backwards compatibility\n// during the beta, remove for stable release\n\nlet hasWarned = false;\n\n/** @deprecated Is available as `import Link from 'next-intl/link'` now. */\nexport default function LinkDeprecated(props: ComponentProps<typeof Link>) {\n if (!hasWarned) {\n console.warn(\n `\\n\\nDEPRECATION WARNING: The import for \\`Link\\` from next-intl has changed.\n\nPreviously: import {Link} from 'next-intl';\nNow: import Link from 'next-intl/link';\n\nPlease upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\\n\\n`\n );\n hasWarned = true;\n }\n\n return <Link {...props} />;\n}\n"],"names":["hasWarned","LinkDeprecated","props","console","warn","React","createElement","Link","_extends"],"mappings":";;;;AAGA;AACA;AAEA,IAAIA,SAAS,GAAG,KAAK,CAAA;AAErB;AACwB,SAAAC,cAAcA,CAACC,KAAkC,EAAA;EACvE,IAAI,CAACF,SAAS,EAAE;IACdG,OAAO,CAACC,IAAI,CAAA,kSAMoG,CAC/G,CAAA;AACDJ,IAAAA,SAAS,GAAG,IAAI,CAAA;AACjB,GAAA;EAED,OAAOK,KAAC,CAAAC,aAAA,CAAAC,IAAI,EAAAC,QAAA,CAAA,EAAA,EAAKN,KAAK,EAAI,CAAA;AAC5B;;;;"}
@@ -1,7 +1,7 @@
1
1
  export default function useLocalizedRouterDeprecated(): {
2
- push(href: string): void;
3
- replace(href: string): void;
4
- prefetch(href: string): void;
2
+ push(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
3
+ replace(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
4
+ prefetch(href: string, options?: import("next/dist/shared/lib/app-router-context").PrefetchOptions | undefined): void;
5
5
  back(): void;
6
6
  forward(): void;
7
7
  refresh(): void;
@@ -0,0 +1,42 @@
1
+ import { ReactElement, ReactNodeArray } from 'react';
2
+ import type Formats from 'use-intl/dist/src/core/Formats';
3
+ import type TranslationValues from 'use-intl/dist/src/core/TranslationValues';
4
+ import type { RichTranslationValues } from 'use-intl/dist/src/core/TranslationValues';
5
+ import MessageKeys from 'use-intl/dist/src/core/utils/MessageKeys';
6
+ import NamespaceKeys from 'use-intl/dist/src/core/utils/NamespaceKeys';
7
+ import NestedKeyOf from 'use-intl/dist/src/core/utils/NestedKeyOf';
8
+ import NestedValueOf from 'use-intl/dist/src/core/utils/NestedValueOf';
9
+ declare function getTranslatorImpl<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(locale: string | {
10
+ namespace?: NestedKey;
11
+ locale: string;
12
+ }, namespace?: NestedKey): Promise<{
13
+ <TargetKey extends MessageKeys<NestedValueOf<{
14
+ '!': IntlMessages;
15
+ }, [
16
+ NestedKey
17
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
18
+ '!': IntlMessages;
19
+ }, [
20
+ NestedKey
21
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
22
+ rich<TargetKey extends MessageKeys<NestedValueOf<{
23
+ '!': IntlMessages;
24
+ }, [
25
+ NestedKey
26
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
27
+ '!': IntlMessages;
28
+ }, [
29
+ NestedKey
30
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Partial<Formats>): string | ReactElement | ReactNodeArray;
31
+ raw<TargetKey extends MessageKeys<NestedValueOf<{
32
+ '!': IntlMessages;
33
+ }, [
34
+ NestedKey
35
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
36
+ '!': IntlMessages;
37
+ }, [
38
+ NestedKey
39
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
40
+ }>;
41
+ declare const _default: typeof getTranslatorImpl;
42
+ export default _default;
@@ -15,9 +15,9 @@
15
15
  * ```
16
16
  */
17
17
  export default function useRouter(): {
18
- push(href: string): void;
19
- replace(href: string): void;
20
- prefetch(href: string): void;
18
+ push(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
19
+ replace(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
20
+ prefetch(href: string, options?: import("next/dist/shared/lib/app-router-context").PrefetchOptions | undefined): void;
21
21
  back(): void;
22
22
  forward(): void;
23
23
  refresh(): void;
@@ -27,14 +27,14 @@ export default function useRouter() {
27
27
  }
28
28
  return {
29
29
  ...router,
30
- push(href) {
31
- return router.push(localize(href));
30
+ push(...[href, ...args]) {
31
+ return router.push(localize(href), ...args);
32
32
  },
33
- replace(href) {
34
- return router.replace(localize(href));
33
+ replace(...[href, ...args]) {
34
+ return router.replace(localize(href), ...args);
35
35
  },
36
- prefetch(href) {
37
- return router.prefetch(localize(href));
36
+ prefetch(...[href, ...args]) {
37
+ return router.prefetch(localize(href), ...args);
38
38
  }
39
39
  };
40
40
  }, [locale, router]);
@@ -1 +1 @@
1
- {"version":3,"file":"useRouter.js","sourceRoot":"","sources":["../../../src/client/useRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,IAAI,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IAEjC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,SAAS,QAAQ,CAAC,IAAY;YAC5B,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtE,CAAC;QAED,OAAO;YACL,GAAG,MAAM;YACT,IAAI,CAAC,IAAY;gBACf,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,CAAC,IAAY;gBAClB,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACxC,CAAC;YACD,QAAQ,CAAC,IAAY;gBACnB,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACzC,CAAC;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACvB,CAAC"}
1
+ {"version":3,"file":"useRouter.js","sourceRoot":"","sources":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
  Previously: import {Link} from 'next-intl';
12
12
  Now: import Link from 'next-intl/link';
13
13
 
14
- Please upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n`);
14
+ Please upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n`);
15
15
  hasWarned = true;
16
16
  }
17
17
  return React.createElement(Link, { ...props });
@@ -1,7 +1,7 @@
1
1
  export default function useLocalizedRouterDeprecated(): {
2
- push(href: string): void;
3
- replace(href: string): void;
4
- prefetch(href: string): void;
2
+ push(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
3
+ replace(href: string, options?: import("next/dist/shared/lib/app-router-context").NavigateOptions | undefined): void;
4
+ prefetch(href: string, options?: import("next/dist/shared/lib/app-router-context").PrefetchOptions | undefined): void;
5
5
  back(): void;
6
6
  forward(): void;
7
7
  refresh(): void;
@@ -4,7 +4,7 @@ import useRouter from '../client/useRouter';
4
4
  let hasWarned = false;
5
5
  export default function useLocalizedRouterDeprecated() {
6
6
  if (!hasWarned) {
7
- console.warn(`\n\nDEPRECATION WARNING: The \`useLocalizedRouter\` import from \`next-intl\` is deprecated and will be removed in the stable release of next-intl. Please import \`useLocalizedRouter\` from \`next-intl/client\` instead. See https://next-intl-docs.vercel.app/docs/next-13/server-components\n\n`);
7
+ console.warn(`\n\nDEPRECATION WARNING: The \`useLocalizedRouter\` import from \`next-intl\` is deprecated and will be removed in the stable release of next-intl. Please import \`useLocalizedRouter\` from \`next-intl/client\` instead. See https://next-intl-docs.vercel.app/docs/getting-started/app-router-server-components\n\n`);
8
8
  hasWarned = true;
9
9
  }
10
10
  return useRouter();
@@ -1 +1 @@
1
- {"version":3,"file":"useLocalizedRouter.js","sourceRoot":"","sources":["../../../src/react-client/useLocalizedRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAE5C,mDAAmD;AACnD,6CAA6C;AAE7C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,CAAC,OAAO,UAAU,4BAA4B;IAClD,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,CAAC,IAAI,CACV,sSAAsS,CACvS,CAAC;QACF,SAAS,GAAG,IAAI,CAAC;KAClB;IAED,OAAO,SAAS,EAAE,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"useLocalizedRouter.js","sourceRoot":"","sources":["../../../src/react-client/useLocalizedRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAE5C,mDAAmD;AACnD,6CAA6C;AAE7C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,CAAC,OAAO,UAAU,4BAA4B;IAClD,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,CAAC,IAAI,CACV,yTAAyT,CAC1T,CAAC;QACF,SAAS,GAAG,IAAI,CAAC;KAClB;IAED,OAAO,SAAS,EAAE,CAAC;AACrB,CAAC"}
@@ -11,7 +11,7 @@ export default function LinkDeprecated(props) {
11
11
  Previously: import {Link} from 'next-intl';
12
12
  Now: import Link from 'next-intl/link';
13
13
 
14
- Please upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/next-13/navigation#link\n\n`);
14
+ Please upgrade your import accordingly. See also https://next-intl-docs.vercel.app/docs/routing/navigation#link\n\n`);
15
15
  hasWarned = true;
16
16
  }
17
17
  return React.createElement(Link, { ...props });
@@ -0,0 +1,42 @@
1
+ import { ReactElement, ReactNodeArray } from 'react';
2
+ import type Formats from 'use-intl/dist/src/core/Formats';
3
+ import type TranslationValues from 'use-intl/dist/src/core/TranslationValues';
4
+ import type { RichTranslationValues } from 'use-intl/dist/src/core/TranslationValues';
5
+ import MessageKeys from 'use-intl/dist/src/core/utils/MessageKeys';
6
+ import NamespaceKeys from 'use-intl/dist/src/core/utils/NamespaceKeys';
7
+ import NestedKeyOf from 'use-intl/dist/src/core/utils/NestedKeyOf';
8
+ import NestedValueOf from 'use-intl/dist/src/core/utils/NestedValueOf';
9
+ declare function getTranslatorImpl<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(locale: string | {
10
+ namespace?: NestedKey;
11
+ locale: string;
12
+ }, namespace?: NestedKey): Promise<{
13
+ <TargetKey extends MessageKeys<NestedValueOf<{
14
+ '!': IntlMessages;
15
+ }, [
16
+ NestedKey
17
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
18
+ '!': IntlMessages;
19
+ }, [
20
+ NestedKey
21
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
22
+ rich<TargetKey extends MessageKeys<NestedValueOf<{
23
+ '!': IntlMessages;
24
+ }, [
25
+ NestedKey
26
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
27
+ '!': IntlMessages;
28
+ }, [
29
+ NestedKey
30
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Partial<Formats>): string | ReactElement | ReactNodeArray;
31
+ raw<TargetKey extends MessageKeys<NestedValueOf<{
32
+ '!': IntlMessages;
33
+ }, [
34
+ NestedKey
35
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
36
+ '!': IntlMessages;
37
+ }, [
38
+ NestedKey
39
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
40
+ }>;
41
+ declare const _default: typeof getTranslatorImpl;
42
+ export default _default;