use-intl 4.0.0-beta-5b218d4 → 4.0.0-beta-67507cc
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Locale } from './AppConfig.js';
|
|
1
|
+
import type { Locale, Messages } from './AppConfig.js';
|
|
3
2
|
import type Formats from './Formats.js';
|
|
4
3
|
import type IntlError from './IntlError.js';
|
|
5
4
|
import type TimeZone from './TimeZone.js';
|
|
5
|
+
import type { DeepPartial } from './types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Should be used for entry points that configure the library.
|
|
8
8
|
*/
|
|
9
|
-
type IntlConfig
|
|
9
|
+
type IntlConfig = {
|
|
10
10
|
/** A valid Unicode locale tag (e.g. "en" or "en-GB"). */
|
|
11
11
|
locale: Locale;
|
|
12
12
|
/** Global formats can be provided to achieve consistent
|
|
@@ -38,14 +38,15 @@ type IntlConfig<Messages extends AbstractIntlMessages = AbstractIntlMessages> =
|
|
|
38
38
|
*/
|
|
39
39
|
now?: Date;
|
|
40
40
|
/** All messages that will be available. */
|
|
41
|
-
messages?: Messages
|
|
41
|
+
messages?: DeepPartial<Messages>;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
43
44
|
/**
|
|
44
45
|
* A stricter set of the configuration that should be used internally
|
|
45
46
|
* once defaults are assigned to `IntlConfiguration`.
|
|
46
47
|
*/
|
|
47
|
-
export type InitializedIntlConfig
|
|
48
|
-
onError: NonNullable<IntlConfig
|
|
49
|
-
getMessageFallback: NonNullable<IntlConfig
|
|
48
|
+
export type InitializedIntlConfig = IntlConfig & {
|
|
49
|
+
onError: NonNullable<IntlConfig['onError']>;
|
|
50
|
+
getMessageFallback: NonNullable<IntlConfig['getMessageFallback']>;
|
|
50
51
|
};
|
|
51
52
|
export default IntlConfig;
|
|
@@ -38,7 +38,7 @@ type NamespacedValue<TranslatorMessages extends IntlMessages, Namespace extends
|
|
|
38
38
|
* The namespace can also indicate nesting by using a dot
|
|
39
39
|
* (e.g. `namespace.Component`).
|
|
40
40
|
*/
|
|
41
|
-
export default function createTranslator<const TranslatorMessages extends IntlMessages, const Namespace extends NamespaceKeys<TranslatorMessages, NestedKeyOf<TranslatorMessages>> = never>({ _cache, _formatters, getMessageFallback, messages, namespace, onError, ...rest }: Omit<IntlConfig
|
|
41
|
+
export default function createTranslator<const TranslatorMessages extends IntlMessages, const Namespace extends NamespaceKeys<TranslatorMessages, NestedKeyOf<TranslatorMessages>> = never>({ _cache, _formatters, getMessageFallback, messages, namespace, onError, ...rest }: Omit<IntlConfig, 'messages'> & {
|
|
42
42
|
messages?: TranslatorMessages;
|
|
43
43
|
namespace?: Namespace;
|
|
44
44
|
/** @private */
|
|
@@ -3,7 +3,7 @@ import type IntlConfig from './IntlConfig.js';
|
|
|
3
3
|
* Enhances the incoming props with defaults.
|
|
4
4
|
*/
|
|
5
5
|
export default function initializeConfig<Props extends IntlConfig>({ getMessageFallback, messages, onError, ...rest }: Props): Omit<Props, "onError" | "getMessageFallback" | "messages"> & {
|
|
6
|
-
messages: import("./
|
|
6
|
+
messages: import("./types.js").DeepPartial<Record<string, any>> | undefined;
|
|
7
7
|
onError: (error: import("./IntlError.js").default) => void;
|
|
8
8
|
getMessageFallback: (info: {
|
|
9
9
|
error: import("./IntlError.js").default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-intl",
|
|
3
|
-
"version": "4.0.0-beta-
|
|
3
|
+
"version": "4.0.0-beta-67507cc",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"description": "Internationalization (i18n) for React",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 || ^19.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "9220b68c2e83f70b1d45ecad3f672ecf2cde0d57"
|
|
68
68
|
}
|