next-intl 2.12.0-beta.4 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/client.js +1 -0
- package/dist/client/NextIntlClientProvider.d.ts +7 -0
- package/dist/client/index.d.ts +1 -14
- package/dist/client/next-intl.esm.js +26 -27
- package/dist/client/next-intl.esm.js.map +1 -1
- package/dist/index.d.ts +1 -44
- package/dist/next-intl.cjs.development.js +7 -195
- package/dist/next-intl.cjs.development.js.map +1 -1
- package/dist/next-intl.cjs.production.min.js +1 -1
- package/dist/next-intl.cjs.production.min.js.map +1 -1
- package/dist/next-intl.esm.js +1 -18
- package/dist/next-intl.esm.js.map +1 -1
- package/dist/react-server/index.d.ts +7 -46
- package/dist/server/NextI18nConfig.d.ts +5 -0
- package/dist/server/NextIntlCookie.d.ts +11 -0
- package/dist/server/createIntlMiddleware.d.ts +3 -0
- package/dist/server/index.d.ts +1 -13
- package/dist/server/resolveLocale.d.ts +4 -0
- package/dist/src/client/NextIntlClientProvider.d.ts +7 -0
- package/dist/src/{shared → client}/NextIntlClientProvider.js +2 -9
- package/dist/src/client/NextIntlClientProvider.js.map +1 -0
- package/dist/src/client/index.d.ts +1 -14
- package/dist/src/client/index.js +1 -14
- package/dist/src/client/index.js.map +1 -1
- package/dist/src/index.d.ts +1 -44
- package/dist/src/index.js +2 -13
- package/dist/src/index.js.map +1 -1
- package/dist/src/react-server/index.d.ts +7 -46
- package/dist/src/react-server/index.js +10 -18
- package/dist/src/react-server/index.js.map +1 -1
- package/dist/src/server/NextI18nConfig.d.ts +5 -0
- package/dist/src/server/NextI18nConfig.js +2 -0
- package/dist/src/server/NextI18nConfig.js.map +1 -0
- package/dist/src/server/NextIntlCookie.d.ts +11 -0
- package/dist/src/server/NextIntlCookie.js +19 -0
- package/dist/src/server/NextIntlCookie.js.map +1 -0
- package/dist/src/server/createIntlMiddleware.d.ts +3 -0
- package/dist/src/server/createIntlMiddleware.js +22 -0
- package/dist/src/server/createIntlMiddleware.js.map +1 -0
- package/dist/src/server/index.d.ts +1 -13
- package/dist/src/server/index.js +1 -15
- package/dist/src/server/index.js.map +1 -1
- package/dist/src/server/resolveLocale.d.ts +4 -0
- package/dist/src/server/resolveLocale.js +37 -0
- package/dist/src/server/resolveLocale.js.map +1 -0
- package/package.json +12 -22
- package/server.js +1 -0
- package/src/{shared → client}/NextIntlClientProvider.tsx +3 -23
- package/src/client/index.tsx +1 -19
- package/src/index.tsx +2 -17
- package/src/react-server/index.tsx +13 -23
- package/src/server/NextI18nConfig.tsx +7 -0
- package/src/server/NextIntlCookie.tsx +33 -0
- package/src/server/createIntlMiddleware.tsx +33 -0
- package/src/server/index.tsx +1 -20
- package/src/server/resolveLocale.tsx +56 -0
- package/CHANGELOG.md +0 -540
- package/config.js +0 -3
- package/dist/client/getCookieLocale.d.ts +0 -1
- package/dist/client/hasPathnamePrefixed.d.ts +0 -1
- package/dist/client/localizeHref.d.ts +0 -4
- package/dist/client/next-intl.esm2.js +0 -24
- package/dist/client/next-intl.esm2.js.map +0 -1
- package/dist/client/next-intl.esm3.js +0 -23
- package/dist/client/next-intl.esm3.js.map +0 -1
- package/dist/client/next-intl.esm4.js +0 -7
- package/dist/client/next-intl.esm4.js.map +0 -1
- package/dist/client/usePathname.d.ts +0 -11
- package/dist/client/useRouter.d.ts +0 -8
- package/dist/middleware/NextIntlMiddlewareConfig.d.ts +0 -37
- package/dist/middleware/getAlternateLinksHeaderValue.d.ts +0 -6
- package/dist/middleware/getHost.d.ts +0 -1
- package/dist/middleware/index.d.ts +0 -1
- package/dist/middleware/middleware.d.ts +0 -3
- package/dist/middleware/resolveLocale.d.ts +0 -6
- package/dist/react-client/next-intl.esm.js +0 -16
- package/dist/react-client/next-intl.esm.js.map +0 -1
- package/dist/react-client/useLocalizedRouter.d.ts +0 -8
- package/dist/react-server/useFormatter.d.ts +0 -5
- package/dist/react-server/useHook.d.ts +0 -1
- package/dist/react-server/useIntl.d.ts +0 -5
- package/dist/react-server/useLocale.d.ts +0 -1
- package/dist/react-server/useNow.d.ts +0 -1
- package/dist/react-server/useTimeZone.d.ts +0 -1
- package/dist/react-server/useTranslations.d.ts +0 -5
- package/dist/server/NextIntlConfig.d.ts +0 -6
- package/dist/server/createRequestConfig.d.ts +0 -4
- package/dist/server/getConfig.d.ts +0 -15
- package/dist/server/getFormatter.d.ts +0 -6
- package/dist/server/getIntl.d.ts +0 -7
- package/dist/server/getLocale.d.ts +0 -2
- package/dist/server/getNow.d.ts +0 -2
- package/dist/server/getRequestConfig.d.ts +0 -5
- package/dist/server/getTimeZone.d.ts +0 -2
- package/dist/server/getTranslations.d.ts +0 -38
- package/dist/server/redirect.d.ts +0 -1
- package/dist/shared/Link.d.ts +0 -7
- package/dist/shared/LocalizedLink.d.ts +0 -7
- package/dist/shared/NextIntlClientProvider.d.ts +0 -9
- package/dist/shared/constants.d.ts +0 -2
- package/dist/shared/localizePathname.d.ts +0 -1
- package/dist/shared/next-intl.esm.js +0 -70
- package/dist/shared/next-intl.esm.js.map +0 -1
- package/dist/shared/next-intl.esm2.js +0 -47
- package/dist/shared/next-intl.esm2.js.map +0 -1
- package/dist/shared/next-intl.esm3.js +0 -12
- package/dist/shared/next-intl.esm3.js.map +0 -1
- package/dist/shared/next-intl.esm4.js +0 -6
- package/dist/shared/next-intl.esm4.js.map +0 -1
- package/dist/src/client/getCookieLocale.d.ts +0 -1
- package/dist/src/client/getCookieLocale.js +0 -17
- package/dist/src/client/getCookieLocale.js.map +0 -1
- package/dist/src/client/hasPathnamePrefixed.d.ts +0 -1
- package/dist/src/client/hasPathnamePrefixed.js +0 -6
- package/dist/src/client/hasPathnamePrefixed.js.map +0 -1
- package/dist/src/client/localizeHref.d.ts +0 -4
- package/dist/src/client/localizeHref.js +0 -30
- package/dist/src/client/localizeHref.js.map +0 -1
- package/dist/src/client/usePathname.d.ts +0 -11
- package/dist/src/client/usePathname.js +0 -40
- package/dist/src/client/usePathname.js.map +0 -1
- package/dist/src/client/useRouter.d.ts +0 -8
- package/dist/src/client/useRouter.js +0 -19
- package/dist/src/client/useRouter.js.map +0 -1
- package/dist/src/middleware/NextIntlMiddlewareConfig.d.ts +0 -37
- package/dist/src/middleware/NextIntlMiddlewareConfig.js +0 -2
- package/dist/src/middleware/NextIntlMiddlewareConfig.js.map +0 -1
- package/dist/src/middleware/getAlternateLinksHeaderValue.d.ts +0 -6
- package/dist/src/middleware/getAlternateLinksHeaderValue.js +0 -60
- package/dist/src/middleware/getAlternateLinksHeaderValue.js.map +0 -1
- package/dist/src/middleware/getHost.d.ts +0 -1
- package/dist/src/middleware/getHost.js +0 -5
- package/dist/src/middleware/getHost.js.map +0 -1
- package/dist/src/middleware/index.d.ts +0 -1
- package/dist/src/middleware/index.js +0 -2
- package/dist/src/middleware/index.js.map +0 -1
- package/dist/src/middleware/middleware.d.ts +0 -3
- package/dist/src/middleware/middleware.js +0 -156
- package/dist/src/middleware/middleware.js.map +0 -1
- package/dist/src/middleware/resolveLocale.d.ts +0 -6
- package/dist/src/middleware/resolveLocale.js +0 -91
- package/dist/src/middleware/resolveLocale.js.map +0 -1
- package/dist/src/react-client/useLocalizedRouter.d.ts +0 -8
- package/dist/src/react-client/useLocalizedRouter.js +0 -12
- package/dist/src/react-client/useLocalizedRouter.js.map +0 -1
- package/dist/src/react-server/useFormatter.d.ts +0 -5
- package/dist/src/react-server/useFormatter.js +0 -6
- package/dist/src/react-server/useFormatter.js.map +0 -1
- package/dist/src/react-server/useHook.d.ts +0 -1
- package/dist/src/react-server/useHook.js +0 -24
- package/dist/src/react-server/useHook.js.map +0 -1
- package/dist/src/react-server/useIntl.d.ts +0 -5
- package/dist/src/react-server/useIntl.js +0 -11
- package/dist/src/react-server/useIntl.js.map +0 -1
- package/dist/src/react-server/useLocale.d.ts +0 -1
- package/dist/src/react-server/useLocale.js +0 -5
- package/dist/src/react-server/useLocale.js.map +0 -1
- package/dist/src/react-server/useNow.d.ts +0 -1
- package/dist/src/react-server/useNow.js +0 -6
- package/dist/src/react-server/useNow.js.map +0 -1
- package/dist/src/react-server/useTimeZone.d.ts +0 -1
- package/dist/src/react-server/useTimeZone.js +0 -6
- package/dist/src/react-server/useTimeZone.js.map +0 -1
- package/dist/src/react-server/useTranslations.d.ts +0 -5
- package/dist/src/react-server/useTranslations.js +0 -6
- package/dist/src/react-server/useTranslations.js.map +0 -1
- package/dist/src/server/NextIntlConfig.d.ts +0 -6
- package/dist/src/server/NextIntlConfig.js +0 -2
- package/dist/src/server/NextIntlConfig.js.map +0 -1
- package/dist/src/server/createRequestConfig.d.ts +0 -4
- package/dist/src/server/createRequestConfig.js +0 -5
- package/dist/src/server/createRequestConfig.js.map +0 -1
- package/dist/src/server/getConfig.d.ts +0 -15
- package/dist/src/server/getConfig.js +0 -23
- package/dist/src/server/getConfig.js.map +0 -1
- package/dist/src/server/getFormatter.d.ts +0 -6
- package/dist/src/server/getFormatter.js +0 -9
- package/dist/src/server/getFormatter.js.map +0 -1
- package/dist/src/server/getIntl.d.ts +0 -7
- package/dist/src/server/getIntl.js +0 -15
- package/dist/src/server/getIntl.js.map +0 -1
- package/dist/src/server/getLocale.d.ts +0 -2
- package/dist/src/server/getLocale.js +0 -22
- package/dist/src/server/getLocale.js.map +0 -1
- package/dist/src/server/getNow.d.ts +0 -2
- package/dist/src/server/getNow.js +0 -8
- package/dist/src/server/getNow.js.map +0 -1
- package/dist/src/server/getRequestConfig.d.ts +0 -5
- package/dist/src/server/getRequestConfig.js +0 -4
- package/dist/src/server/getRequestConfig.js.map +0 -1
- package/dist/src/server/getTimeZone.d.ts +0 -2
- package/dist/src/server/getTimeZone.js +0 -8
- package/dist/src/server/getTimeZone.js.map +0 -1
- package/dist/src/server/getTranslations.d.ts +0 -38
- package/dist/src/server/getTranslations.js +0 -23
- package/dist/src/server/getTranslations.js.map +0 -1
- package/dist/src/server/redirect.d.ts +0 -1
- package/dist/src/server/redirect.js +0 -9
- package/dist/src/server/redirect.js.map +0 -1
- package/dist/src/shared/Link.d.ts +0 -7
- package/dist/src/shared/Link.js +0 -45
- package/dist/src/shared/Link.js.map +0 -1
- package/dist/src/shared/LocalizedLink.d.ts +0 -7
- package/dist/src/shared/LocalizedLink.js +0 -18
- package/dist/src/shared/LocalizedLink.js.map +0 -1
- package/dist/src/shared/NextIntlClientProvider.d.ts +0 -9
- package/dist/src/shared/NextIntlClientProvider.js.map +0 -1
- package/dist/src/shared/constants.d.ts +0 -2
- package/dist/src/shared/constants.js +0 -6
- package/dist/src/shared/constants.js.map +0 -1
- package/dist/src/shared/localizePathname.d.ts +0 -1
- package/dist/src/shared/localizePathname.js +0 -8
- package/dist/src/shared/localizePathname.js.map +0 -1
- package/middleware.d.ts +0 -1
- package/plugin.d.ts +0 -3
- package/plugin.js +0 -65
- package/src/client/getCookieLocale.tsx +0 -19
- package/src/client/hasPathnamePrefixed.tsx +0 -7
- package/src/client/localizeHref.tsx +0 -46
- package/src/client/usePathname.tsx +0 -48
- package/src/client/useRouter.tsx +0 -23
- package/src/middleware/NextIntlMiddlewareConfig.tsx +0 -44
- package/src/middleware/getAlternateLinksHeaderValue.tsx +0 -85
- package/src/middleware/getHost.tsx +0 -7
- package/src/middleware/index.tsx +0 -1
- package/src/middleware/middleware.tsx +0 -206
- package/src/middleware/resolveLocale.tsx +0 -136
- package/src/react-client/useLocalizedRouter.tsx +0 -17
- package/src/react-server/useFormatter.tsx +0 -6
- package/src/react-server/useHook.tsx +0 -30
- package/src/react-server/useIntl.tsx +0 -15
- package/src/react-server/useLocale.tsx +0 -5
- package/src/react-server/useNow.tsx +0 -6
- package/src/react-server/useTimeZone.tsx +0 -6
- package/src/react-server/useTranslations.tsx +0 -6
- package/src/server/NextIntlConfig.tsx +0 -16
- package/src/server/createRequestConfig.tsx +0 -9
- package/src/server/getConfig.tsx +0 -27
- package/src/server/getFormatter.tsx +0 -10
- package/src/server/getIntl.tsx +0 -20
- package/src/server/getLocale.tsx +0 -26
- package/src/server/getNow.tsx +0 -9
- package/src/server/getRequestConfig.tsx +0 -13
- package/src/server/getTimeZone.tsx +0 -9
- package/src/server/getTranslations.tsx +0 -102
- package/src/server/redirect.tsx +0 -10
- package/src/shared/Link.tsx +0 -61
- package/src/shared/LocalizedLink.tsx +0 -26
- package/src/shared/constants.tsx +0 -6
- package/src/shared/localizePathname.tsx +0 -9
- package/withNextIntl.d.ts +0 -5
- package/withNextIntl.js +0 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Jan Amann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/src/client';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { IntlProvider } from 'use-intl';
|
|
3
|
+
declare type Props = Omit<ComponentProps<typeof IntlProvider>, 'locale'> & {
|
|
4
|
+
locale?: string;
|
|
5
|
+
};
|
|
6
|
+
export default function NextIntlProvider({ locale, ...rest }: Props): JSX.Element;
|
|
7
|
+
export {};
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Client-only APIs.
|
|
3
|
-
*/
|
|
4
|
-
import NextIntlClientProvider_ from '../shared/NextIntlClientProvider';
|
|
5
|
-
import usePathname from './usePathname';
|
|
6
|
-
import useRouter from './useRouter';
|
|
7
|
-
export { default as useRouter } from './useRouter';
|
|
8
|
-
export { default as usePathname } from './usePathname';
|
|
9
|
-
/** @deprecated Is called `usePathname` now. */
|
|
10
|
-
export declare const useUnlocalizedPathname: typeof usePathname;
|
|
11
|
-
/** @deprecated Is called `useRouter` now. */
|
|
12
|
-
export declare const useLocalizedRouter: typeof useRouter;
|
|
13
|
-
/** @deprecated Should be imported from `next-intl`, not `next-intl/client`. */
|
|
14
|
-
export declare const NextIntlClientProvider: typeof NextIntlClientProvider_;
|
|
1
|
+
export { default as NextIntlClientProvider } from './NextIntlClientProvider';
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { extends as _extends } from '../_virtual/next-intl.esm.js';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/next-intl.esm.js';
|
|
2
|
+
import { useRouter } from 'next/router';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { IntlProvider } from 'use-intl';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
var _excluded = ["locale"];
|
|
7
|
+
function NextIntlProvider(_ref) {
|
|
8
|
+
var locale = _ref.locale,
|
|
9
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
pathname = window.location.pathname;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
var isSwitchingLocale = locale !== cookieLocale;
|
|
15
|
-
var isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);
|
|
11
|
+
var router;
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
try {
|
|
14
|
+
// Reading from context is practically ok to do conditionally
|
|
15
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
16
|
+
router = useRouter();
|
|
17
|
+
} catch (error) {// Calling `useRouter` is not supported in the app folder
|
|
18
|
+
} // The router can be undefined if used in a context outside
|
|
19
|
+
// of Next.js (e.g. unit tests, Storybook, ...)
|
|
19
20
|
|
|
20
|
-
if (typeof href === 'string') {
|
|
21
|
-
prefixedHref = localizePathname(locale, href);
|
|
22
|
-
} else {
|
|
23
|
-
prefixedHref = _extends({}, href);
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
22
|
+
if (!locale && router) {
|
|
23
|
+
locale = router.locale;
|
|
24
|
+
}
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return href;
|
|
26
|
+
if (!locale) {
|
|
27
|
+
throw new Error(process.env.NODE_ENV !== 'production' ? "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)." : undefined);
|
|
33
28
|
}
|
|
29
|
+
|
|
30
|
+
return React.createElement(IntlProvider, _extends({
|
|
31
|
+
locale: locale
|
|
32
|
+
}, rest));
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
export {
|
|
35
|
+
export { NextIntlProvider as default };
|
|
37
36
|
//# sourceMappingURL=next-intl.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.esm.js","sources":["../../src/client/
|
|
1
|
+
{"version":3,"file":"next-intl.esm.js","sources":["../../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["'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'> & {\n locale?: string;\n};\n\nexport default function NextIntlProvider({locale, ...rest}: 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 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 <IntlProvider locale={locale} {...rest} />;\n}\n"],"names":["NextIntlProvider","locale","rest","router","useRouter","error","Error","process","env","NODE_ENV","undefined","React","createElement","IntlProvider"],"mappings":";;;;;;AAUc,SAAUA,gBAAV,CAAmD,IAAA,EAAA;AAAA,EAAvBC,IAAAA,MAAuB,QAAvBA,MAAuB;AAAA,MAAZC,IAAY,GAAA,6BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAC/D,EAAA,IAAIC,MAAJ,CAAA;;AACA,EAAI,IAAA;AACF;AACA;AACAA,IAAAA,MAAM,GAAGC,SAAS,EAAlB,CAAA;AACD,GAJD,CAIE,OAAOC,KAAP,EAAc;AAEf,GAR8D;AAW/D;;;AACA,EAAA,IAAI,CAACJ,MAAD,IAAWE,MAAf,EAAuB;AACrBF,IAAAA,MAAM,GAAGE,MAAM,CAACF,MAAhB,CAAA;AACD,GAAA;;AAED,EAAI,IAAA,CAACA,MAAL,EAAa;AACX,IAAA,MAAM,IAAIK,KAAJ,CACJC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAAzB,GACI,+MADJ,GAEIC,SAHA,CAAN,CAAA;AAKD,GAAA;;AAED,EAAA,OAAOC,KAAA,CAAAC,aAAA,CAACC,YAAD,EAAA,QAAA,CAAA;AAAcZ,IAAAA,MAAM,EAAEA,MAAAA;AAAtB,GAAA,EAAkCC,IAAlC,CAAP,CAAA,CAAA;AACD;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the main entry file when non-'react-server' environments import
|
|
3
|
-
* from 'next-intl'. Make sure this mirrors the API from 'react-server'.
|
|
4
|
-
*/
|
|
5
|
-
/// <reference types="react" />
|
|
6
|
-
/// <reference types="node" />
|
|
7
|
-
import NextIntlClientProvider from './shared/NextIntlClientProvider';
|
|
8
1
|
export * from 'use-intl';
|
|
9
|
-
export {
|
|
10
|
-
export { default as Link } from './shared/Link';
|
|
11
|
-
export { default as NextIntlClientProvider } from './shared/NextIntlClientProvider';
|
|
12
|
-
/** @deprecated Is called `NextIntlClientProvider` now. */
|
|
13
|
-
export declare const NextIntlProvider: typeof NextIntlClientProvider;
|
|
14
|
-
/** @deprecated Is called `Link` now. */
|
|
15
|
-
export declare const LocalizedLink: import("react").ForwardRefExoticComponent<Pick<Omit<Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
|
|
16
|
-
href: string | import("url").UrlObject;
|
|
17
|
-
as?: (string | import("url").UrlObject) | undefined;
|
|
18
|
-
replace?: boolean | undefined;
|
|
19
|
-
scroll?: boolean | undefined;
|
|
20
|
-
shallow?: boolean | undefined;
|
|
21
|
-
passHref?: boolean | undefined;
|
|
22
|
-
prefetch?: boolean | undefined;
|
|
23
|
-
locale?: string | false | undefined;
|
|
24
|
-
legacyBehavior?: boolean | undefined;
|
|
25
|
-
onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
26
|
-
onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
27
|
-
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
28
|
-
}> & {
|
|
29
|
-
href: string | import("url").UrlObject;
|
|
30
|
-
as?: (string | import("url").UrlObject) | undefined;
|
|
31
|
-
replace?: boolean | undefined;
|
|
32
|
-
scroll?: boolean | undefined;
|
|
33
|
-
shallow?: boolean | undefined;
|
|
34
|
-
passHref?: boolean | undefined;
|
|
35
|
-
prefetch?: boolean | undefined;
|
|
36
|
-
locale?: string | false | undefined;
|
|
37
|
-
legacyBehavior?: boolean | undefined;
|
|
38
|
-
onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
39
|
-
onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
40
|
-
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
41
|
-
} & {
|
|
42
|
-
children?: import("react").ReactNode;
|
|
43
|
-
} & import("react").RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
44
|
-
locale?: string | undefined;
|
|
45
|
-
}, "href" | "as" | "replace" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "onMouseEnter" | "onTouchStart" | "onClick" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
2
|
+
export { NextIntlClientProvider as NextIntlProvider } from './client';
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var NextLink = require('next/link');
|
|
6
|
-
var navigation = require('next/navigation');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var router = require('next/router');
|
|
9
5
|
var useIntl = require('use-intl');
|
|
6
|
+
var router = require('next/router');
|
|
7
|
+
var React = require('react');
|
|
10
8
|
|
|
11
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
10
|
|
|
13
|
-
var NextLink__default = /*#__PURE__*/_interopDefaultLegacy(NextLink);
|
|
14
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
12
|
|
|
16
13
|
function _extends() {
|
|
@@ -46,142 +43,9 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
46
43
|
return target;
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (pathname !== '/') {
|
|
53
|
-
localizedHref += pathname;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return localizedHref;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Reuse the legacy cookie name
|
|
60
|
-
// https://nextjs.org/docs/advanced-features/i18n-routing#leveraging-the-next_locale-cookie
|
|
61
|
-
var COOKIE_LOCALE_NAME = 'NEXT_LOCALE'; // Should take precedence over the cookie
|
|
62
|
-
|
|
63
|
-
function getCookieValueByName(name) {
|
|
64
|
-
// https://stackoverflow.com/a/15724300/343045
|
|
65
|
-
var value = "; " + document.cookie;
|
|
66
|
-
var parts = value.split("; " + name + "=");
|
|
67
|
-
|
|
68
|
-
if (parts.length === 2) {
|
|
69
|
-
var _parts$pop;
|
|
70
|
-
|
|
71
|
-
var part = (_parts$pop = parts.pop()) == null ? void 0 : _parts$pop.split(';').shift();
|
|
72
|
-
if (part) return part;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
throw new Error("Unable to find next-intl cookie, have you configured the middleware?");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function getCookieLocale() {
|
|
79
|
-
return getCookieValueByName(COOKIE_LOCALE_NAME);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function hasPathnamePrefixed(locale, pathname) {
|
|
83
|
-
var prefix = "/" + locale;
|
|
84
|
-
return pathname === prefix || pathname.startsWith(prefix + "/") && pathname.length > prefix.length;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function localizeHref(href, locale, pathname) {
|
|
88
|
-
var cookieLocale = getCookieLocale();
|
|
89
|
-
if (!locale) locale = cookieLocale;
|
|
90
|
-
|
|
91
|
-
if (!pathname) {
|
|
92
|
-
pathname = window.location.pathname;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
var isSwitchingLocale = locale !== cookieLocale;
|
|
96
|
-
var isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);
|
|
97
|
-
|
|
98
|
-
if (isPathnamePrefixed || isSwitchingLocale) {
|
|
99
|
-
var prefixedHref;
|
|
100
|
-
|
|
101
|
-
if (typeof href === 'string') {
|
|
102
|
-
prefixedHref = localizePathname(locale, href);
|
|
103
|
-
} else {
|
|
104
|
-
prefixedHref = _extends({}, href);
|
|
105
|
-
|
|
106
|
-
if (href.pathname) {
|
|
107
|
-
prefixedHref.pathname = localizePathname(locale, href.pathname);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return prefixedHref;
|
|
112
|
-
} else {
|
|
113
|
-
return href;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
var _excluded$1 = ["href", "locale", "prefetch"];
|
|
118
|
-
/**
|
|
119
|
-
* Wraps `next/link` and prefixes the `href` with the current locale.
|
|
120
|
-
*
|
|
121
|
-
* Note that when a `locale` prop is passed, two de-optimizations are made:
|
|
122
|
-
*
|
|
123
|
-
* 1. The `prefetch` prop is not supported. This is because Next.js prefetches
|
|
124
|
-
* the page and the `set-cookie` response header will cause the locale cookie
|
|
125
|
-
* on the current page to be overwritten.
|
|
126
|
-
* 2. A regular anchor tag is used instead of `next/link`. This is to avoid a
|
|
127
|
-
* bug with Server Components where the markup wouldn't be updated correctly
|
|
128
|
-
* otherwise.
|
|
129
|
-
*/
|
|
130
|
-
|
|
131
|
-
function Link(_ref, ref) {
|
|
132
|
-
var href = _ref.href,
|
|
133
|
-
locale = _ref.locale,
|
|
134
|
-
prefetch = _ref.prefetch,
|
|
135
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
136
|
-
|
|
137
|
-
var _useState = React.useState(href),
|
|
138
|
-
localizedHref = _useState[0],
|
|
139
|
-
setLocalizedHref = _useState[1];
|
|
140
|
-
|
|
141
|
-
var pathname = navigation.usePathname();
|
|
142
|
-
React.useEffect(function () {
|
|
143
|
-
setLocalizedHref(localizeHref(href, locale, pathname != null ? pathname : undefined));
|
|
144
|
-
}, [href, locale, pathname]);
|
|
145
|
-
|
|
146
|
-
if (locale !== undefined) {
|
|
147
|
-
// If Next.js fixes the bug where the markup isn't updated correctly when
|
|
148
|
-
// the locale changes, we can remove this check. Note however that we still
|
|
149
|
-
// need to disable prefetching (see comment above).
|
|
150
|
-
if (prefetch && "development" !== 'production') {
|
|
151
|
-
console.error('The `prefetch` prop is currently not supported when using the `locale` prop on `Link`.`');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
var localizedHrefString;
|
|
155
|
-
|
|
156
|
-
if (typeof localizedHref === 'string') {
|
|
157
|
-
localizedHrefString = localizedHref;
|
|
158
|
-
} else if (localizedHref) {
|
|
159
|
-
localizedHrefString = localizedHref.toString();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return (// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
163
|
-
React__default["default"].createElement("a", _extends({
|
|
164
|
-
ref: ref,
|
|
165
|
-
href: localizedHrefString
|
|
166
|
-
}, rest))
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return React__default["default"].createElement(NextLink__default["default"], _extends({
|
|
171
|
-
ref: ref,
|
|
172
|
-
href: localizedHref,
|
|
173
|
-
prefetch: prefetch
|
|
174
|
-
}, rest));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
var Link$1 = /*#__PURE__*/React.forwardRef(Link);
|
|
178
|
-
|
|
179
|
-
var _excluded = ["children", "locale", "now"];
|
|
180
|
-
|
|
181
|
-
function NextIntlClientProvider(_ref) {
|
|
182
|
-
var children = _ref.children,
|
|
183
|
-
locale = _ref.locale,
|
|
184
|
-
now = _ref.now,
|
|
46
|
+
var _excluded = ["locale"];
|
|
47
|
+
function NextIntlProvider(_ref) {
|
|
48
|
+
var locale = _ref.locale,
|
|
185
49
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
186
50
|
|
|
187
51
|
var router$1;
|
|
@@ -197,13 +61,6 @@ function NextIntlClientProvider(_ref) {
|
|
|
197
61
|
|
|
198
62
|
if (!locale && router$1) {
|
|
199
63
|
locale = router$1.locale;
|
|
200
|
-
} // Currently RSC serialize dates to strings, therefore make sure we have
|
|
201
|
-
// a date object. We might be able to remove this once more types have
|
|
202
|
-
// first-class serialization support (https://github.com/facebook/react/issues/25687)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (typeof now === 'string') {
|
|
206
|
-
now = new Date(now);
|
|
207
64
|
}
|
|
208
65
|
|
|
209
66
|
if (!locale) {
|
|
@@ -211,56 +68,11 @@ function NextIntlClientProvider(_ref) {
|
|
|
211
68
|
}
|
|
212
69
|
|
|
213
70
|
return React__default["default"].createElement(useIntl.IntlProvider, _extends({
|
|
214
|
-
locale: locale
|
|
215
|
-
|
|
216
|
-
}, rest), children);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function useRouter() {
|
|
220
|
-
var router = navigation.useRouter();
|
|
221
|
-
return React.useMemo(function () {
|
|
222
|
-
return _extends({}, router, {
|
|
223
|
-
push: function push(href) {
|
|
224
|
-
return router.push(localizeHref(href));
|
|
225
|
-
},
|
|
226
|
-
replace: function replace(href) {
|
|
227
|
-
return router.replace(localizeHref(href));
|
|
228
|
-
},
|
|
229
|
-
prefetch: function prefetch(href) {
|
|
230
|
-
return router.prefetch(localizeHref(href));
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}, [router]);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// during the beta, remove for stable release
|
|
237
|
-
|
|
238
|
-
var hasWarned = false;
|
|
239
|
-
function useLocalizedRouterDeprecated() {
|
|
240
|
-
if (!hasWarned) {
|
|
241
|
-
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");
|
|
242
|
-
hasWarned = true;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
return useRouter();
|
|
71
|
+
locale: locale
|
|
72
|
+
}, rest));
|
|
246
73
|
}
|
|
247
74
|
|
|
248
|
-
/**
|
|
249
|
-
* This is the main entry file when non-'react-server' environments import
|
|
250
|
-
* from 'next-intl'. Make sure this mirrors the API from 'react-server'.
|
|
251
|
-
*/
|
|
252
|
-
/** @deprecated Is called `NextIntlClientProvider` now. */
|
|
253
|
-
|
|
254
|
-
var NextIntlProvider = NextIntlClientProvider;
|
|
255
|
-
/** @deprecated Is called `Link` now. */
|
|
256
|
-
|
|
257
|
-
var LocalizedLink = Link$1;
|
|
258
|
-
|
|
259
|
-
exports.Link = Link$1;
|
|
260
|
-
exports.LocalizedLink = LocalizedLink;
|
|
261
|
-
exports.NextIntlClientProvider = NextIntlClientProvider;
|
|
262
75
|
exports.NextIntlProvider = NextIntlProvider;
|
|
263
|
-
exports.useLocalizedRouter = useLocalizedRouterDeprecated;
|
|
264
76
|
Object.keys(useIntl).forEach(function (k) {
|
|
265
77
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
266
78
|
enumerable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.cjs.development.js","sources":["../src/shared/localizePathname.tsx","../src/shared/constants.tsx","../src/client/getCookieLocale.tsx","../src/client/hasPathnamePrefixed.tsx","../src/client/localizeHref.tsx","../src/shared/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/client/useRouter.tsx","../src/react-client/useLocalizedRouter.tsx","../src/index.tsx"],"sourcesContent":["export default function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n","// 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","import {COOKIE_LOCALE_NAME} from '../shared/constants';\n\nfunction getCookieValueByName(name: string) {\n // https://stackoverflow.com/a/15724300/343045\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n const part = parts.pop()?.split(';').shift();\n if (part) return part;\n }\n\n throw new Error(\n `Unable to find next-intl cookie, have you configured the middleware?`\n );\n}\n\nexport default function getCookieLocale() {\n return getCookieValueByName(COOKIE_LOCALE_NAME);\n}\n","export default function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return (\n pathname === prefix ||\n (pathname.startsWith(`${prefix}/`) && pathname.length > prefix.length)\n );\n}\n","import {UrlObject} from 'url';\nimport localizePathname from '../shared/localizePathname';\nimport getCookieLocale from './getCookieLocale';\nimport hasPathnamePrefixed from './hasPathnamePrefixed';\n\nexport default function localizeHref(\n href: string,\n locale?: string,\n pathname?: string\n): string;\nexport default function localizeHref(\n href: UrlObject | string,\n locale?: string,\n pathname?: string\n): UrlObject | string;\nexport default function localizeHref(\n href: UrlObject | string,\n locale?: string,\n pathname?: string\n) {\n const cookieLocale = getCookieLocale();\n if (!locale) locale = cookieLocale;\n\n if (!pathname) {\n pathname = window.location.pathname;\n }\n\n const isSwitchingLocale = locale !== cookieLocale;\n const isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);\n\n if (isPathnamePrefixed || isSwitchingLocale) {\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 } else {\n return href;\n }\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport localizeHref from '../client/localizeHref';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale?: string;\n};\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale.\n *\n * Note that when a `locale` prop is passed, two de-optimizations are made:\n *\n * 1. The `prefetch` prop is not supported. This is because Next.js prefetches\n * the page and the `set-cookie` response header will cause the locale cookie\n * on the current page to be overwritten.\n * 2. A regular anchor tag is used instead of `next/link`. This is to avoid a\n * bug with Server Components where the markup wouldn't be updated correctly\n * otherwise.\n */\nfunction Link({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n const [localizedHref, setLocalizedHref] = useState<typeof href>(href);\n const pathname = usePathname();\n\n useEffect(() => {\n setLocalizedHref(localizeHref(href, locale, pathname ?? undefined));\n }, [href, locale, pathname]);\n\n if (locale !== undefined) {\n // If Next.js fixes the bug where the markup isn't updated correctly when\n // the locale changes, we can remove this check. Note however that we still\n // need to disable prefetching (see comment above).\n\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`.`'\n );\n }\n\n let localizedHrefString;\n if (typeof localizedHref === 'string') {\n localizedHrefString = localizedHref;\n } else if (localizedHref) {\n localizedHrefString = localizedHref.toString();\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a ref={ref} href={localizedHrefString} {...rest} />\n );\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(Link);\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\n// Move this from /client to default\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 './localizeHref';\n\nexport default function useRouter() {\n const router = useNextRouter();\n\n return useMemo(\n () => ({\n ...router,\n push(href: string) {\n return router.push(localizeHref(href));\n },\n replace(href: string) {\n return router.replace(localizeHref(href));\n },\n prefetch(href: string) {\n return router.prefetch(localizeHref(href));\n }\n }),\n [router]\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' environments import\n * from 'next-intl'. Make sure this mirrors the API from 'react-server'.\n */\n\nimport Link from './shared/Link';\nimport NextIntlClientProvider from './shared/NextIntlClientProvider';\n\nexport * from 'use-intl';\n\nexport {default as useLocalizedRouter} from './react-client/useLocalizedRouter';\nexport {default as Link} from './shared/Link';\nexport {default as NextIntlClientProvider} from './shared/NextIntlClientProvider';\n\n/** @deprecated Is called `NextIntlClientProvider` now. */\nexport const NextIntlProvider = NextIntlClientProvider;\n\n/** @deprecated Is called `Link` now. */\nexport const LocalizedLink = Link;\n"],"names":["localizePathname","locale","pathname","localizedHref","COOKIE_LOCALE_NAME","getCookieValueByName","name","value","document","cookie","parts","split","length","part","pop","shift","Error","getCookieLocale","hasPathnamePrefixed","prefix","startsWith","localizeHref","href","cookieLocale","window","location","isSwitchingLocale","isPathnamePrefixed","prefixedHref","Link","ref","prefetch","rest","_excluded","useState","setLocalizedHref","usePathname","useEffect","undefined","process","console","error","localizedHrefString","toString","React","createElement","NextLink","forwardRef","NextIntlClientProvider","children","now","router","useRouter","Date","IntlProvider","useNextRouter","useMemo","push","replace","hasWarned","useLocalizedRouterDeprecated","warn","NextIntlProvider","LocalizedLink"],"mappings":";;;;;;;;;;;;;;;;;;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../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["'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'> & {\n locale?: string;\n};\n\nexport default function NextIntlProvider({locale, ...rest}: 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 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 <IntlProvider locale={locale} {...rest} />;\n}\n"],"names":["NextIntlProvider","locale","rest","router","useRouter","error","Error","React","createElement","IntlProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUc,SAAUA,gBAAV,CAAmD,IAAA,EAAA;AAAA,EAAvBC,IAAAA,MAAuB,QAAvBA,MAAuB;AAAA,MAAZC,IAAY,GAAA,6BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AAC/D,EAAA,IAAIC,QAAJ,CAAA;;AACA,EAAI,IAAA;AACF;AACA;AACAA,IAAAA,QAAM,GAAGC,gBAAS,EAAlB,CAAA;AACD,GAJD,CAIE,OAAOC,KAAP,EAAc;AAEf,GAR8D;AAW/D;;;AACA,EAAA,IAAI,CAACJ,MAAD,IAAWE,QAAf,EAAuB;AACrBF,IAAAA,MAAM,GAAGE,QAAM,CAACF,MAAhB,CAAA;AACD,GAAA;;AAED,EAAI,IAAA,CAACA,MAAL,EAAa;AACX,IAAA,MAAM,IAAIK,KAAJ,CAEA,+MADJ,CADI,CAAN,CAAA;AAKD,GAAA;;AAED,EAAA,OAAOC,yBAAA,CAAAC,aAAA,CAACC,oBAAD,EAAA,QAAA,CAAA;AAAcR,IAAAA,MAAM,EAAEA,MAAAA;AAAtB,GAAA,EAAkCC,IAAlC,CAAP,CAAA,CAAA;AACD;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("use-intl"),r=require("next/router");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(require("react"));function o(){return o=Object.assign||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},o.apply(this,arguments)}var u=["locale"];exports.NextIntlProvider=function(t){var a,l=t.locale,c=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)r.indexOf(t=u[n])>=0||(o[t]=e[t]);return o}(t,u);try{a=r.useRouter()}catch(e){}if(!l&&a&&(l=a.locale),!l)throw new Error(void 0);return n.default.createElement(e.IntlProvider,o({locale:l},c))},Object.keys(e).forEach((function(r){"default"===r||exports.hasOwnProperty(r)||Object.defineProperty(exports,r,{enumerable:!0,get:function(){return e[r]}})}));
|
|
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/localizePathname.tsx","../src/client/localizeHref.tsx","../src/client/getCookieLocale.tsx","../src/client/hasPathnamePrefixed.tsx","../src/shared/Link.tsx","../src/shared/NextIntlClientProvider.tsx","../src/react-client/useLocalizedRouter.tsx","../src/index.tsx","../src/client/useRouter.tsx"],"sourcesContent":["export default function localizePathname(locale: string, pathname: string) {\n let localizedHref = '/' + locale;\n\n if (pathname !== '/') {\n localizedHref += pathname;\n }\n\n return localizedHref;\n}\n","import {UrlObject} from 'url';\nimport localizePathname from '../shared/localizePathname';\nimport getCookieLocale from './getCookieLocale';\nimport hasPathnamePrefixed from './hasPathnamePrefixed';\n\nexport default function localizeHref(\n href: string,\n locale?: string,\n pathname?: string\n): string;\nexport default function localizeHref(\n href: UrlObject | string,\n locale?: string,\n pathname?: string\n): UrlObject | string;\nexport default function localizeHref(\n href: UrlObject | string,\n locale?: string,\n pathname?: string\n) {\n const cookieLocale = getCookieLocale();\n if (!locale) locale = cookieLocale;\n\n if (!pathname) {\n pathname = window.location.pathname;\n }\n\n const isSwitchingLocale = locale !== cookieLocale;\n const isPathnamePrefixed = hasPathnamePrefixed(locale, pathname);\n\n if (isPathnamePrefixed || isSwitchingLocale) {\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 } else {\n return href;\n }\n}\n","import {COOKIE_LOCALE_NAME} from '../shared/constants';\n\nfunction getCookieValueByName(name: string) {\n // https://stackoverflow.com/a/15724300/343045\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n const part = parts.pop()?.split(';').shift();\n if (part) return part;\n }\n\n throw new Error(\n `Unable to find next-intl cookie, have you configured the middleware?`\n );\n}\n\nexport default function getCookieLocale() {\n return getCookieValueByName(COOKIE_LOCALE_NAME);\n}\n","export default function hasPathnamePrefixed(locale: string, pathname: string) {\n const prefix = `/${locale}`;\n return (\n pathname === prefix ||\n (pathname.startsWith(`${prefix}/`) && pathname.length > prefix.length)\n );\n}\n","'use client';\n\nimport NextLink from 'next/link';\nimport {usePathname} from 'next/navigation';\nimport React, {ComponentProps, forwardRef, useEffect, useState} from 'react';\nimport localizeHref from '../client/localizeHref';\n\ntype Props = Omit<ComponentProps<typeof NextLink>, 'locale'> & {\n locale?: string;\n};\n\n/**\n * Wraps `next/link` and prefixes the `href` with the current locale.\n *\n * Note that when a `locale` prop is passed, two de-optimizations are made:\n *\n * 1. The `prefetch` prop is not supported. This is because Next.js prefetches\n * the page and the `set-cookie` response header will cause the locale cookie\n * on the current page to be overwritten.\n * 2. A regular anchor tag is used instead of `next/link`. This is to avoid a\n * bug with Server Components where the markup wouldn't be updated correctly\n * otherwise.\n */\nfunction Link({href, locale, prefetch, ...rest}: Props, ref: Props['ref']) {\n const [localizedHref, setLocalizedHref] = useState<typeof href>(href);\n const pathname = usePathname();\n\n useEffect(() => {\n setLocalizedHref(localizeHref(href, locale, pathname ?? undefined));\n }, [href, locale, pathname]);\n\n if (locale !== undefined) {\n // If Next.js fixes the bug where the markup isn't updated correctly when\n // the locale changes, we can remove this check. Note however that we still\n // need to disable prefetching (see comment above).\n\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`.`'\n );\n }\n\n let localizedHrefString;\n if (typeof localizedHref === 'string') {\n localizedHrefString = localizedHref;\n } else if (localizedHref) {\n localizedHrefString = localizedHref.toString();\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n <a ref={ref} href={localizedHrefString} {...rest} />\n );\n }\n\n return (\n <NextLink ref={ref} href={localizedHref} prefetch={prefetch} {...rest} />\n );\n}\n\nexport default forwardRef(Link);\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\n// Move this from /client to default\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' environments import\n * from 'next-intl'. Make sure this mirrors the API from 'react-server'.\n */\n\nimport Link from './shared/Link';\nimport NextIntlClientProvider from './shared/NextIntlClientProvider';\n\nexport * from 'use-intl';\n\nexport {default as useLocalizedRouter} from './react-client/useLocalizedRouter';\nexport {default as Link} from './shared/Link';\nexport {default as NextIntlClientProvider} from './shared/NextIntlClientProvider';\n\n/** @deprecated Is called `NextIntlClientProvider` now. */\nexport const NextIntlProvider = NextIntlClientProvider;\n\n/** @deprecated Is called `Link` now. */\nexport const LocalizedLink = Link;\n","import {useRouter as useNextRouter} from 'next/navigation';\nimport {useMemo} from 'react';\nimport localizeHref from './localizeHref';\n\nexport default function useRouter() {\n const router = useNextRouter();\n\n return useMemo(\n () => ({\n ...router,\n push(href: string) {\n return router.push(localizeHref(href));\n },\n replace(href: string) {\n return router.replace(localizeHref(href));\n },\n prefetch(href: string) {\n return router.prefetch(localizeHref(href));\n }\n }),\n [router]\n );\n}\n"],"names":["localizePathname","locale","pathname","localizedHref","localizeHref","href","cookieLocale","name","parts","document","cookie","split","length","_parts$pop","part","pop","shift","Error","getCookieValueByName","window","location","prefixedHref","isSwitchingLocale","isPathnamePrefixed","prefix","startsWith","hasPathnamePrefixed","Link","ref","localizedHrefString","prefetch","rest","_objectWithoutPropertiesLoose","_ref","_excluded","useState","_useState","setLocalizedHref","usePathname","useEffect","undefined","toString","React","createElement","_extends","NextLink","Link$1","forwardRef","NextIntlClientProvider","children","router","now","useRouter","error","Date","IntlProvider","hasWarned","NextIntlProvider","LocalizedLink","console","warn","useNextRouter","useMemo","push","replace"],"mappings":"4mBAAc,SAAUA,EAAiBC,EAAgBC,GACnDC,IAAAA,EAAgB,IAAMF,EAM1B,MAJiB,MAAbC,IACFC,GAAiBD,GAGZC,ECQe,SAAAC,EACtBC,EACAJ,EACAC,GAEMI,IAAAA,EClBR,SAA8BC,GAE5B,IACMC,GADK,KAAQC,SAASC,QACRC,MAAN,kBACd,GAAqB,IAAjBH,EAAMI,OAAc,CAAA,IAAAC,EAChBC,EAAO,OAAHD,EAAGL,EAAMO,YAAN,EAAAF,EAAaF,MAAM,KAAKK,QACjCF,GAAAA,EAAM,OAAOA,EAGb,MAAA,IAAIG,MAAV,wEAMOC,GDIFjB,IAAQA,EAASK,GAEjBJ,IACHA,EAAWiB,OAAOC,SAASlB,UAG7B,IAIMmB,EAJAC,EAAoBrB,IAAWK,EAC/BiB,EE5BM,SAA8BtB,EAAgBC,GACpDsB,IAAAA,MAAavB,EACnB,OACEC,IAAasB,GACZtB,EAASuB,WAAcD,EAAvB,MAAqCtB,EAASU,OAASY,EAAOZ,OFwBtCc,CAAoBzB,EAAQC,GAEnDqB,OAA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WAQZ,OAPK6B,IACHG,QAAQC,KAAR,gSAGAJ,GAAY,GERF,WACNN,IAAAA,EAASW,EAAAA,YAEf,OAAOC,EAAOA,SACZ,WAAA,OAAAlB,EAAA,GACKM,EADL,CAEEa,KAAK1D,SAAAA,GACI6C,OAAAA,EAAOa,KAAK3D,EAAaC,KAElC2D,QAAQ3D,SAAAA,GACC6C,OAAAA,EAAOc,QAAQ5D,EAAaC,KAErCyB,SAASzB,SAAAA,GACA6C,OAAAA,EAAOpB,SAAS1B,EAAaC,SAGxC,CAAC6C,IFLIE"}
|
|
1
|
+
{"version":3,"file":"next-intl.cjs.production.min.js","sources":["../src/client/NextIntlClientProvider.tsx"],"sourcesContent":["'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'> & {\n locale?: string;\n};\n\nexport default function NextIntlProvider({locale, ...rest}: 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 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 <IntlProvider locale={locale} {...rest} />;\n}\n"],"names":["_ref","locale","router","rest","_objectWithoutPropertiesLoose","_excluded","useRouter","error","Error","undefined","React","createElement","IntlProvider","_extends"],"mappings":"mdAUc,SAAmDA,GAAvBC,IACpCC,EADoCD,IAAAA,OAAWE,oIAAYC,CAAAJ,EAAAK,GAE3D,IAGFH,EAASI,EAASA,YAClB,MAAOC,IAUL,IAJCN,GAAUC,IACbD,EAASC,EAAOD,SAGbA,EACH,MAAM,IAAIO,WAGJC,GAIR,OAAOC,UAAAC,cAACC,EAADA,aAAAC,EAAA,CAAcZ,OAAQA,GAAYE"}
|
package/dist/next-intl.esm.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import Link from './shared/next-intl.esm.js';
|
|
2
|
-
export { default as Link } from './shared/next-intl.esm.js';
|
|
3
|
-
import NextIntlClientProvider from './shared/next-intl.esm2.js';
|
|
4
|
-
export { default as NextIntlClientProvider } from './shared/next-intl.esm2.js';
|
|
5
1
|
export * from 'use-intl';
|
|
6
|
-
export { default as
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This is the main entry file when non-'react-server' environments import
|
|
10
|
-
* from 'next-intl'. Make sure this mirrors the API from 'react-server'.
|
|
11
|
-
*/
|
|
12
|
-
/** @deprecated Is called `NextIntlClientProvider` now. */
|
|
13
|
-
|
|
14
|
-
var NextIntlProvider = NextIntlClientProvider;
|
|
15
|
-
/** @deprecated Is called `Link` now. */
|
|
16
|
-
|
|
17
|
-
var LocalizedLink = Link;
|
|
18
|
-
|
|
19
|
-
export { LocalizedLink, NextIntlProvider };
|
|
2
|
+
export { default as NextIntlProvider } from './client/next-intl.esm.js';
|
|
20
3
|
//# sourceMappingURL=next-intl.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-intl.esm.js","sources":[
|
|
1
|
+
{"version":3,"file":"next-intl.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,47 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the main entry file when the 'react-server' environment imports
|
|
3
|
-
* from 'next-intl'. Make sure this mirrors the API from the main entry.
|
|
4
|
-
*/
|
|
5
|
-
/// <reference types="react" />
|
|
6
|
-
/// <reference types="node" />
|
|
7
|
-
export { default as useLocale } from './useLocale';
|
|
8
|
-
export { default as useTranslations } from './useTranslations';
|
|
9
|
-
export { default as useIntl } from './useIntl';
|
|
10
|
-
export { default as useFormatter } from './useFormatter';
|
|
11
|
-
export { default as useNow } from './useNow';
|
|
12
|
-
export { default as useTimeZone } from './useTimeZone';
|
|
13
|
-
export { default as Link } from '../shared/Link';
|
|
14
|
-
export { default as NextIntlClientProvider } from '../shared/NextIntlClientProvider';
|
|
15
1
|
export * from 'use-intl/dist/src/core';
|
|
16
|
-
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
passHref?: boolean | undefined;
|
|
24
|
-
prefetch?: boolean | undefined;
|
|
25
|
-
locale?: string | false | undefined;
|
|
26
|
-
legacyBehavior?: boolean | undefined;
|
|
27
|
-
onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
28
|
-
onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
29
|
-
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
30
|
-
}> & {
|
|
31
|
-
href: string | import("url").UrlObject;
|
|
32
|
-
as?: (string | import("url").UrlObject) | undefined;
|
|
33
|
-
replace?: boolean | undefined;
|
|
34
|
-
scroll?: boolean | undefined;
|
|
35
|
-
shallow?: boolean | undefined;
|
|
36
|
-
passHref?: boolean | undefined;
|
|
37
|
-
prefetch?: boolean | undefined;
|
|
38
|
-
locale?: string | false | undefined;
|
|
39
|
-
legacyBehavior?: boolean | undefined;
|
|
40
|
-
onMouseEnter?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
41
|
-
onTouchStart?: import("react").TouchEventHandler<HTMLAnchorElement> | undefined;
|
|
42
|
-
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
43
|
-
} & {
|
|
44
|
-
children?: import("react").ReactNode;
|
|
45
|
-
} & import("react").RefAttributes<HTMLAnchorElement>, "locale"> & {
|
|
46
|
-
locale?: string | undefined;
|
|
47
|
-
}, "href" | "as" | "replace" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "onMouseEnter" | "onTouchStart" | "onClick" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
2
|
+
declare function notSupported(): void;
|
|
3
|
+
export declare const IntlProvider: typeof notSupported;
|
|
4
|
+
export declare const useTranslations: typeof notSupported;
|
|
5
|
+
export declare const useIntl: typeof notSupported;
|
|
6
|
+
export declare const useLocale: typeof notSupported;
|
|
7
|
+
export declare const useNow: typeof notSupported;
|
|
8
|
+
export declare const useTimeZone: typeof notSupported;
|