next-intl
Advanced tools
function getConfig() { | ||
throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl-docs.vercel.app/docs/getting-started/app-router"); | ||
throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router"); | ||
} | ||
export { getConfig as default }; |
@@ -1,2 +0,2 @@ | ||
import { NextResponse } from 'next/server.js'; | ||
import { NextResponse } from 'next/server'; | ||
import { receiveRoutingConfig } from '../routing/config.js'; | ||
@@ -3,0 +3,0 @@ import { HEADER_LOCALE_NAME } from '../shared/constants.js'; |
@@ -1,2 +0,2 @@ | ||
import { useRouter, usePathname } from 'next/navigation.js'; | ||
import { useRouter, usePathname } from 'next/navigation'; | ||
import { useMemo } from 'react'; | ||
@@ -17,5 +17,5 @@ import { useLocale } from 'use-intl'; | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#usepathname */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#usepathname */ | ||
function usePathname$1() { | ||
const pathname = useBasePathname(config.localePrefix); | ||
const pathname = useBasePathname(config); | ||
const locale = useLocale(); | ||
@@ -59,7 +59,7 @@ | ||
...router, | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#userouter */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#userouter */ | ||
push: createHandler(router.push), | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#userouter */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#userouter */ | ||
replace: createHandler(router.replace), | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#userouter */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#userouter */ | ||
prefetch: createHandler(router.prefetch) | ||
@@ -66,0 +66,0 @@ }; |
@@ -1,7 +0,7 @@ | ||
import { usePathname } from 'next/navigation.js'; | ||
import { usePathname } from 'next/navigation'; | ||
import { useMemo } from 'react'; | ||
import { useLocale } from 'use-intl'; | ||
import { hasPathnamePrefixed, unprefixPathname, getLocalePrefix } from '../../shared/utils.js'; | ||
import { hasPathnamePrefixed, unprefixPathname, getLocalePrefix, getLocaleAsPrefix } from '../../shared/utils.js'; | ||
function useBasePathname(localePrefix) { | ||
function useBasePathname(config) { | ||
// The types aren't entirely correct here. Outside of Next.js | ||
@@ -20,9 +20,18 @@ // `useParams` can be called, but the return type is `null`. | ||
if (!pathname) return pathname; | ||
const prefix = getLocalePrefix(locale, localePrefix); | ||
let unlocalizedPathname = pathname; | ||
const prefix = getLocalePrefix(locale, config.localePrefix); | ||
const isPathnamePrefixed = hasPathnamePrefixed(prefix, pathname); | ||
const unlocalizedPathname = isPathnamePrefixed ? unprefixPathname(pathname, prefix) : pathname; | ||
if (isPathnamePrefixed) { | ||
unlocalizedPathname = unprefixPathname(pathname, prefix); | ||
} else if (config.localePrefix.mode === 'as-needed' && config.localePrefix.prefixes) { | ||
// Workaround for https://github.com/vercel/next.js/issues/73085 | ||
const localeAsPrefix = getLocaleAsPrefix(locale); | ||
if (hasPathnamePrefixed(localeAsPrefix, pathname)) { | ||
unlocalizedPathname = unprefixPathname(pathname, localeAsPrefix); | ||
} | ||
} | ||
return unlocalizedPathname; | ||
}, [locale, localePrefix, pathname]); | ||
}, [config.localePrefix, locale, pathname]); | ||
} | ||
export { useBasePathname as default }; |
"use client"; | ||
import NextLink from 'next/link.js'; | ||
import { usePathname } from 'next/navigation.js'; | ||
import NextLink from 'next/link'; | ||
import { usePathname } from 'next/navigation'; | ||
import { forwardRef, useState, useEffect } from 'react'; | ||
@@ -5,0 +5,0 @@ import { useLocale } from 'use-intl'; |
@@ -1,2 +0,2 @@ | ||
import { redirect, permanentRedirect } from 'next/navigation.js'; | ||
import { redirect, permanentRedirect } from 'next/navigation'; | ||
import { forwardRef } from 'react'; | ||
@@ -119,3 +119,3 @@ import { receiveRoutingConfig } from '../../routing/config.js'; | ||
function getRedirectFn(fn) { | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#redirect */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#redirect */ | ||
return function redirectFn(args, ...rest) { | ||
@@ -122,0 +122,0 @@ return fn( |
@@ -136,3 +136,3 @@ import { getSortedPathnames, matchesPathname, isLocalizableHref, prefixPathname, getLocalePrefix, normalizeTrailingSlash } from '../../shared/utils.js'; | ||
if (!domain) { | ||
console.error("You're using a routing configuration with `localePrefix: 'as-needed'` in combination with `domains`. In order to compute a correct pathname, you need to provide a `domain` parameter.\n\nSee: https://next-intl-docs.vercel.app/docs/routing#domains-localeprefix-asneeded"); | ||
console.error("You're using a routing configuration with `localePrefix: 'as-needed'` in combination with `domains`. In order to compute a correct pathname, you need to provide a `domain` parameter.\n\nSee: https://next-intl.dev/docs/routing#domains-localeprefix-asneeded"); | ||
} | ||
@@ -139,0 +139,0 @@ } |
@@ -49,3 +49,3 @@ import fs from 'fs'; | ||
return `// This file is auto-generated by next-intl, do not edit directly. | ||
// See: https://next-intl-docs.vercel.app/docs/workflows/typescript#messages-arguments | ||
// See: https://next-intl.dev/docs/workflows/typescript#messages-arguments | ||
@@ -52,0 +52,0 @@ declare const messages: ${content.trim()}; |
@@ -7,3 +7,3 @@ import createMessagesDeclaration from './createMessagesDeclaration.js'; | ||
if (nextConfig?.i18n != null) { | ||
warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n"); | ||
warn("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n"); | ||
} | ||
@@ -10,0 +10,0 @@ if (pluginConfig.experimental?.createMessagesDeclaration) { |
@@ -28,3 +28,3 @@ import { useTranslations as useTranslations$1, useFormatter as useFormatter$1 } from 'use-intl'; | ||
2) You intended to render this component on the client side, but no context was found. | ||
Learn more about this error here: https://next-intl-docs.vercel.app/docs/environments/server-client-components#missing-context` ); | ||
Learn more about this error here: https://next-intl.dev/docs/environments/server-client-components#missing-context` ); | ||
} | ||
@@ -31,0 +31,0 @@ }; |
@@ -9,3 +9,3 @@ import getConfig from '../server/react-server/getConfig.js'; | ||
if (error instanceof TypeError && error.message.includes("Cannot read properties of null (reading 'use')")) { | ||
throw new Error(`\`${hookName}\` is not callable within an async component. Please refer to https://next-intl-docs.vercel.app/docs/environments/server-client-components#async-components`, { | ||
throw new Error(`\`${hookName}\` is not callable within an async component. Please refer to https://next-intl.dev/docs/environments/server-client-components#async-components`, { | ||
cause: error | ||
@@ -12,0 +12,0 @@ }); |
@@ -20,3 +20,3 @@ import { cache } from 'react'; | ||
See also: https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request | ||
See also: https://next-intl.dev/docs/usage/configuration#i18n-request | ||
`); | ||
@@ -37,3 +37,3 @@ } | ||
if (!result.locale) { | ||
throw new Error('No locale was returned from `getRequestConfig`.\n\nSee https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request'); | ||
throw new Error('No locale was returned from `getRequestConfig`.\n\nSee https://next-intl.dev/docs/usage/configuration#i18n-request'); | ||
} | ||
@@ -40,0 +40,0 @@ return result; |
import { cache } from 'react'; | ||
function defaultNow() { | ||
// See https://next-intl-docs.vercel.app/docs/usage/dates-times#relative-times-server | ||
// See https://next-intl.dev/docs/usage/dates-times#relative-times-server | ||
return new Date(); | ||
@@ -6,0 +6,0 @@ } |
@@ -6,3 +6,3 @@ import { cache } from 'react'; | ||
if (!config.messages) { | ||
throw new Error('No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages'); | ||
throw new Error('No messages found. Have you configured them correctly? See https://next-intl.dev/docs/configuration#messages'); | ||
} | ||
@@ -9,0 +9,0 @@ return config.messages; |
@@ -9,7 +9,7 @@ import { cache } from 'react'; | ||
// CALL SIGNATURE 1: `getTranslations(namespace)` | ||
// Call signature 1: `getTranslations(namespace)` | ||
// CALL SIGNATURE 2: `getTranslations({locale, namespace})` | ||
// Call signature 2: `getTranslations({locale, namespace})` | ||
// IMPLEMENTATION | ||
// Implementation | ||
async function getTranslations(namespaceOrOpts) { | ||
@@ -16,0 +16,0 @@ let namespace; |
@@ -1,2 +0,2 @@ | ||
import { headers } from 'next/headers.js'; | ||
import { headers } from 'next/headers'; | ||
import { cache } from 'react'; | ||
@@ -19,3 +19,3 @@ import { HEADER_LOCALE_NAME } from '../../shared/constants.js'; | ||
if (error instanceof Error && error.digest === 'DYNAMIC_SERVER_USAGE') { | ||
const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering', { | ||
const wrappedError = new Error('Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering', { | ||
cause: error | ||
@@ -22,0 +22,0 @@ }); |
@@ -10,3 +10,3 @@ "use client"; | ||
if (!locale) { | ||
throw new Error("Couldn't infer the `locale` prop in `NextIntlClientProvider`, please provide it explicitly.\n\nSee https://next-intl-docs.vercel.app/docs/configuration#locale" ); | ||
throw new Error("Couldn't infer the `locale` prop in `NextIntlClientProvider`, please provide it explicitly.\n\nSee https://next-intl.dev/docs/configuration#locale" ); | ||
} | ||
@@ -13,0 +13,0 @@ return /*#__PURE__*/jsx(IntlProvider, { |
@@ -64,4 +64,7 @@ function isRelativeHref(href) { | ||
// to decide to use it or not. | ||
'/' + locale; | ||
getLocaleAsPrefix(locale); | ||
} | ||
function getLocaleAsPrefix(locale) { | ||
return '/' + locale; | ||
} | ||
function templateToRegex(template) { | ||
@@ -124,2 +127,2 @@ const regexPattern = template | ||
export { getLocalePrefix, getSortedPathnames, hasPathnamePrefixed, isLocalizableHref, matchesPathname, normalizeTrailingSlash, prefixPathname, templateToRegex, unprefixPathname }; | ||
export { getLocaleAsPrefix, getLocalePrefix, getSortedPathnames, hasPathnamePrefixed, isLocalizableHref, matchesPathname, normalizeTrailingSlash, prefixPathname, templateToRegex, unprefixPathname }; |
@@ -1,1 +0,1 @@ | ||
function t(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl-docs.vercel.app/docs/getting-started/app-router")}export{t as default}; | ||
function t(){throw new Error("Couldn't find next-intl config file. Please follow the instructions at https://next-intl.dev/docs/getting-started/app-router")}export{t as default}; |
@@ -1,1 +0,1 @@ | ||
import{NextResponse as e}from"next/server.js";import{receiveRoutingConfig as t}from"../routing/config.js";import{HEADER_LOCALE_NAME as r}from"../shared/constants.js";import{matchesPathname as o,normalizeTrailingSlash as a,getLocalePrefix as l}from"../shared/utils.js";import n from"./getAlternateLinksHeaderValue.js";import s from"./resolveLocale.js";import i from"./syncCookie.js";import{sanitizePathname as c,isLocaleSupportedOnDomain as d,getNormalizedPathname as f,getPathnameMatch as m,getInternalTemplate as h,formatTemplatePathname as x,formatPathname as p,getBestMatchingDomain as u,applyBasePath as U,getLocaleAsPrefix as P}from"./utils.js";function g(g){const v=t(g);return function(t){let g;try{g=decodeURI(t.nextUrl.pathname)}catch{return e.next()}const L=c(g),{domain:j,locale:w}=s(v,t.headers,t.cookies,L),k=j?j.defaultLocale===w:w===v.defaultLocale,b=v.domains?.filter((e=>d(w,e)))||[],y=null!=v.domains&&!j;function R(o){const a=new URL(o,t.url);t.nextUrl.basePath&&(a.pathname=U(a.pathname,t.nextUrl.basePath));const l=new Headers(t.headers);return l.set(r,w),e.rewrite(a,{request:{headers:l}})}function q(r,o){const l=new URL(r,t.url);if(l.pathname=a(l.pathname),b.length>0&&!o&&j){const e=u(j,w,b);e&&(o=e.domain,e.defaultLocale===w&&"as-needed"===v.localePrefix.mode&&(l.pathname=f(l.pathname,v.locales,v.localePrefix)))}return o&&(l.host=o,t.headers.get("x-forwarded-host")&&(l.protocol=t.headers.get("x-forwarded-proto")??t.nextUrl.protocol,l.port=t.headers.get("x-forwarded-port")??"")),t.nextUrl.basePath&&(l.pathname=U(l.pathname,t.nextUrl.basePath)),e.redirect(l.toString())}const H=f(L,v.locales,v.localePrefix),z=m(L,v.locales,v.localePrefix),A=null!=z,C="never"===v.localePrefix.mode||k&&"as-needed"===v.localePrefix.mode;let I,S,V=H;const B=v.pathnames;if(B){let e;if([e,S]=h(B,H,w),S){const r=B[S],a="string"==typeof r?r:r[w];if(o(a,H))V=x(H,a,S);else{let o;o=e?"string"==typeof r?r:r[e]:S;const n=C?void 0:l(w,v.localePrefix),s=x(H,o,a);I=q(p(s,n,t.nextUrl.search))}}}if(!I)if("/"!==V||A){const e=p(V,P(w),t.nextUrl.search);if(A){const r=p(H,z.prefix,t.nextUrl.search);if("never"===v.localePrefix.mode)I=q(p(H,void 0,t.nextUrl.search));else if(z.exact)if(k&&C)I=q(p(H,void 0,t.nextUrl.search));else if(v.domains){const t=u(j,z.locale,b);I=j?.domain===t?.domain||y?R(e):q(r,t?.domain)}else I=R(e);else I=q(r)}else I=C?R(e):q(p(H,l(w,v.localePrefix),t.nextUrl.search))}else I=C?R(p(V,P(w),t.nextUrl.search)):q(p(H,l(w,v.localePrefix),t.nextUrl.search));return i(t,I,w,v,j),"never"!==v.localePrefix.mode&&v.alternateLinks&&v.locales.length>1&&I.headers.set("Link",n({routing:v,localizedPathnames:null!=S&&B?B[S]:void 0,request:t,resolvedLocale:w})),I}}export{g as default}; | ||
import{NextResponse as e}from"next/server";import{receiveRoutingConfig as t}from"../routing/config.js";import{HEADER_LOCALE_NAME as r}from"../shared/constants.js";import{matchesPathname as o,normalizeTrailingSlash as a,getLocalePrefix as l}from"../shared/utils.js";import n from"./getAlternateLinksHeaderValue.js";import s from"./resolveLocale.js";import i from"./syncCookie.js";import{sanitizePathname as c,isLocaleSupportedOnDomain as d,getNormalizedPathname as f,getPathnameMatch as m,getInternalTemplate as h,formatTemplatePathname as x,formatPathname as p,getBestMatchingDomain as u,applyBasePath as U,getLocaleAsPrefix as P}from"./utils.js";function g(g){const v=t(g);return function(t){let g;try{g=decodeURI(t.nextUrl.pathname)}catch{return e.next()}const L=c(g),{domain:j,locale:w}=s(v,t.headers,t.cookies,L),k=j?j.defaultLocale===w:w===v.defaultLocale,b=v.domains?.filter((e=>d(w,e)))||[],y=null!=v.domains&&!j;function R(o){const a=new URL(o,t.url);t.nextUrl.basePath&&(a.pathname=U(a.pathname,t.nextUrl.basePath));const l=new Headers(t.headers);return l.set(r,w),e.rewrite(a,{request:{headers:l}})}function q(r,o){const l=new URL(r,t.url);if(l.pathname=a(l.pathname),b.length>0&&!o&&j){const e=u(j,w,b);e&&(o=e.domain,e.defaultLocale===w&&"as-needed"===v.localePrefix.mode&&(l.pathname=f(l.pathname,v.locales,v.localePrefix)))}return o&&(l.host=o,t.headers.get("x-forwarded-host")&&(l.protocol=t.headers.get("x-forwarded-proto")??t.nextUrl.protocol,l.port=t.headers.get("x-forwarded-port")??"")),t.nextUrl.basePath&&(l.pathname=U(l.pathname,t.nextUrl.basePath)),e.redirect(l.toString())}const H=f(L,v.locales,v.localePrefix),z=m(L,v.locales,v.localePrefix),A=null!=z,C="never"===v.localePrefix.mode||k&&"as-needed"===v.localePrefix.mode;let I,S,V=H;const B=v.pathnames;if(B){let e;if([e,S]=h(B,H,w),S){const r=B[S],a="string"==typeof r?r:r[w];if(o(a,H))V=x(H,a,S);else{let o;o=e?"string"==typeof r?r:r[e]:S;const n=C?void 0:l(w,v.localePrefix),s=x(H,o,a);I=q(p(s,n,t.nextUrl.search))}}}if(!I)if("/"!==V||A){const e=p(V,P(w),t.nextUrl.search);if(A){const r=p(H,z.prefix,t.nextUrl.search);if("never"===v.localePrefix.mode)I=q(p(H,void 0,t.nextUrl.search));else if(z.exact)if(k&&C)I=q(p(H,void 0,t.nextUrl.search));else if(v.domains){const t=u(j,z.locale,b);I=j?.domain===t?.domain||y?R(e):q(r,t?.domain)}else I=R(e);else I=q(r)}else I=C?R(e):q(p(H,l(w,v.localePrefix),t.nextUrl.search))}else I=C?R(p(V,P(w),t.nextUrl.search)):q(p(H,l(w,v.localePrefix),t.nextUrl.search));return i(t,I,w,v,j),"never"!==v.localePrefix.mode&&v.alternateLinks&&v.locales.length>1&&I.headers.set("Link",n({routing:v,localizedPathnames:null!=S&&B?B[S]:void 0,request:t,resolvedLocale:w})),I}}export{g as default}; |
@@ -1,1 +0,1 @@ | ||
import{useRouter as e,usePathname as t}from"next/navigation.js";import{useMemo as o}from"react";import{useLocale as n}from"use-intl";import r from"../shared/createSharedNavigationFns.js";import a from"../shared/syncLocaleCookie.js";import{getRoute as s}from"../shared/utils.js";import i from"./useBasePathname.js";function c(c){const{Link:m,config:u,getPathname:f,...h}=r(n,c);return{...h,Link:m,usePathname:function(){const e=i(u.localePrefix),t=n();return o((()=>e&&u.pathnames?s(t,e,u.pathnames):e),[t,e])},useRouter:function(){const r=e(),s=n(),i=t();return o((()=>{function e(e){return function(t,o){const{locale:n,...r}=o||{},c=[f({href:t,locale:n||s,domain:window.location.host})];Object.keys(r).length>0&&c.push(r),e(...c),a(u.localeCookie,i,s,n)}}return{...r,push:e(r.push),replace:e(r.replace),prefetch:e(r.prefetch)}}),[s,i,r])},getPathname:f}}export{c as default}; | ||
import{useRouter as e,usePathname as t}from"next/navigation";import{useMemo as o}from"react";import{useLocale as n}from"use-intl";import r from"../shared/createSharedNavigationFns.js";import a from"../shared/syncLocaleCookie.js";import{getRoute as s}from"../shared/utils.js";import i from"./useBasePathname.js";function c(c){const{Link:m,config:u,getPathname:h,...f}=r(n,c);return{...f,Link:m,usePathname:function(){const e=i(u),t=n();return o((()=>e&&u.pathnames?s(t,e,u.pathnames):e),[t,e])},useRouter:function(){const r=e(),s=n(),i=t();return o((()=>{function e(e){return function(t,o){const{locale:n,...r}=o||{},c=[h({href:t,locale:n||s,domain:window.location.host})];Object.keys(r).length>0&&c.push(r),e(...c),a(u.localeCookie,i,s,n)}}return{...r,push:e(r.push),replace:e(r.replace),prefetch:e(r.prefetch)}}),[s,i,r])},getPathname:h}}export{c as default}; |
@@ -1,1 +0,1 @@ | ||
import{usePathname as r}from"next/navigation.js";import{useMemo as t}from"react";import{useLocale as o}from"use-intl";import{hasPathnamePrefixed as n,unprefixPathname as i,getLocalePrefix as e}from"../../shared/utils.js";function m(m){const s=r(),f=o();return t((()=>{if(!s)return s;const r=e(f,m);return n(r,s)?i(s,r):s}),[f,m,s])}export{m as default}; | ||
import{usePathname as e}from"next/navigation";import{useMemo as r}from"react";import{useLocale as o}from"use-intl";import{hasPathnamePrefixed as t,unprefixPathname as i,getLocalePrefix as f,getLocaleAsPrefix as l}from"../../shared/utils.js";function n(n){const s=e(),a=o();return r((()=>{if(!s)return s;let e=s;const r=f(a,n.localePrefix);if(t(r,s))e=i(s,r);else if("as-needed"===n.localePrefix.mode&&n.localePrefix.prefixes){const r=l(a);t(r,s)&&(e=i(s,r))}return e}),[n.localePrefix,a,s])}export{n as default}; |
"use client"; | ||
import o from"next/link.js";import{usePathname as e}from"next/navigation.js";import{forwardRef as n,useState as t,useEffect as r}from"react";import{useLocale as i}from"use-intl";import c from"./syncLocaleCookie.js";import{jsx as a}from"react/jsx-runtime";function f({defaultLocale:n,href:f,locale:l,localeCookie:m,onClick:s,prefetch:u,unprefixed:p,...d},h){const k=i(),j=null!=l&&l!==k,x=l||k,C=function(){const[o,e]=t();return r((()=>{e(window.location.host)}),[]),o}(),v=C&&p&&(p.domains[C]===x||!Object.keys(p.domains).includes(C)&&k===n&&!l)?p.pathname:f,L=e();j&&(u=!1);return a(o,{ref:h,href:v,hrefLang:j?l:void 0,onClick:function(o){c(m,L,k,l),s&&s(o)},prefetch:u,...d})}var l=n(f);export{l as default}; | ||
import o from"next/link";import{usePathname as e}from"next/navigation";import{forwardRef as n,useState as t,useEffect as r}from"react";import{useLocale as i}from"use-intl";import c from"./syncLocaleCookie.js";import{jsx as a}from"react/jsx-runtime";function f({defaultLocale:n,href:f,locale:l,localeCookie:m,onClick:s,prefetch:u,unprefixed:p,...d},h){const k=i(),j=null!=l&&l!==k,x=l||k,C=function(){const[o,e]=t();return r((()=>{e(window.location.host)}),[]),o}(),v=C&&p&&(p.domains[C]===x||!Object.keys(p.domains).includes(C)&&k===n&&!l)?p.pathname:f,L=e();j&&(u=!1);return a(o,{ref:h,href:v,hrefLang:j?l:void 0,onClick:function(o){c(m,L,k,l),s&&s(o)},prefetch:u,...d})}var l=n(f);export{l as default}; |
@@ -1,1 +0,1 @@ | ||
import{redirect as e,permanentRedirect as o}from"next/navigation.js";import{forwardRef as a}from"react";import{receiveRoutingConfig as t}from"../../routing/config.js";import n from"../../shared/use.js";import{isLocalizableHref as r}from"../../shared/utils.js";import i from"./BaseLink.js";import{serializeSearchParams as m,compileLocalizedPathname as l,applyPathnamePrefix as c,normalizeNameOrNameWithParams as f}from"./utils.js";import{jsx as s}from"react/jsx-runtime";function u(u,p){const d=t(p||{}),h=d.pathnames,j="as-needed"===d.localePrefix.mode&&d.domains||void 0;function g({href:e,locale:o,...a},t){let m,l;"object"==typeof e?(m=e.pathname,l=e.params):m=e;const c=r(e),f=u(),p=f instanceof Promise?n(f):f,g=c?x({locale:o||p,href:null==h?m:{pathname:m,params:l}},null!=o||j||void 0):m;return s(i,{ref:t,defaultLocale:d.defaultLocale,href:"object"==typeof e?{...e,pathname:g}:g,locale:o,localeCookie:d.localeCookie,unprefixed:j&&c?{domains:d.domains.reduce(((e,o)=>(e[o.domain]=o.defaultLocale,e)),{}),pathname:x({locale:p,href:null==h?m:{pathname:m,params:l}},!1)}:void 0,...a})}const v=a(g);function x(e,o){const{href:a,locale:t}=e;let n;return null==h?"object"==typeof a?(n=a.pathname,a.query&&(n+=m(a.query))):n=a:n=l({locale:t,...f(a),pathnames:d.pathnames}),c(n,t,d,e.domain,o)}function y(e){return function(o,...a){return e(x(o,o.domain?void 0:j),...a)}}const L=y(e),k=y(o);return{config:d,Link:v,redirect:L,permanentRedirect:k,getPathname:x}}export{u as default}; | ||
import{redirect as e,permanentRedirect as o}from"next/navigation";import{forwardRef as a}from"react";import{receiveRoutingConfig as t}from"../../routing/config.js";import n from"../../shared/use.js";import{isLocalizableHref as r}from"../../shared/utils.js";import i from"./BaseLink.js";import{serializeSearchParams as m,compileLocalizedPathname as l,applyPathnamePrefix as c,normalizeNameOrNameWithParams as f}from"./utils.js";import{jsx as s}from"react/jsx-runtime";function u(u,p){const d=t(p||{}),h=d.pathnames,j="as-needed"===d.localePrefix.mode&&d.domains||void 0;function g({href:e,locale:o,...a},t){let m,l;"object"==typeof e?(m=e.pathname,l=e.params):m=e;const c=r(e),f=u(),p=f instanceof Promise?n(f):f,g=c?x({locale:o||p,href:null==h?m:{pathname:m,params:l}},null!=o||j||void 0):m;return s(i,{ref:t,defaultLocale:d.defaultLocale,href:"object"==typeof e?{...e,pathname:g}:g,locale:o,localeCookie:d.localeCookie,unprefixed:j&&c?{domains:d.domains.reduce(((e,o)=>(e[o.domain]=o.defaultLocale,e)),{}),pathname:x({locale:p,href:null==h?m:{pathname:m,params:l}},!1)}:void 0,...a})}const v=a(g);function x(e,o){const{href:a,locale:t}=e;let n;return null==h?"object"==typeof a?(n=a.pathname,a.query&&(n+=m(a.query))):n=a:n=l({locale:t,...f(a),pathnames:d.pathnames}),c(n,t,d,e.domain,o)}function y(e){return function(o,...a){return e(x(o,o.domain?void 0:j),...a)}}const L=y(e),k=y(o);return{config:d,Link:v,redirect:L,permanentRedirect:k,getPathname:x}}export{u as default}; |
@@ -1,1 +0,1 @@ | ||
import e from"fs";import s from"path";import{throwError as t}from"./utils.js";function n(n){const i=s.resolve(n);e.existsSync(i)||t(`\`createMessagesDeclaration\` points to a non-existent file: ${i}`),i.endsWith(".json")||t(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${i}`);const r=process.argv.includes("dev"),c=process.argv.includes("build");var a;(r||c)&&(a=()=>{o(n),r&&function(s){const t=e.watch(s,(e=>{"change"===e&&o(s,!0)}));process.on("exit",(()=>{t.close()}))}(n)},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",a()))}function o(s,t=!1){const n=s.replace(/\.json$/,".d.json.ts");function o(e){return`// This file is auto-generated by next-intl, do not edit directly.\n// See: https://next-intl-docs.vercel.app/docs/workflows/typescript#messages-arguments\n\ndeclare const messages: ${e.trim()};\nexport default messages;`}if(t)return e.promises.readFile(s,"utf-8").then((s=>e.promises.writeFile(n,o(s))));const i=e.readFileSync(s,"utf-8");e.writeFileSync(n,o(i))}export{n as default}; | ||
import e from"fs";import s from"path";import{throwError as t}from"./utils.js";function n(n){const i=s.resolve(n);e.existsSync(i)||t(`\`createMessagesDeclaration\` points to a non-existent file: ${i}`),i.endsWith(".json")||t(`\`createMessagesDeclaration\` needs to point to a JSON file. Received: ${i}`);const r=process.argv.includes("dev"),c=process.argv.includes("build");var a;(r||c)&&(a=()=>{o(n),r&&function(s){const t=e.watch(s,(e=>{"change"===e&&o(s,!0)}));process.on("exit",(()=>{t.close()}))}(n)},"1"!==process.env._NEXT_INTL_COMPILE_MESSAGES&&(process.env._NEXT_INTL_COMPILE_MESSAGES="1",a()))}function o(s,t=!1){const n=s.replace(/\.json$/,".d.json.ts");function o(e){return`// This file is auto-generated by next-intl, do not edit directly.\n// See: https://next-intl.dev/docs/workflows/typescript#messages-arguments\n\ndeclare const messages: ${e.trim()};\nexport default messages;`}if(t)return e.promises.readFile(s,"utf-8").then((s=>e.promises.writeFile(n,o(s))));const i=e.readFileSync(s,"utf-8");e.writeFileSync(n,o(i))}export{n as default}; |
@@ -1,1 +0,1 @@ | ||
import e from"./createMessagesDeclaration.js";import t from"./getNextConfig.js";import{warn as r}from"./utils.js";function n(n={}){const o="string"==typeof n?{requestConfig:n}:n;return function(n){return function(n,o){return null!=o?.i18n&&r("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl-docs.vercel.app/examples#app-router-migration\n"),n.experimental?.createMessagesDeclaration&&e(n.experimental.createMessagesDeclaration),t(n,o)}(o,n)}}export{n as default}; | ||
import e from"./createMessagesDeclaration.js";import t from"./getNextConfig.js";import{warn as r}from"./utils.js";function n(n={}){const o="string"==typeof n?{requestConfig:n}:n;return function(n){return function(n,o){return null!=o?.i18n&&r("\n[next-intl] An `i18n` property was found in your Next.js config. This likely causes conflicts and should therefore be removed if you use the App Router.\n\nIf you're in progress of migrating from the Pages Router, you can refer to this example: https://next-intl.dev/examples#app-router-migration\n"),n.experimental?.createMessagesDeclaration&&e(n.experimental.createMessagesDeclaration),t(n,o)}(o,n)}}export{n as default}; |
@@ -1,1 +0,1 @@ | ||
import e from"../server/react-server/getConfig.js";import r from"../shared/use.js";function n(n){return function(e,n){try{return r(n)}catch(r){throw r instanceof TypeError&&r.message.includes("Cannot read properties of null (reading 'use')")?new Error(`\`${e}\` is not callable within an async component. Please refer to https://next-intl-docs.vercel.app/docs/environments/server-client-components#async-components`,{cause:r}):r}}(n,e())}export{n as default}; | ||
import e from"../server/react-server/getConfig.js";import n from"../shared/use.js";function r(r){return function(e,r){try{return n(r)}catch(n){throw n instanceof TypeError&&n.message.includes("Cannot read properties of null (reading 'use')")?new Error(`\`${e}\` is not callable within an async component. Please refer to https://next-intl.dev/docs/environments/server-client-components#async-components`,{cause:n}):n}}(r,e())}export{r as default}; |
@@ -1,1 +0,1 @@ | ||
import{cache as e}from"react";import{_createIntlFormatters as t,_createCache as o,initializeConfig as n}from"use-intl/core";import{getRequestLocale as r}from"./RequestLocale.js";import i from"next-intl/config";const s=e((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const a=e((async function(e,t){let o=e({get requestLocale(){return t?Promise.resolve(t):r()}});if(o instanceof Promise&&(o=await o),!o.locale)throw new Error("No locale was returned from `getRequestConfig`.\n\nSee https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request");return o})),c=e(t),m=e(o);const u=e((async function(e){const t=await a(i,e);return{...n(t),_formatters:c(m()),timeZone:t.timeZone||s()}}));export{u as default}; | ||
import{cache as e}from"react";import{_createIntlFormatters as t,_createCache as o,initializeConfig as n}from"use-intl/core";import{getRequestLocale as r}from"./RequestLocale.js";import i from"next-intl/config";const s=e((function(){return Intl.DateTimeFormat().resolvedOptions().timeZone}));const a=e((async function(e,t){let o=e({get requestLocale(){return t?Promise.resolve(t):r()}});if(o instanceof Promise&&(o=await o),!o.locale)throw new Error("No locale was returned from `getRequestConfig`.\n\nSee https://next-intl.dev/docs/usage/configuration#i18n-request");return o})),c=e(t),m=e(o);const u=e((async function(e){const t=await a(i,e);return{...n(t),_formatters:c(m()),timeZone:t.timeZone||s()}}));export{u as default}; |
@@ -1,1 +0,1 @@ | ||
import{cache as e}from"react";import o from"./getConfig.js";function t(e){if(!e.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return e.messages}const r=e((async function(e){return t(await o(e))}));async function n(e){return r(e?.locale)}export{n as default,t as getMessagesFromConfig}; | ||
import{cache as e}from"react";import t from"./getConfig.js";function o(e){if(!e.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl.dev/docs/configuration#messages");return e.messages}const n=e((async function(e){return o(await t(e))}));async function r(e){return n(e?.locale)}export{r as default,o as getMessagesFromConfig}; |
@@ -1,1 +0,1 @@ | ||
import{headers as t}from"next/headers.js";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const o=e((async function(){const e=t();return e instanceof Promise?await e:e}));const s=e((async function(){let t;try{t=(await o()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl-docs.vercel.app/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function i(){return r()||await s()}export{i as getRequestLocale}; | ||
import{headers as t}from"next/headers";import{cache as e}from"react";import{HEADER_LOCALE_NAME as n}from"../../shared/constants.js";import{getCachedRequestLocale as r}from"./RequestLocaleCache.js";const o=e((async function(){const e=t();return e instanceof Promise?await e:e}));const i=e((async function(){let t;try{t=(await o()).get(n)||void 0}catch(t){if(t instanceof Error&&"DYNAMIC_SERVER_USAGE"===t.digest){const e=new Error("Usage of next-intl APIs in Server Components currently opts into dynamic rendering. This limitation will eventually be lifted, but as a stopgap solution, you can use the `setRequestLocale` API to enable static rendering, see https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing#static-rendering",{cause:t});throw e.digest=t.digest,e}throw t}return t}));async function s(){return r()||await i()}export{s as getRequestLocale}; |
@@ -1,1 +0,1 @@ | ||
function t(t){return function(t){return"object"==typeof t?null==t.host&&null==t.hostname:!/^[a-z]+:/i.test(t)}(t)&&!function(t){const n="object"==typeof t?t.pathname:t;return null!=n&&!n.startsWith("/")}(t)}function n(t,n){return t.replace(new RegExp(`^${n}`),"")||"/"}function e(t,n){let e=t;return/^\/(\?.*)?$/.test(n)&&(n=n.slice(1)),e+=n,e}function r(t,n){return n===t||n.startsWith(`${t}/`)}function u(t){const n=function(){try{return"true"===process.env._next_intl_trailing_slash}catch{return!1}}();if("/"!==t){const e=t.endsWith("/");n&&!e?t+="/":!n&&e&&(t=t.slice(0,-1))}return t}function i(t,n){const e=u(t),r=u(n);return o(e).test(r)}function c(t,n){return"never"!==n.mode&&n.prefixes?.[t]||"/"+t}function o(t){const n=t.replace(/\[\[(\.\.\.[^\]]+)\]\]/g,"?(.*)").replace(/\[(\.\.\.[^\]]+)\]/g,"(.+)").replace(/\[([^\]]+)\]/g,"([^/]+)");return new RegExp(`^${n}$`)}function f(t){return t.includes("[[...")}function s(t){return t.includes("[...")}function l(t){return t.includes("[")}function a(t,n){const e=t.split("/"),r=n.split("/"),u=Math.max(e.length,r.length);for(let t=0;t<u;t++){const n=e[t],u=r[t];if(!n&&u)return-1;if(n&&!u)return 1;if(n||u){if(!l(n)&&l(u))return-1;if(l(n)&&!l(u))return 1;if(!s(n)&&s(u))return-1;if(s(n)&&!s(u))return 1;if(!f(n)&&f(u))return-1;if(f(n)&&!f(u))return 1}}return 0}function p(t){return t.sort(a)}export{c as getLocalePrefix,p as getSortedPathnames,r as hasPathnamePrefixed,t as isLocalizableHref,i as matchesPathname,u as normalizeTrailingSlash,e as prefixPathname,o as templateToRegex,n as unprefixPathname}; | ||
function n(n){return function(n){return"object"==typeof n?null==n.host&&null==n.hostname:!/^[a-z]+:/i.test(n)}(n)&&!function(n){const t="object"==typeof n?n.pathname:n;return null!=t&&!t.startsWith("/")}(n)}function t(n,t){return n.replace(new RegExp(`^${t}`),"")||"/"}function e(n,t){let e=n;return/^\/(\?.*)?$/.test(t)&&(t=t.slice(1)),e+=t,e}function r(n,t){return t===n||t.startsWith(`${n}/`)}function u(n){const t=function(){try{return"true"===process.env._next_intl_trailing_slash}catch{return!1}}();if("/"!==n){const e=n.endsWith("/");t&&!e?n+="/":!t&&e&&(n=n.slice(0,-1))}return n}function i(n,t){const e=u(n),r=u(t);return f(e).test(r)}function c(n,t){return"never"!==t.mode&&t.prefixes?.[n]||o(n)}function o(n){return"/"+n}function f(n){const t=n.replace(/\[\[(\.\.\.[^\]]+)\]\]/g,"?(.*)").replace(/\[(\.\.\.[^\]]+)\]/g,"(.+)").replace(/\[([^\]]+)\]/g,"([^/]+)");return new RegExp(`^${t}$`)}function s(n){return n.includes("[[...")}function l(n){return n.includes("[...")}function a(n){return n.includes("[")}function p(n,t){const e=n.split("/"),r=t.split("/"),u=Math.max(e.length,r.length);for(let n=0;n<u;n++){const t=e[n],u=r[n];if(!t&&u)return-1;if(t&&!u)return 1;if(t||u){if(!a(t)&&a(u))return-1;if(a(t)&&!a(u))return 1;if(!l(t)&&l(u))return-1;if(l(t)&&!l(u))return 1;if(!s(t)&&s(u))return-1;if(s(t)&&!s(u))return 1}}return 0}function h(n){return n.sort(p)}export{o as getLocaleAsPrefix,c as getLocalePrefix,h as getSortedPathnames,r as hasPathnamePrefixed,n as isLocalizableHref,i as matchesPathname,u as normalizeTrailingSlash,e as prefixPathname,f as templateToRegex,t as unprefixPathname}; |
@@ -314,3 +314,3 @@ import { type Locale } from 'use-intl'; | ||
useRouter: () => { | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#userouter */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#userouter */ | ||
push: (href: Parameters<(args: { | ||
@@ -341,3 +341,3 @@ href: [AppPathnames] extends [never] ? string | { | ||
}) | undefined) => void; | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#userouter */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#userouter */ | ||
replace: (href: Parameters<(args: { | ||
@@ -368,3 +368,3 @@ href: [AppPathnames] extends [never] ? string | { | ||
}) | undefined) => void; | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#userouter */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#userouter */ | ||
prefetch: (href: Parameters<(args: { | ||
@@ -371,0 +371,0 @@ href: [AppPathnames] extends [never] ? string | { |
import type { LocalePrefixConfigVerbose, LocalePrefixMode, Locales } from '../../routing/types.tsx'; | ||
export default function useBasePathname<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>): string | null; | ||
export default function useBasePathname<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(config: { | ||
localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>; | ||
defaultLocale?: AppLocales[number]; | ||
}): string | null; |
@@ -332,3 +332,3 @@ import type { Locale } from 'use-intl'; | ||
redirect: (args: Omit<Parameters<(args: { | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#getpathname */ | ||
href: [AppPathnames] extends [never] ? string | { | ||
@@ -342,3 +342,3 @@ pathname: string; | ||
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned. | ||
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname | ||
* @see https://next-intl.dev/docs/routing/navigation#getpathname | ||
*/ | ||
@@ -349,3 +349,3 @@ domain: AppDomains[number]["domain"]; | ||
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned. | ||
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname | ||
* @see https://next-intl.dev/docs/routing/navigation#getpathname | ||
*/ | ||
@@ -355,3 +355,3 @@ domain: AppDomains[number]["domain"]; | ||
permanentRedirect: (args: Omit<Parameters<(args: { | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#getpathname */ | ||
href: [AppPathnames] extends [never] ? string | { | ||
@@ -365,3 +365,3 @@ pathname: string; | ||
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned. | ||
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname | ||
* @see https://next-intl.dev/docs/routing/navigation#getpathname | ||
*/ | ||
@@ -372,3 +372,3 @@ domain: AppDomains[number]["domain"]; | ||
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned. | ||
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname | ||
* @see https://next-intl.dev/docs/routing/navigation#getpathname | ||
*/ | ||
@@ -378,3 +378,3 @@ domain: AppDomains[number]["domain"]; | ||
getPathname: (args: Parameters<(args: { | ||
/** @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname */ | ||
/** @see https://next-intl.dev/docs/routing/navigation#getpathname */ | ||
href: [AppPathnames] extends [never] ? string | { | ||
@@ -388,3 +388,3 @@ pathname: string; | ||
* In case you're using `localePrefix: 'as-needed'` in combination with `domains`, the `defaultLocale` can differ by domain and therefore the locales that need to be prefixed can differ as well. For this particular case, this parameter should be provided in order to compute the correct pathname. Note that the actual domain is not part of the result, but only the pathname is returned. | ||
* @see https://next-intl-docs.vercel.app/docs/routing/navigation#getpathname | ||
* @see https://next-intl.dev/docs/routing/navigation#getpathname | ||
*/ | ||
@@ -391,0 +391,0 @@ domain: AppDomains[number]["domain"]; |
@@ -7,3 +7,3 @@ import type { NextResponse } from 'next/server.js'; | ||
* All available locales. | ||
* @see https://next-intl-docs.vercel.app/docs/routing | ||
* @see https://next-intl.dev/docs/routing | ||
*/ | ||
@@ -13,3 +13,3 @@ locales: AppLocales; | ||
* Used when no locale matches. | ||
* @see https://next-intl-docs.vercel.app/docs/routing | ||
* @see https://next-intl.dev/docs/routing | ||
*/ | ||
@@ -19,3 +19,3 @@ defaultLocale: AppLocales[number]; | ||
* Configures whether and which prefix is shown for a given locale. | ||
* @see https://next-intl-docs.vercel.app/docs/routing#locale-prefix | ||
* @see https://next-intl.dev/docs/routing#locale-prefix | ||
**/ | ||
@@ -25,3 +25,3 @@ localePrefix?: LocalePrefix<AppLocales, AppLocalePrefixMode>; | ||
* Can be used to change the locale handling per domain. | ||
* @see https://next-intl-docs.vercel.app/docs/routing#domains | ||
* @see https://next-intl.dev/docs/routing#domains | ||
**/ | ||
@@ -31,3 +31,3 @@ domains?: AppDomains; | ||
* Can be used to disable the locale cookie or to customize it. | ||
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-cookie | ||
* @see https://next-intl.dev/docs/routing/middleware#locale-cookie | ||
*/ | ||
@@ -37,3 +37,3 @@ localeCookie?: boolean | CookieAttributes; | ||
* Sets the `Link` response header to notify search engines about content in other languages (defaults to `true`). See https://developers.google.com/search/docs/specialty/international/localized-versions#http | ||
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#alternate-links | ||
* @see https://next-intl.dev/docs/routing/middleware#alternate-links | ||
**/ | ||
@@ -43,3 +43,3 @@ alternateLinks?: boolean; | ||
* By setting this to `false`, the cookie as well as the `accept-language` header will no longer be used for locale detection. | ||
* @see https://next-intl-docs.vercel.app/docs/routing/middleware#locale-detection | ||
* @see https://next-intl.dev/docs/routing/middleware#locale-detection | ||
**/ | ||
@@ -50,3 +50,3 @@ localeDetection?: boolean; | ||
* A map of localized pathnames per locale. | ||
* @see https://next-intl-docs.vercel.app/docs/routing#pathnames | ||
* @see https://next-intl.dev/docs/routing#pathnames | ||
**/ | ||
@@ -53,0 +53,0 @@ pathnames: AppPathnames; |
import type { IntlConfig } from 'use-intl/core'; | ||
export type RequestConfig = Omit<IntlConfig, 'locale'> & { | ||
/** | ||
* @see https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request | ||
* @see https://next-intl.dev/docs/usage/configuration#i18n-request | ||
**/ | ||
@@ -22,3 +22,3 @@ locale: IntlConfig['locale']; | ||
* | ||
* @see https://next-intl-docs.vercel.app/docs/usage/configuration#i18n-request | ||
* @see https://next-intl.dev/docs/usage/configuration#i18n-request | ||
*/ | ||
@@ -25,0 +25,0 @@ requestLocale: Promise<string | undefined>; |
@@ -15,4 +15,5 @@ import type { LinkProps } from 'next/link.js'; | ||
export declare function getLocalePrefix<AppLocales extends Locales, AppLocalePrefixMode extends LocalePrefixMode>(locale: AppLocales[number], localePrefix: LocalePrefixConfigVerbose<AppLocales, AppLocalePrefixMode>): string; | ||
export declare function getLocaleAsPrefix(locale: string): string; | ||
export declare function templateToRegex(template: string): RegExp; | ||
export declare function getSortedPathnames(pathnames: Array<string>): string[]; | ||
export {}; |
{ | ||
"name": "next-intl", | ||
"version": "4.0.0-beta-7b755e9", | ||
"version": "4.0.0-beta-7e7011d", | ||
"sideEffects": false, | ||
@@ -14,3 +14,3 @@ "author": "Jan Amann <jan@amann.work>", | ||
"license": "MIT", | ||
"homepage": "https://next-intl-docs.vercel.app", | ||
"homepage": "https://next-intl.dev", | ||
"repository": { | ||
@@ -116,7 +116,7 @@ "type": "git", | ||
"negotiator": "^1.0.0", | ||
"use-intl": "4.0.0-beta-7b755e9" | ||
"use-intl": "4.0.0-beta-7e7011d" | ||
}, | ||
"peerDependencies": { | ||
"next": "^13.0.0 || ^14.0.0 || ^15.0.0", | ||
"react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", | ||
"next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0", | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0", | ||
"typescript": "^5.0.0" | ||
@@ -129,3 +129,3 @@ }, | ||
}, | ||
"gitHead": "ff4d528b0becc2d1c27232ea8f53351ff655cc50" | ||
"gitHead": "8b5006b6a3d8bec471a5e9a4564c31befb5241b0" | ||
} |
<h1 align="center"> | ||
<br> | ||
<a href="https://next-intl-docs.vercel.app/"> | ||
<a href="https://next-intl.dev"> | ||
<picture> | ||
@@ -32,6 +32,6 @@ <source media="(prefers-color-scheme: dark)" srcset="media/logo-dark-mode.svg"> | ||
import {useTranslations} from 'next-intl'; | ||
export default function UserProfile({user}) { | ||
const t = useTranslations('UserProfile'); | ||
return ( | ||
@@ -62,6 +62,6 @@ <section> | ||
### [→ Read the docs](https://next-intl-docs.vercel.app/) | ||
### [→ Read the docs](https://next-intl.dev) | ||
<div align="center"> | ||
<a href="https://next-intl-docs.vercel.app/redirect?href=https://crowdin.com" target="_blank"> | ||
<a href="https://next-intl.dev/redirect?href=https://crowdin.com" target="_blank"> | ||
<img width="350" src="media/partner.svg" alt="Crowdin logo"> | ||
@@ -68,0 +68,0 @@ </a> |
Sorry, the diff of this file is not supported yet
241237
0.08%3946
0.41%