use-intl 4.0.0-beta-8f37883 → 4.0.0-beta-0825f08

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/README.md CHANGED
@@ -80,4 +80,4 @@ function App({user}) {
80
80
 
81
81
  Have a look at [the minimal setup example](https://github.com/amannn/next-intl/tree/main/examples/example-use-intl) to explore a working app.
82
82
 
83
- ### [→ Read the docs](https://next-intl-docs.vercel.app/docs/environments/core-library)
83
+ ### [→ Read the docs](https://next-intl.dev/docs/environments/core-library)
@@ -1,5 +1,5 @@
1
- import { r as resolveNamespace, e as createBaseTranslator, d as createCache, b as createIntlFormatters, f as defaultGetMessageFallback, g as defaultOnError } from './initializeConfig-lFPDYrt3.js';
2
- export { I as IntlError, a as IntlErrorCode, c as createFormatter, i as initializeConfig } from './initializeConfig-lFPDYrt3.js';
1
+ import { r as resolveNamespace, e as createBaseTranslator, d as createCache, b as createIntlFormatters, f as defaultGetMessageFallback, g as defaultOnError } from './initializeConfig-DNjOIggo.js';
2
+ export { I as IntlError, a as IntlErrorCode, c as createFormatter, i as initializeConfig } from './initializeConfig-DNjOIggo.js';
3
3
 
4
4
 
5
5
 
@@ -1,4 +1,4 @@
1
- export { I as IntlError, a as IntlErrorCode, d as _createCache, b as _createIntlFormatters, c as createFormatter, i as initializeConfig } from './initializeConfig-lFPDYrt3.js';
1
+ export { I as IntlError, a as IntlErrorCode, d as _createCache, b as _createIntlFormatters, c as createFormatter, i as initializeConfig } from './initializeConfig-DNjOIggo.js';
2
2
  export { createTranslator, hasLocale } from './core.js';
3
3
  export { IntlProvider, useFormatter, useLocale, useMessages, useNow, useTimeZone, useTranslations } from './react.js';
4
4
 
@@ -271,12 +271,12 @@ function createBaseTranslatorImpl({
271
271
  if (Array.isArray(message)) {
272
272
  code = IntlErrorCode.INVALID_MESSAGE;
273
273
  {
274
- errorMessage = `Message at \`${joinPath(namespace, key)}\` resolved to an array, but only strings are supported. See https://next-intl-docs.vercel.app/docs/usage/messages#arrays-of-messages`;
274
+ errorMessage = `Message at \`${joinPath(namespace, key)}\` resolved to an array, but only strings are supported. See https://next-intl.dev/docs/usage/messages#arrays-of-messages`;
275
275
  }
276
276
  } else {
277
277
  code = IntlErrorCode.INSUFFICIENT_PATH;
278
278
  {
279
- errorMessage = `Message at \`${joinPath(namespace, key)}\` resolved to an object, but only strings are supported. Use a \`.\` to retrieve nested messages. See https://next-intl-docs.vercel.app/docs/usage/messages#structuring-messages`;
279
+ errorMessage = `Message at \`${joinPath(namespace, key)}\` resolved to an object, but only strings are supported. Use a \`.\` to retrieve nested messages. See https://next-intl.dev/docs/usage/messages#structuring-messages`;
280
280
  }
281
281
  }
282
282
  return getFallbackFromErrorAndNotify(key, code, errorMessage);
@@ -460,7 +460,7 @@ function createFormatter(props) {
460
460
  timeZone: globalTimeZone
461
461
  };
462
462
  } else {
463
- onError(new IntlError(IntlErrorCode.ENVIRONMENT_FALLBACK, `The \`timeZone\` parameter wasn't provided and there is no global default configured. Consider adding a global default to avoid markup mismatches caused by environment differences. Learn more: https://next-intl-docs.vercel.app/docs/configuration#time-zone` ));
463
+ onError(new IntlError(IntlErrorCode.ENVIRONMENT_FALLBACK, `The \`timeZone\` parameter wasn't provided and there is no global default configured. Consider adding a global default to avoid markup mismatches caused by environment differences. Learn more: https://next-intl.dev/docs/configuration#time-zone` ));
464
464
  }
465
465
  }
466
466
  return options;
@@ -524,7 +524,7 @@ function createFormatter(props) {
524
524
  if (props.now) {
525
525
  return props.now;
526
526
  } else {
527
- onError(new IntlError(IntlErrorCode.ENVIRONMENT_FALLBACK, `The \`now\` parameter wasn't provided to \`relativeTime\` and there is no global default configured, therefore the current time will be used as a fallback. See https://next-intl-docs.vercel.app/docs/usage/dates-times#relative-times-usenow` ));
527
+ onError(new IntlError(IntlErrorCode.ENVIRONMENT_FALLBACK, `The \`now\` parameter wasn't provided to \`relativeTime\` and there is no global default configured, therefore the current time will be used as a fallback. See https://next-intl.dev/docs/usage/dates-times#relative-times-usenow` ));
528
528
  return new Date();
529
529
  }
530
530
  }
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext, useMemo, useState, useEffect } from 'react';
2
- import { d as createCache, b as createIntlFormatters, i as initializeConfig, r as resolveNamespace, I as IntlError, a as IntlErrorCode, e as createBaseTranslator, c as createFormatter } from './initializeConfig-lFPDYrt3.js';
2
+ import { d as createCache, b as createIntlFormatters, i as initializeConfig, r as resolveNamespace, I as IntlError, a as IntlErrorCode, e as createBaseTranslator, c as createFormatter } from './initializeConfig-DNjOIggo.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
5
 
@@ -57,7 +57,7 @@ function IntlProvider({
57
57
  function useIntlContext() {
58
58
  const context = useContext(IntlContext);
59
59
  if (!context) {
60
- throw new Error('No intl context found. Have you configured the provider? See https://next-intl-docs.vercel.app/docs/usage/configuration#server-client-components' );
60
+ throw new Error('No intl context found. Have you configured the provider? See https://next-intl.dev/docs/usage/configuration#server-client-components' );
61
61
  }
62
62
  return context;
63
63
  }
@@ -82,7 +82,7 @@ function useTranslationsImpl(allMessagesPrefixed, namespacePrefixed, namespacePr
82
82
  if (!timeZone && !hasWarnedForMissingTimezone && isServer) {
83
83
  // eslint-disable-next-line react-compiler/react-compiler
84
84
  hasWarnedForMissingTimezone = true;
85
- onError(new IntlError(IntlErrorCode.ENVIRONMENT_FALLBACK, `There is no \`timeZone\` configured, this can lead to markup mismatches caused by environment differences. Consider adding a global default: https://next-intl-docs.vercel.app/docs/configuration#time-zone` ));
85
+ onError(new IntlError(IntlErrorCode.ENVIRONMENT_FALLBACK, `There is no \`timeZone\` configured, this can lead to markup mismatches caused by environment differences. Consider adding a global default: https://next-intl.dev/docs/configuration#time-zone` ));
86
86
  }
87
87
  const translate = useMemo(() => createBaseTranslator({
88
88
  cache,
@@ -130,7 +130,7 @@ function getNow() {
130
130
  }
131
131
 
132
132
  /**
133
- * @see https://next-intl-docs.vercel.app/docs/usage/dates-times#relative-times-usenow
133
+ * @see https://next-intl.dev/docs/usage/dates-times#relative-times-usenow
134
134
  */
135
135
  function useNow(options) {
136
136
  const updateInterval = options?.updateInterval;
@@ -157,7 +157,7 @@ function useTimeZone() {
157
157
  function useMessages() {
158
158
  const context = useIntlContext();
159
159
  if (!context.messages) {
160
- throw new Error('No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages' );
160
+ throw new Error('No messages found. Have you configured them correctly? See https://next-intl.dev/docs/configuration#messages' );
161
161
  }
162
162
  return context.messages;
163
163
  }
@@ -2,7 +2,7 @@
2
2
  * A generic type that describes the shape of messages.
3
3
  *
4
4
  * Optionally, messages can be strictly-typed in order to get type safety for message
5
- * namespaces and keys. See https://next-intl-docs.vercel.app/docs/usage/typescript
5
+ * namespaces and keys. See https://next-intl.dev/docs/usage/typescript
6
6
  */
7
7
  type AbstractIntlMessages = {
8
8
  [id: string]: AbstractIntlMessages | string;
@@ -4,4 +4,4 @@ import type { Locale } from './AppConfig.tsx';
4
4
  *
5
5
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale
6
6
  */
7
- export default function hasLocale<LocaleType extends Locale>(locales: ReadonlyArray<LocaleType>, candidate?: string | null): candidate is LocaleType;
7
+ export default function hasLocale<LocaleType extends Locale>(locales: ReadonlyArray<LocaleType>, candidate: unknown): candidate is LocaleType;
@@ -2,7 +2,7 @@ type Options = {
2
2
  updateInterval?: number;
3
3
  };
4
4
  /**
5
- * @see https://next-intl-docs.vercel.app/docs/usage/dates-times#relative-times-usenow
5
+ * @see https://next-intl.dev/docs/usage/dates-times#relative-times-usenow
6
6
  */
7
7
  export default function useNow(options?: Options): Date;
8
8
  export {};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "use-intl",
3
- "version": "4.0.0-beta-8f37883",
3
+ "version": "4.0.0-beta-0825f08",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "description": "Internationalization (i18n) for React",
7
7
  "license": "MIT",
8
- "homepage": "https://next-intl-docs.vercel.app/",
8
+ "homepage": "https://next-intl.dev",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/amannn/next-intl/tree/main/packages/use-intl"
@@ -62,7 +62,7 @@
62
62
  "intl-messageformat": "^10.5.14"
63
63
  },
64
64
  "peerDependencies": {
65
- "react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0"
65
+ "react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
66
66
  },
67
- "gitHead": "a9f295bd5e8f3bc25de067dd93d81a1b1bd54977"
67
+ "gitHead": "4c9f2f636b2ce73f2758b77035f94d47e9f91879"
68
68
  }