You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/use-intl/src/core/IntlConfig.tsx
+41-39
Original file line number
Diff line number
Diff line change
@@ -8,49 +8,51 @@ import type TimeZone from './TimeZone.tsx';
8
8
* Should be used for entry points that configure the library.
9
9
*/
10
10
11
-
typeIntlConfig<Messages=AbstractIntlMessages>={
12
-
/** A valid Unicode locale tag (e.g. "en" or "en-GB"). */
13
-
locale: Locale;
14
-
/** Global formats can be provided to achieve consistent
15
-
* formatting across components. */
16
-
formats?: Formats;
17
-
/** A time zone as defined in [the tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) which will be applied when formatting dates and times. If this is absent, the user time zone will be used. You can override this by supplying an explicit time zone to `formatDateTime`. */
18
-
timeZone?: TimeZone;
19
-
/** This callback will be invoked when an error is encountered during
20
-
* resolving a message or formatting it. This defaults to `console.error` to
21
-
* keep your app running. You can customize the handling by taking
22
-
* `error.code` into account. */
23
-
onError?(error: IntlError): void;
24
-
/** Will be called when a message couldn't be resolved or formatting it led to
25
-
* an error. This defaults to `${namespace}.${key}` You can use this to
26
-
* customize what will be rendered in this case. */
27
-
getMessageFallback?(info: {
28
-
error: IntlError;
29
-
key: string;
30
-
namespace?: string;
31
-
}): string;
32
-
/**
33
-
* Providing this value will have two effects:
34
-
* 1. It will be used as the default for the `now` argument of
35
-
* `useFormatter().formatRelativeTime` if no explicit value is provided.
36
-
* 2. It will be returned as a static value from the `useNow` hook. Note
37
-
* however that when `updateInterval` is configured on the `useNow` hook,
38
-
* the global `now` value will only be used for the initial render, but
39
-
* afterwards the current date will be returned continuously.
/** A valid Unicode locale tag (e.g. "en" or "en-GB"). */
14
+
locale: Locale;
15
+
/** Global formats can be provided to achieve consistent
16
+
* formatting across components. */
17
+
formats?: Formats;
18
+
/** A time zone as defined in [the tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) which will be applied when formatting dates and times. If this is absent, the user time zone will be used. You can override this by supplying an explicit time zone to `formatDateTime`. */
19
+
timeZone?: TimeZone;
20
+
/** This callback will be invoked when an error is encountered during
21
+
* resolving a message or formatting it. This defaults to `console.error` to
22
+
* keep your app running. You can customize the handling by taking
23
+
* `error.code` into account. */
24
+
onError?(error: IntlError): void;
25
+
/** Will be called when a message couldn't be resolved or formatting it led to
26
+
* an error. This defaults to `${namespace}.${key}` You can use this to
27
+
* customize what will be rendered in this case. */
28
+
getMessageFallback?(info: {
29
+
error: IntlError;
30
+
key: string;
31
+
namespace?: string;
32
+
}): string;
33
+
/**
34
+
* Providing this value will have two effects:
35
+
* 1. It will be used as the default for the `now` argument of
36
+
* `useFormatter().formatRelativeTime` if no explicit value is provided.
37
+
* 2. It will be returned as a static value from the `useNow` hook. Note
38
+
* however that when `updateInterval` is configured on the `useNow` hook,
39
+
* the global `now` value will only be used for the initial render, but
40
+
* afterwards the current date will be returned continuously.
41
+
*/
42
+
now?: Date;
43
+
/** All messages that will be available. */
44
+
messages?: Messages;
45
+
};
45
46
46
47
/**
47
48
* A stricter set of the configuration that should be used internally
48
49
* once defaults are assigned to `IntlConfiguration`.
0 commit comments