use-intl 3.0.0-beta.2 → 3.0.0-rc.5

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.
Files changed (204) hide show
  1. package/_IntlProvider.d.ts +1 -0
  2. package/_useLocale.d.ts +1 -0
  3. package/core.d.ts +1 -1
  4. package/dist/_IntlProvider.js +7 -0
  5. package/dist/_useLocale.js +7 -0
  6. package/dist/core.js +3 -4
  7. package/dist/development/IntlContext-b5cc6be8.js +8 -0
  8. package/dist/development/_IntlProvider.js +27 -0
  9. package/dist/development/_useLocale-321e619f.js +19 -0
  10. package/dist/development/_useLocale.js +11 -0
  11. package/dist/development/core.js +91 -0
  12. package/dist/development/createFormatter-bcc5a49f.js +430 -0
  13. package/dist/development/index.js +29 -0
  14. package/dist/development/initializeConfig-0a0b87a7.js +120 -0
  15. package/dist/development/react.js +145 -0
  16. package/dist/esm/IntlContext-381f3ce4.js +1 -0
  17. package/dist/esm/_IntlProvider.js +1 -0
  18. package/dist/esm/_useLocale-89b32eb9.js +1 -0
  19. package/dist/esm/_useLocale.js +1 -0
  20. package/dist/esm/core.js +1 -0
  21. package/dist/esm/createFormatter-cccbd794.js +1 -0
  22. package/dist/esm/index.js +1 -0
  23. package/dist/esm/initializeConfig-29e7ba4c.js +1 -0
  24. package/dist/esm/react.js +1 -0
  25. package/dist/index.js +3 -4
  26. package/dist/production/IntlContext-381f3ce4.js +1 -0
  27. package/dist/production/_IntlProvider.js +1 -0
  28. package/dist/production/_useLocale-8e23751a.js +1 -0
  29. package/dist/production/_useLocale.js +1 -0
  30. package/dist/production/core.js +1 -0
  31. package/dist/production/createFormatter-8c0b8eb2.js +1 -0
  32. package/dist/production/index.js +1 -0
  33. package/dist/production/initializeConfig-984a566d.js +1 -0
  34. package/dist/production/react.js +1 -0
  35. package/dist/react.js +3 -4
  36. package/dist/types/src/_IntlProvider.d.ts +1 -0
  37. package/dist/types/src/_useLocale.d.ts +1 -0
  38. package/dist/{core → types/src/core}/AbstractIntlMessages.d.ts +9 -9
  39. package/dist/{core → types/src/core}/DateTimeFormatOptions.d.ts +73 -73
  40. package/dist/{core → types/src/core}/Formats.d.ts +8 -8
  41. package/dist/{core → types/src/core}/IntlConfig.d.ts +54 -54
  42. package/dist/{core → types/src/core}/IntlError.d.ts +14 -13
  43. package/dist/{core → types/src/core}/MessageFormatCache.d.ts +5 -5
  44. package/dist/{core → types/src/core}/NumberFormatOptions.d.ts +2 -2
  45. package/dist/types/src/core/RelativeTimeFormatOptions.d.ts +5 -0
  46. package/dist/{core → types/src/core}/TimeZone.d.ts +2 -2
  47. package/dist/{core → types/src/core}/TranslationValues.d.ts +6 -6
  48. package/dist/{core → types/src/core}/convertFormatsToIntlMessageFormat.d.ts +11 -11
  49. package/dist/{core → types/src/core}/createBaseTranslator.d.ts +21 -21
  50. package/dist/{core → types/src/core}/createFormatter.d.ts +20 -19
  51. package/dist/{core → types/src/core}/createTranslator.d.ts +47 -47
  52. package/dist/{core → types/src/core}/createTranslatorImpl.d.ts +13 -13
  53. package/dist/{core → types/src/core}/defaults.d.ts +11 -11
  54. package/dist/{core → types/src/core}/index.d.ts +15 -16
  55. package/dist/{core → types/src/core}/initializeConfig.d.ts +14 -13
  56. package/dist/{core → types/src/core}/resolveNamespace.d.ts +5 -5
  57. package/dist/{core → types/src/core}/utils/MessageKeys.d.ts +5 -5
  58. package/dist/{core → types/src/core}/utils/NamespaceKeys.d.ts +5 -5
  59. package/dist/{core → types/src/core}/utils/NestedKeyOf.d.ts +4 -4
  60. package/dist/{core → types/src/core}/utils/NestedValueOf.d.ts +2 -2
  61. package/dist/{core → types/src/core}/validateMessages.d.ts +3 -3
  62. package/dist/{core.d.ts → types/src/core.d.ts} +1 -1
  63. package/dist/{index.d.ts → types/src/index.d.ts} +2 -2
  64. package/dist/{react → types/src/react}/IntlContext.d.ts +13 -13
  65. package/dist/{react → types/src/react}/IntlProvider.d.ts +7 -7
  66. package/dist/{react → types/src/react}/index.d.ts +7 -8
  67. package/dist/{react → types/src/react}/useFormatter.d.ts +6 -6
  68. package/dist/{react → types/src/react}/useIntlContext.d.ts +10 -10
  69. package/dist/{react → types/src/react}/useLocale.d.ts +1 -1
  70. package/dist/types/src/react/useMessages.d.ts +2 -0
  71. package/dist/{react → types/src/react}/useNow.d.ts +23 -23
  72. package/dist/{react → types/src/react}/useTimeZone.d.ts +1 -1
  73. package/dist/{react → types/src/react}/useTranslations.d.ts +44 -44
  74. package/dist/{react → types/src/react}/useTranslationsImpl.d.ts +8 -8
  75. package/dist/{react.d.ts → types/src/react.d.ts} +1 -1
  76. package/dist/types/test/core/createFormatter.test.d.ts +1 -0
  77. package/dist/types/test/core/createTranslator.test.d.ts +1 -0
  78. package/dist/types/test/react/useFormatter.test.d.ts +1 -0
  79. package/dist/types/test/react/useLocale.test.d.ts +1 -0
  80. package/dist/types/test/react/useMessages.test.d.ts +1 -0
  81. package/dist/types/test/react/useNow.test.d.ts +1 -0
  82. package/dist/types/test/react/useTimeZone.test.d.ts +1 -0
  83. package/dist/types/test/react/useTranslations.test.d.ts +1 -0
  84. package/dist/{test → types/test}/setup.d.ts +1 -1
  85. package/package.json +33 -21
  86. package/react.d.ts +1 -1
  87. package/dist/_virtual/_rollupPluginBabelHelpers.esm.js +0 -102
  88. package/dist/_virtual/_rollupPluginBabelHelpers.esm.js.map +0 -1
  89. package/dist/_virtual/use-intl.esm.js +0 -102
  90. package/dist/_virtual/use-intl.esm.js.map +0 -1
  91. package/dist/core/IntlError.esm.js +0 -33
  92. package/dist/core/IntlError.esm.js.map +0 -1
  93. package/dist/core/convertFormatsToIntlMessageFormat.esm.js +0 -37
  94. package/dist/core/convertFormatsToIntlMessageFormat.esm.js.map +0 -1
  95. package/dist/core/createBaseTranslator.esm.js +0 -210
  96. package/dist/core/createBaseTranslator.esm.js.map +0 -1
  97. package/dist/core/createFormatter.esm.js +0 -138
  98. package/dist/core/createFormatter.esm.js.map +0 -1
  99. package/dist/core/createIntl.d.ts +0 -7
  100. package/dist/core/createIntl.esm.js +0 -14
  101. package/dist/core/createIntl.esm.js.map +0 -1
  102. package/dist/core/createTranslator.esm.js +0 -37
  103. package/dist/core/createTranslator.esm.js.map +0 -1
  104. package/dist/core/createTranslatorImpl.esm.js +0 -50
  105. package/dist/core/createTranslatorImpl.esm.js.map +0 -1
  106. package/dist/core/defaults.esm.js +0 -15
  107. package/dist/core/defaults.esm.js.map +0 -1
  108. package/dist/core/initializeConfig.esm.js +0 -29
  109. package/dist/core/initializeConfig.esm.js.map +0 -1
  110. package/dist/core/resolveNamespace.esm.js +0 -10
  111. package/dist/core/resolveNamespace.esm.js.map +0 -1
  112. package/dist/core/use-intl.esm.js +0 -33
  113. package/dist/core/use-intl.esm.js.map +0 -1
  114. package/dist/core/use-intl.esm10.js +0 -28
  115. package/dist/core/use-intl.esm10.js.map +0 -1
  116. package/dist/core/use-intl.esm11.js +0 -10
  117. package/dist/core/use-intl.esm11.js.map +0 -1
  118. package/dist/core/use-intl.esm2.js +0 -210
  119. package/dist/core/use-intl.esm2.js.map +0 -1
  120. package/dist/core/use-intl.esm3.js +0 -37
  121. package/dist/core/use-intl.esm3.js.map +0 -1
  122. package/dist/core/use-intl.esm4.js +0 -14
  123. package/dist/core/use-intl.esm4.js.map +0 -1
  124. package/dist/core/use-intl.esm5.js +0 -29
  125. package/dist/core/use-intl.esm5.js.map +0 -1
  126. package/dist/core/use-intl.esm6.js +0 -138
  127. package/dist/core/use-intl.esm6.js.map +0 -1
  128. package/dist/core/use-intl.esm7.js +0 -37
  129. package/dist/core/use-intl.esm7.js.map +0 -1
  130. package/dist/core/use-intl.esm8.js +0 -15
  131. package/dist/core/use-intl.esm8.js.map +0 -1
  132. package/dist/core/use-intl.esm9.js +0 -50
  133. package/dist/core/use-intl.esm9.js.map +0 -1
  134. package/dist/core/validateMessages.esm.js +0 -28
  135. package/dist/core/validateMessages.esm.js.map +0 -1
  136. package/dist/core.cjs.development.js +0 -93
  137. package/dist/core.cjs.development.js.map +0 -1
  138. package/dist/core.cjs.production.min.js +0 -2
  139. package/dist/core.cjs.production.min.js.map +0 -1
  140. package/dist/core.esm.js +0 -7
  141. package/dist/core.esm.js.map +0 -1
  142. package/dist/createIntl-34d4281e.js +0 -592
  143. package/dist/createIntl-34d4281e.js.map +0 -1
  144. package/dist/createIntl-bc325740.js +0 -2
  145. package/dist/createIntl-bc325740.js.map +0 -1
  146. package/dist/react/IntlContext.esm.js +0 -6
  147. package/dist/react/IntlContext.esm.js.map +0 -1
  148. package/dist/react/IntlProvider.esm.js +0 -22
  149. package/dist/react/IntlProvider.esm.js.map +0 -1
  150. package/dist/react/getInitializedConfig.d.ts +0 -1
  151. package/dist/react/use-intl.esm.js +0 -26
  152. package/dist/react/use-intl.esm.js.map +0 -1
  153. package/dist/react/use-intl.esm10.js +0 -13
  154. package/dist/react/use-intl.esm10.js.map +0 -1
  155. package/dist/react/use-intl.esm11.js +0 -6
  156. package/dist/react/use-intl.esm11.js.map +0 -1
  157. package/dist/react/use-intl.esm2.js +0 -8
  158. package/dist/react/use-intl.esm2.js.map +0 -1
  159. package/dist/react/use-intl.esm3.js +0 -30
  160. package/dist/react/use-intl.esm3.js.map +0 -1
  161. package/dist/react/use-intl.esm4.js +0 -22
  162. package/dist/react/use-intl.esm4.js.map +0 -1
  163. package/dist/react/use-intl.esm5.js +0 -24
  164. package/dist/react/use-intl.esm5.js.map +0 -1
  165. package/dist/react/use-intl.esm6.js +0 -45
  166. package/dist/react/use-intl.esm6.js.map +0 -1
  167. package/dist/react/use-intl.esm7.js +0 -8
  168. package/dist/react/use-intl.esm7.js.map +0 -1
  169. package/dist/react/use-intl.esm8.js +0 -8
  170. package/dist/react/use-intl.esm8.js.map +0 -1
  171. package/dist/react/use-intl.esm9.js +0 -36
  172. package/dist/react/use-intl.esm9.js.map +0 -1
  173. package/dist/react/useFormatter.esm.js +0 -24
  174. package/dist/react/useFormatter.esm.js.map +0 -1
  175. package/dist/react/useIntl.d.ts +0 -6
  176. package/dist/react/useIntl.esm.js +0 -30
  177. package/dist/react/useIntl.esm.js.map +0 -1
  178. package/dist/react/useIntlContext.esm.js +0 -13
  179. package/dist/react/useIntlContext.esm.js.map +0 -1
  180. package/dist/react/useLocale.esm.js +0 -8
  181. package/dist/react/useLocale.esm.js.map +0 -1
  182. package/dist/react/useMessages.d.ts +0 -1
  183. package/dist/react/useMessages.esm.js +0 -8
  184. package/dist/react/useMessages.esm.js.map +0 -1
  185. package/dist/react/useNow.esm.js +0 -45
  186. package/dist/react/useNow.esm.js.map +0 -1
  187. package/dist/react/useTimeZone.esm.js +0 -8
  188. package/dist/react/useTimeZone.esm.js.map +0 -1
  189. package/dist/react/useTranslations.esm.js +0 -26
  190. package/dist/react/useTranslations.esm.js.map +0 -1
  191. package/dist/react/useTranslationsImpl.esm.js +0 -36
  192. package/dist/react/useTranslationsImpl.esm.js.map +0 -1
  193. package/dist/react.cjs.development.js +0 -190
  194. package/dist/react.cjs.development.js.map +0 -1
  195. package/dist/react.cjs.production.min.js +0 -2
  196. package/dist/react.cjs.production.min.js.map +0 -1
  197. package/dist/react.esm.js +0 -9
  198. package/dist/react.esm.js.map +0 -1
  199. package/dist/use-intl.cjs.development.js +0 -842
  200. package/dist/use-intl.cjs.development.js.map +0 -1
  201. package/dist/use-intl.cjs.production.min.js +0 -2
  202. package/dist/use-intl.cjs.production.min.js.map +0 -1
  203. package/dist/use-intl.esm.js +0 -15
  204. package/dist/use-intl.esm.js.map +0 -1
@@ -1,54 +1,54 @@
1
- import Formats from './Formats';
2
- import IntlError from './IntlError';
3
- import TimeZone from './TimeZone';
4
- import { AbstractIntlMessages, RichTranslationValues } from '.';
5
- /**
6
- * Should be used for entry points that configure the library.
7
- */
8
- type IntlConfig<Messages = AbstractIntlMessages> = {
9
- /** A valid Unicode locale tag (e.g. "en" or "en-GB"). */
10
- locale: string;
11
- /** Global formats can be provided to achieve consistent
12
- * formatting across components. */
13
- formats?: Partial<Formats>;
14
- /** 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`. */
15
- timeZone?: TimeZone;
16
- /** This callback will be invoked when an error is encountered during
17
- * resolving a message or formatting it. This defaults to `console.error` to
18
- * keep your app running. You can customize the handling by taking
19
- * `error.code` into account. */
20
- onError?(error: IntlError): void;
21
- /** Will be called when a message couldn't be resolved or formatting it led to
22
- * an error. This defaults to `${namespace}.${key}` You can use this to
23
- * customize what will be rendered in this case. */
24
- getMessageFallback?(info: {
25
- error: IntlError;
26
- key: string;
27
- namespace?: string;
28
- }): string;
29
- /**
30
- * Providing this value will have two effects:
31
- * 1. It will be used as the default for the `now` argument of
32
- * `useIntl().formatRelativeTime` if no explicit value is provided.
33
- * 2. It will be returned as a static value from the `useNow` hook. Note
34
- * however that when `updateInterval` is configured on the `useNow` hook,
35
- * the global `now` value will only be used for the initial render, but
36
- * afterwards the current date will be returned continuously.
37
- */
38
- now?: Date;
39
- /** All messages that will be available. */
40
- messages?: Messages;
41
- /** Global default values for translation values and rich text elements.
42
- * Can be used for consistent usage or styling of rich text elements.
43
- * Defaults will be overidden by locally provided values. */
44
- defaultTranslationValues?: RichTranslationValues;
45
- };
46
- /**
47
- * A stricter set of the configuration that should be used internally
48
- * once defaults are assigned to `IntlConfiguration`.
49
- */
50
- export type InitializedIntlConfig<Messages = AbstractIntlMessages> = IntlConfig<Messages> & {
51
- onError: NonNullable<IntlConfig<Messages>['onError']>;
52
- getMessageFallback: NonNullable<IntlConfig<Messages>['getMessageFallback']>;
53
- };
54
- export default IntlConfig;
1
+ import Formats from './Formats';
2
+ import IntlError from './IntlError';
3
+ import TimeZone from './TimeZone';
4
+ import { AbstractIntlMessages, RichTranslationValues } from '.';
5
+ /**
6
+ * Should be used for entry points that configure the library.
7
+ */
8
+ type IntlConfig<Messages = AbstractIntlMessages> = {
9
+ /** A valid Unicode locale tag (e.g. "en" or "en-GB"). */
10
+ locale: string;
11
+ /** Global formats can be provided to achieve consistent
12
+ * formatting across components. */
13
+ formats?: Partial<Formats>;
14
+ /** 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`. */
15
+ timeZone?: TimeZone;
16
+ /** This callback will be invoked when an error is encountered during
17
+ * resolving a message or formatting it. This defaults to `console.error` to
18
+ * keep your app running. You can customize the handling by taking
19
+ * `error.code` into account. */
20
+ onError?(error: IntlError): void;
21
+ /** Will be called when a message couldn't be resolved or formatting it led to
22
+ * an error. This defaults to `${namespace}.${key}` You can use this to
23
+ * customize what will be rendered in this case. */
24
+ getMessageFallback?(info: {
25
+ error: IntlError;
26
+ key: string;
27
+ namespace?: string;
28
+ }): string;
29
+ /**
30
+ * Providing this value will have two effects:
31
+ * 1. It will be used as the default for the `now` argument of
32
+ * `useFormatter().formatRelativeTime` if no explicit value is provided.
33
+ * 2. It will be returned as a static value from the `useNow` hook. Note
34
+ * however that when `updateInterval` is configured on the `useNow` hook,
35
+ * the global `now` value will only be used for the initial render, but
36
+ * afterwards the current date will be returned continuously.
37
+ */
38
+ now?: Date;
39
+ /** All messages that will be available. */
40
+ messages?: Messages;
41
+ /** Global default values for translation values and rich text elements.
42
+ * Can be used for consistent usage or styling of rich text elements.
43
+ * Defaults will be overidden by locally provided values. */
44
+ defaultTranslationValues?: RichTranslationValues;
45
+ };
46
+ /**
47
+ * A stricter set of the configuration that should be used internally
48
+ * once defaults are assigned to `IntlConfiguration`.
49
+ */
50
+ export type InitializedIntlConfig<Messages = AbstractIntlMessages> = IntlConfig<Messages> & {
51
+ onError: NonNullable<IntlConfig<Messages>['onError']>;
52
+ getMessageFallback: NonNullable<IntlConfig<Messages>['getMessageFallback']>;
53
+ };
54
+ export default IntlConfig;
@@ -1,13 +1,14 @@
1
- export declare enum IntlErrorCode {
2
- MISSING_MESSAGE = "MISSING_MESSAGE",
3
- MISSING_FORMAT = "MISSING_FORMAT",
4
- INSUFFICIENT_PATH = "INSUFFICIENT_PATH",
5
- INVALID_MESSAGE = "INVALID_MESSAGE",
6
- INVALID_KEY = "INVALID_KEY",
7
- FORMATTING_ERROR = "FORMATTING_ERROR"
8
- }
9
- export default class IntlError extends Error {
10
- readonly code: IntlErrorCode;
11
- readonly originalMessage: string | undefined;
12
- constructor(code: IntlErrorCode, originalMessage?: string);
13
- }
1
+ export declare enum IntlErrorCode {
2
+ MISSING_MESSAGE = "MISSING_MESSAGE",
3
+ MISSING_FORMAT = "MISSING_FORMAT",
4
+ ENVIRONMENT_FALLBACK = "ENVIRONMENT_FALLBACK",
5
+ INSUFFICIENT_PATH = "INSUFFICIENT_PATH",
6
+ INVALID_MESSAGE = "INVALID_MESSAGE",
7
+ INVALID_KEY = "INVALID_KEY",
8
+ FORMATTING_ERROR = "FORMATTING_ERROR"
9
+ }
10
+ export default class IntlError extends Error {
11
+ readonly code: IntlErrorCode;
12
+ readonly originalMessage: string | undefined;
13
+ constructor(code: IntlErrorCode, originalMessage?: string);
14
+ }
@@ -1,5 +1,5 @@
1
- import type IntlMessageFormat from 'intl-messageformat';
2
- type MessageFormatCache = Map<
3
- /** Format: `${locale}.${namespace}.${key}.${message}` */
4
- string, IntlMessageFormat>;
5
- export default MessageFormatCache;
1
+ import type IntlMessageFormat from 'intl-messageformat';
2
+ type MessageFormatCache = Map<
3
+ /** Format: `${locale}.${namespace}.${key}.${message}` */
4
+ string, IntlMessageFormat>;
5
+ export default MessageFormatCache;
@@ -1,2 +1,2 @@
1
- import type { NumberFormatOptions } from '@formatjs/ecma402-abstract/types/number';
2
- export default NumberFormatOptions;
1
+ import type { NumberFormatOptions } from '@formatjs/ecma402-abstract/types/number';
2
+ export default NumberFormatOptions;
@@ -0,0 +1,5 @@
1
+ type RelativeTimeFormatOptions = {
2
+ now?: number | Date;
3
+ unit?: Intl.RelativeTimeFormatUnit;
4
+ };
5
+ export default RelativeTimeFormatOptions;
@@ -1,2 +1,2 @@
1
- type TimeZone = 'Africa/Abidjan' | 'Africa/Accra' | 'Africa/Addis_Ababa' | 'Africa/Algiers' | 'Africa/Asmara' | 'Africa/Bamako' | 'Africa/Bangui' | 'Africa/Banjul' | 'Africa/Bissau' | 'Africa/Blantyre' | 'Africa/Brazzaville' | 'Africa/Bujumbura' | 'Africa/Cairo' | 'Africa/Casablanca' | 'Africa/Ceuta' | 'Africa/Conakry' | 'Africa/Dakar' | 'Africa/Dar_es_Salaam' | 'Africa/Djibouti' | 'Africa/Douala' | 'Africa/El_Aaiun' | 'Africa/Freetown' | 'Africa/Gaborone' | 'Africa/Harare' | 'Africa/Johannesburg' | 'Africa/Juba' | 'Africa/Kampala' | 'Africa/Khartoum' | 'Africa/Kigali' | 'Africa/Kinshasa' | 'Africa/Lagos' | 'Africa/Libreville' | 'Africa/Lome' | 'Africa/Luanda' | 'Africa/Lubumbashi' | 'Africa/Lusaka' | 'Africa/Malabo' | 'Africa/Maputo' | 'Africa/Maseru' | 'Africa/Mbabane' | 'Africa/Mogadishu' | 'Africa/Monrovia' | 'Africa/Nairobi' | 'Africa/Ndjamena' | 'Africa/Niamey' | 'Africa/Nouakchott' | 'Africa/Ouagadougou' | 'Africa/Porto-Novo' | 'Africa/Sao_Tome' | 'Africa/Tripoli' | 'Africa/Tunis' | 'Africa/Windhoek' | 'America/Adak' | 'America/Anchorage' | 'America/Anguilla' | 'America/Antigua' | 'America/Araguaina' | 'America/Argentina/Buenos_Aires' | 'America/Argentina/Catamarca' | 'America/Argentina/Cordoba' | 'America/Argentina/Jujuy' | 'America/Argentina/La_Rioja' | 'America/Argentina/Mendoza' | 'America/Argentina/Rio_Gallegos' | 'America/Argentina/Salta' | 'America/Argentina/San_Juan' | 'America/Argentina/San_Luis' | 'America/Argentina/Tucuman' | 'America/Argentina/Ushuaia' | 'America/Aruba' | 'America/Asuncion' | 'America/Atikokan' | 'America/Bahia' | 'America/Bahia_Banderas' | 'America/Barbados' | 'America/Belem' | 'America/Belize' | 'America/Blanc-Sablon' | 'America/Boa_Vista' | 'America/Bogota' | 'America/Boise' | 'America/Cambridge_Bay' | 'America/Campo_Grande' | 'America/Cancun' | 'America/Caracas' | 'America/Cayenne' | 'America/Cayman' | 'America/Chicago' | 'America/Chihuahua' | 'America/Costa_Rica' | 'America/Creston' | 'America/Cuiaba' | 'America/Curacao' | 'America/Danmarkshavn' | 'America/Dawson' | 'America/Dawson_Creek' | 'America/Denver' | 'America/Detroit' | 'America/Dominica' | 'America/Edmonton' | 'America/Eirunepe' | 'America/El_Salvador' | 'America/Fort_Nelson' | 'America/Fortaleza' | 'America/Glace_Bay' | 'America/Godthab' | 'America/Goose_Bay' | 'America/Grand_Turk' | 'America/Grenada' | 'America/Guadeloupe' | 'America/Guatemala' | 'America/Guayaquil' | 'America/Guyana' | 'America/Halifax' | 'America/Havana' | 'America/Hermosillo' | 'America/Indiana/Indianapolis' | 'America/Indiana/Knox' | 'America/Indiana/Marengo' | 'America/Indiana/Petersburg' | 'America/Indiana/Tell_City' | 'America/Indiana/Vevay' | 'America/Indiana/Vincennes' | 'America/Indiana/Winamac' | 'America/Inuvik' | 'America/Iqaluit' | 'America/Jamaica' | 'America/Juneau' | 'America/Kentucky/Louisville' | 'America/Kentucky/Monticello' | 'America/Kralendijk' | 'America/La_Paz' | 'America/Lima' | 'America/Los_Angeles' | 'America/Lower_Princes' | 'America/Maceio' | 'America/Managua' | 'America/Manaus' | 'America/Marigot' | 'America/Martinique' | 'America/Matamoros' | 'America/Mazatlan' | 'America/Menominee' | 'America/Merida' | 'America/Metlakatla' | 'America/Mexico_City' | 'America/Miquelon' | 'America/Moncton' | 'America/Monterrey' | 'America/Montevideo' | 'America/Montserrat' | 'America/Nassau' | 'America/New_York' | 'America/Nipigon' | 'America/Nome' | 'America/Noronha' | 'America/North_Dakota/Beulah' | 'America/North_Dakota/Center' | 'America/North_Dakota/New_Salem' | 'America/Ojinaga' | 'America/Panama' | 'America/Pangnirtung' | 'America/Paramaribo' | 'America/Phoenix' | 'America/Port-au-Prince' | 'America/Port_of_Spain' | 'America/Porto_Velho' | 'America/Puerto_Rico' | 'America/Punta_Arenas' | 'America/Rainy_River' | 'America/Rankin_Inlet' | 'America/Recife' | 'America/Regina' | 'America/Resolute' | 'America/Rio_Branco' | 'America/Santarem' | 'America/Santiago' | 'America/Santo_Domingo' | 'America/Sao_Paulo' | 'America/Scoresbysund' | 'America/Sitka' | 'America/St_Barthelemy' | 'America/St_Johns' | 'America/St_Kitts' | 'America/St_Lucia' | 'America/St_Thomas' | 'America/St_Vincent' | 'America/Swift_Current' | 'America/Tegucigalpa' | 'America/Thule' | 'America/Thunder_Bay' | 'America/Tijuana' | 'America/Toronto' | 'America/Tortola' | 'America/Vancouver' | 'America/Whitehorse' | 'America/Winnipeg' | 'America/Yakutat' | 'America/Yellowknife' | 'Antarctica/Casey' | 'Antarctica/Davis' | 'Antarctica/DumontDUrville' | 'Antarctica/Macquarie' | 'Antarctica/Mawson' | 'Antarctica/Palmer' | 'Antarctica/Rothera' | 'Antarctica/Syowa' | 'Antarctica/Troll' | 'Antarctica/Vostok' | 'Arctic/Longyearbyen' | 'Asia/Almaty' | 'Asia/Amman' | 'Asia/Anadyr' | 'Asia/Aqtau' | 'Asia/Aqtobe' | 'Asia/Ashgabat' | 'Asia/Atyrau' | 'Asia/Baghdad' | 'Asia/Baku' | 'Asia/Bangkok' | 'Asia/Barnaul' | 'Asia/Beirut' | 'Asia/Bishkek' | 'Asia/Brunei' | 'Asia/Chita' | 'Asia/Choibalsan' | 'Asia/Colombo' | 'Asia/Damascus' | 'Asia/Dhaka' | 'Asia/Dili' | 'Asia/Dubai' | 'Asia/Dushanbe' | 'Asia/Famagusta' | 'Asia/Gaza' | 'Asia/Hebron' | 'Asia/Ho_Chi_Minh' | 'Asia/Hong_Kong' | 'Asia/Hovd' | 'Asia/Irkutsk' | 'Asia/Jakarta' | 'Asia/Jayapura' | 'Asia/Jerusalem' | 'Asia/Kabul' | 'Asia/Kamchatka' | 'Asia/Karachi' | 'Asia/Kathmandu' | 'Asia/Khandyga' | 'Asia/Kolkata' | 'Asia/Krasnoyarsk' | 'Asia/Kuala_Lumpur' | 'Asia/Kuching' | 'Asia/Macau' | 'Asia/Magadan' | 'Asia/Makassar' | 'Asia/Manila' | 'Asia/Nicosia' | 'Asia/Novokuznetsk' | 'Asia/Novosibirsk' | 'Asia/Omsk' | 'Asia/Oral' | 'Asia/Phnom_Penh' | 'Asia/Pontianak' | 'Asia/Pyongyang' | 'Asia/Qatar' | 'Asia/Qostanay' | 'Asia/Qyzylorda' | 'Asia/Riyadh' | 'Asia/Sakhalin' | 'Asia/Samarkand' | 'Asia/Seoul' | 'Asia/Shanghai' | 'Asia/Singapore' | 'Asia/Srednekolymsk' | 'Asia/Taipei' | 'Asia/Tashkent' | 'Asia/Tbilisi' | 'Asia/Tehran' | 'Asia/Thimphu' | 'Asia/Tokyo' | 'Asia/Tomsk' | 'Asia/Ulaanbaatar' | 'Asia/Urumqi' | 'Asia/Ust-Nera' | 'Asia/Vladivostok' | 'Asia/Yakutsk' | 'Asia/Yangon' | 'Asia/Yekaterinburg' | 'Asia/Yerevan' | 'Atlantic/Azores' | 'Atlantic/Bermuda' | 'Atlantic/Canary' | 'Atlantic/Cape_Verde' | 'Atlantic/Faroe' | 'Atlantic/Madeira' | 'Atlantic/Reykjavik' | 'Atlantic/South_Georgia' | 'Atlantic/St_Helena' | 'Atlantic/Stanley' | 'Australia/Adelaide' | 'Australia/Brisbane' | 'Australia/Broken_Hill' | 'Australia/Currie' | 'Australia/Darwin' | 'Australia/Eucla' | 'Australia/Hobart' | 'Australia/Lindeman' | 'Australia/Lord_Howe' | 'Australia/Melbourne' | 'Australia/Perth' | 'Australia/Sydney' | 'Europe/Amsterdam' | 'Europe/Andorra' | 'Europe/Astrakhan' | 'Europe/Athens' | 'Europe/Belgrade' | 'Europe/Berlin' | 'Europe/Bratislava' | 'Europe/Brussels' | 'Europe/Bucharest' | 'Europe/Budapest' | 'Europe/Busingen' | 'Europe/Chisinau' | 'Europe/Copenhagen' | 'Europe/Dublin' | 'Europe/Gibraltar' | 'Europe/Guernsey' | 'Europe/Helsinki' | 'Europe/Isle_of_Man' | 'Europe/Istanbul' | 'Europe/Jersey' | 'Europe/Kaliningrad' | 'Europe/Kiev' | 'Europe/Kirov' | 'Europe/Lisbon' | 'Europe/Ljubljana' | 'Europe/London' | 'Europe/Luxembourg' | 'Europe/Madrid' | 'Europe/Malta' | 'Europe/Mariehamn' | 'Europe/Minsk' | 'Europe/Monaco' | 'Europe/Moscow' | 'Europe/Oslo' | 'Europe/Paris' | 'Europe/Podgorica' | 'Europe/Prague' | 'Europe/Riga' | 'Europe/Rome' | 'Europe/Samara' | 'Europe/San_Marino' | 'Europe/Sarajevo' | 'Europe/Saratov' | 'Europe/Simferopol' | 'Europe/Skopje' | 'Europe/Sofia' | 'Europe/Stockholm' | 'Europe/Tallinn' | 'Europe/Tirane' | 'Europe/Ulyanovsk' | 'Europe/Uzhgorod' | 'Europe/Vaduz' | 'Europe/Vatican' | 'Europe/Vienna' | 'Europe/Vilnius' | 'Europe/Volgograd' | 'Europe/Warsaw' | 'Europe/Zagreb' | 'Europe/Zaporozhye' | 'Europe/Zurich' | 'Indian/Antananarivo' | 'Indian/Chagos' | 'Indian/Christmas' | 'Indian/Cocos' | 'Indian/Comoro' | 'Indian/Kerguelen' | 'Indian/Mahe' | 'Indian/Maldives' | 'Indian/Mauritius' | 'Indian/Mayotte' | 'Indian/Reunion' | 'Pacific/Apia' | 'Pacific/Auckland' | 'Pacific/Bougainville' | 'Pacific/Chatham' | 'Pacific/Chuuk' | 'Pacific/Easter' | 'Pacific/Efate' | 'Pacific/Enderbury' | 'Pacific/Fakaofo' | 'Pacific/Fiji' | 'Pacific/Funafuti' | 'Pacific/Galapagos' | 'Pacific/Gambier' | 'Pacific/Guadalcanal' | 'Pacific/Guam' | 'Pacific/Honolulu' | 'Pacific/Kiritimati' | 'Pacific/Kosrae' | 'Pacific/Kwajalein' | 'Pacific/Majuro' | 'Pacific/Marquesas' | 'Pacific/Nauru' | 'Pacific/Niue' | 'Pacific/Norfolk' | 'Pacific/Noumea' | 'Pacific/Pago_Pago' | 'Pacific/Palau' | 'Pacific/Pitcairn' | 'Pacific/Pohnpei' | 'Pacific/Port_Moresby' | 'Pacific/Rarotonga' | 'Pacific/Tahiti' | 'Pacific/Tarawa' | 'Pacific/Tongatapu' | 'Pacific/Wake' | 'Pacific/Wallis' | 'UTC' | 'W-SU' | 'WET' | 'Zulu' | (string & {});
2
- export default TimeZone;
1
+ type TimeZone = 'Africa/Abidjan' | 'Africa/Accra' | 'Africa/Addis_Ababa' | 'Africa/Algiers' | 'Africa/Asmara' | 'Africa/Bamako' | 'Africa/Bangui' | 'Africa/Banjul' | 'Africa/Bissau' | 'Africa/Blantyre' | 'Africa/Brazzaville' | 'Africa/Bujumbura' | 'Africa/Cairo' | 'Africa/Casablanca' | 'Africa/Ceuta' | 'Africa/Conakry' | 'Africa/Dakar' | 'Africa/Dar_es_Salaam' | 'Africa/Djibouti' | 'Africa/Douala' | 'Africa/El_Aaiun' | 'Africa/Freetown' | 'Africa/Gaborone' | 'Africa/Harare' | 'Africa/Johannesburg' | 'Africa/Juba' | 'Africa/Kampala' | 'Africa/Khartoum' | 'Africa/Kigali' | 'Africa/Kinshasa' | 'Africa/Lagos' | 'Africa/Libreville' | 'Africa/Lome' | 'Africa/Luanda' | 'Africa/Lubumbashi' | 'Africa/Lusaka' | 'Africa/Malabo' | 'Africa/Maputo' | 'Africa/Maseru' | 'Africa/Mbabane' | 'Africa/Mogadishu' | 'Africa/Monrovia' | 'Africa/Nairobi' | 'Africa/Ndjamena' | 'Africa/Niamey' | 'Africa/Nouakchott' | 'Africa/Ouagadougou' | 'Africa/Porto-Novo' | 'Africa/Sao_Tome' | 'Africa/Tripoli' | 'Africa/Tunis' | 'Africa/Windhoek' | 'America/Adak' | 'America/Anchorage' | 'America/Anguilla' | 'America/Antigua' | 'America/Araguaina' | 'America/Argentina/Buenos_Aires' | 'America/Argentina/Catamarca' | 'America/Argentina/Cordoba' | 'America/Argentina/Jujuy' | 'America/Argentina/La_Rioja' | 'America/Argentina/Mendoza' | 'America/Argentina/Rio_Gallegos' | 'America/Argentina/Salta' | 'America/Argentina/San_Juan' | 'America/Argentina/San_Luis' | 'America/Argentina/Tucuman' | 'America/Argentina/Ushuaia' | 'America/Aruba' | 'America/Asuncion' | 'America/Atikokan' | 'America/Bahia' | 'America/Bahia_Banderas' | 'America/Barbados' | 'America/Belem' | 'America/Belize' | 'America/Blanc-Sablon' | 'America/Boa_Vista' | 'America/Bogota' | 'America/Boise' | 'America/Cambridge_Bay' | 'America/Campo_Grande' | 'America/Cancun' | 'America/Caracas' | 'America/Cayenne' | 'America/Cayman' | 'America/Chicago' | 'America/Chihuahua' | 'America/Costa_Rica' | 'America/Creston' | 'America/Cuiaba' | 'America/Curacao' | 'America/Danmarkshavn' | 'America/Dawson' | 'America/Dawson_Creek' | 'America/Denver' | 'America/Detroit' | 'America/Dominica' | 'America/Edmonton' | 'America/Eirunepe' | 'America/El_Salvador' | 'America/Fort_Nelson' | 'America/Fortaleza' | 'America/Glace_Bay' | 'America/Godthab' | 'America/Goose_Bay' | 'America/Grand_Turk' | 'America/Grenada' | 'America/Guadeloupe' | 'America/Guatemala' | 'America/Guayaquil' | 'America/Guyana' | 'America/Halifax' | 'America/Havana' | 'America/Hermosillo' | 'America/Indiana/Indianapolis' | 'America/Indiana/Knox' | 'America/Indiana/Marengo' | 'America/Indiana/Petersburg' | 'America/Indiana/Tell_City' | 'America/Indiana/Vevay' | 'America/Indiana/Vincennes' | 'America/Indiana/Winamac' | 'America/Inuvik' | 'America/Iqaluit' | 'America/Jamaica' | 'America/Juneau' | 'America/Kentucky/Louisville' | 'America/Kentucky/Monticello' | 'America/Kralendijk' | 'America/La_Paz' | 'America/Lima' | 'America/Los_Angeles' | 'America/Lower_Princes' | 'America/Maceio' | 'America/Managua' | 'America/Manaus' | 'America/Marigot' | 'America/Martinique' | 'America/Matamoros' | 'America/Mazatlan' | 'America/Menominee' | 'America/Merida' | 'America/Metlakatla' | 'America/Mexico_City' | 'America/Miquelon' | 'America/Moncton' | 'America/Monterrey' | 'America/Montevideo' | 'America/Montserrat' | 'America/Nassau' | 'America/New_York' | 'America/Nipigon' | 'America/Nome' | 'America/Noronha' | 'America/North_Dakota/Beulah' | 'America/North_Dakota/Center' | 'America/North_Dakota/New_Salem' | 'America/Ojinaga' | 'America/Panama' | 'America/Pangnirtung' | 'America/Paramaribo' | 'America/Phoenix' | 'America/Port-au-Prince' | 'America/Port_of_Spain' | 'America/Porto_Velho' | 'America/Puerto_Rico' | 'America/Punta_Arenas' | 'America/Rainy_River' | 'America/Rankin_Inlet' | 'America/Recife' | 'America/Regina' | 'America/Resolute' | 'America/Rio_Branco' | 'America/Santarem' | 'America/Santiago' | 'America/Santo_Domingo' | 'America/Sao_Paulo' | 'America/Scoresbysund' | 'America/Sitka' | 'America/St_Barthelemy' | 'America/St_Johns' | 'America/St_Kitts' | 'America/St_Lucia' | 'America/St_Thomas' | 'America/St_Vincent' | 'America/Swift_Current' | 'America/Tegucigalpa' | 'America/Thule' | 'America/Thunder_Bay' | 'America/Tijuana' | 'America/Toronto' | 'America/Tortola' | 'America/Vancouver' | 'America/Whitehorse' | 'America/Winnipeg' | 'America/Yakutat' | 'America/Yellowknife' | 'Antarctica/Casey' | 'Antarctica/Davis' | 'Antarctica/DumontDUrville' | 'Antarctica/Macquarie' | 'Antarctica/Mawson' | 'Antarctica/Palmer' | 'Antarctica/Rothera' | 'Antarctica/Syowa' | 'Antarctica/Troll' | 'Antarctica/Vostok' | 'Arctic/Longyearbyen' | 'Asia/Almaty' | 'Asia/Amman' | 'Asia/Anadyr' | 'Asia/Aqtau' | 'Asia/Aqtobe' | 'Asia/Ashgabat' | 'Asia/Atyrau' | 'Asia/Baghdad' | 'Asia/Baku' | 'Asia/Bangkok' | 'Asia/Barnaul' | 'Asia/Beirut' | 'Asia/Bishkek' | 'Asia/Brunei' | 'Asia/Chita' | 'Asia/Choibalsan' | 'Asia/Colombo' | 'Asia/Damascus' | 'Asia/Dhaka' | 'Asia/Dili' | 'Asia/Dubai' | 'Asia/Dushanbe' | 'Asia/Famagusta' | 'Asia/Gaza' | 'Asia/Hebron' | 'Asia/Ho_Chi_Minh' | 'Asia/Hong_Kong' | 'Asia/Hovd' | 'Asia/Irkutsk' | 'Asia/Jakarta' | 'Asia/Jayapura' | 'Asia/Jerusalem' | 'Asia/Kabul' | 'Asia/Kamchatka' | 'Asia/Karachi' | 'Asia/Kathmandu' | 'Asia/Khandyga' | 'Asia/Kolkata' | 'Asia/Krasnoyarsk' | 'Asia/Kuala_Lumpur' | 'Asia/Kuching' | 'Asia/Macau' | 'Asia/Magadan' | 'Asia/Makassar' | 'Asia/Manila' | 'Asia/Nicosia' | 'Asia/Novokuznetsk' | 'Asia/Novosibirsk' | 'Asia/Omsk' | 'Asia/Oral' | 'Asia/Phnom_Penh' | 'Asia/Pontianak' | 'Asia/Pyongyang' | 'Asia/Qatar' | 'Asia/Qostanay' | 'Asia/Qyzylorda' | 'Asia/Riyadh' | 'Asia/Sakhalin' | 'Asia/Samarkand' | 'Asia/Seoul' | 'Asia/Shanghai' | 'Asia/Singapore' | 'Asia/Srednekolymsk' | 'Asia/Taipei' | 'Asia/Tashkent' | 'Asia/Tbilisi' | 'Asia/Tehran' | 'Asia/Thimphu' | 'Asia/Tokyo' | 'Asia/Tomsk' | 'Asia/Ulaanbaatar' | 'Asia/Urumqi' | 'Asia/Ust-Nera' | 'Asia/Vladivostok' | 'Asia/Yakutsk' | 'Asia/Yangon' | 'Asia/Yekaterinburg' | 'Asia/Yerevan' | 'Atlantic/Azores' | 'Atlantic/Bermuda' | 'Atlantic/Canary' | 'Atlantic/Cape_Verde' | 'Atlantic/Faroe' | 'Atlantic/Madeira' | 'Atlantic/Reykjavik' | 'Atlantic/South_Georgia' | 'Atlantic/St_Helena' | 'Atlantic/Stanley' | 'Australia/Adelaide' | 'Australia/Brisbane' | 'Australia/Broken_Hill' | 'Australia/Currie' | 'Australia/Darwin' | 'Australia/Eucla' | 'Australia/Hobart' | 'Australia/Lindeman' | 'Australia/Lord_Howe' | 'Australia/Melbourne' | 'Australia/Perth' | 'Australia/Sydney' | 'Europe/Amsterdam' | 'Europe/Andorra' | 'Europe/Astrakhan' | 'Europe/Athens' | 'Europe/Belgrade' | 'Europe/Berlin' | 'Europe/Bratislava' | 'Europe/Brussels' | 'Europe/Bucharest' | 'Europe/Budapest' | 'Europe/Busingen' | 'Europe/Chisinau' | 'Europe/Copenhagen' | 'Europe/Dublin' | 'Europe/Gibraltar' | 'Europe/Guernsey' | 'Europe/Helsinki' | 'Europe/Isle_of_Man' | 'Europe/Istanbul' | 'Europe/Jersey' | 'Europe/Kaliningrad' | 'Europe/Kiev' | 'Europe/Kirov' | 'Europe/Lisbon' | 'Europe/Ljubljana' | 'Europe/London' | 'Europe/Luxembourg' | 'Europe/Madrid' | 'Europe/Malta' | 'Europe/Mariehamn' | 'Europe/Minsk' | 'Europe/Monaco' | 'Europe/Moscow' | 'Europe/Oslo' | 'Europe/Paris' | 'Europe/Podgorica' | 'Europe/Prague' | 'Europe/Riga' | 'Europe/Rome' | 'Europe/Samara' | 'Europe/San_Marino' | 'Europe/Sarajevo' | 'Europe/Saratov' | 'Europe/Simferopol' | 'Europe/Skopje' | 'Europe/Sofia' | 'Europe/Stockholm' | 'Europe/Tallinn' | 'Europe/Tirane' | 'Europe/Ulyanovsk' | 'Europe/Uzhgorod' | 'Europe/Vaduz' | 'Europe/Vatican' | 'Europe/Vienna' | 'Europe/Vilnius' | 'Europe/Volgograd' | 'Europe/Warsaw' | 'Europe/Zagreb' | 'Europe/Zaporozhye' | 'Europe/Zurich' | 'Indian/Antananarivo' | 'Indian/Chagos' | 'Indian/Christmas' | 'Indian/Cocos' | 'Indian/Comoro' | 'Indian/Kerguelen' | 'Indian/Mahe' | 'Indian/Maldives' | 'Indian/Mauritius' | 'Indian/Mayotte' | 'Indian/Reunion' | 'Pacific/Apia' | 'Pacific/Auckland' | 'Pacific/Bougainville' | 'Pacific/Chatham' | 'Pacific/Chuuk' | 'Pacific/Easter' | 'Pacific/Efate' | 'Pacific/Enderbury' | 'Pacific/Fakaofo' | 'Pacific/Fiji' | 'Pacific/Funafuti' | 'Pacific/Galapagos' | 'Pacific/Gambier' | 'Pacific/Guadalcanal' | 'Pacific/Guam' | 'Pacific/Honolulu' | 'Pacific/Kiritimati' | 'Pacific/Kosrae' | 'Pacific/Kwajalein' | 'Pacific/Majuro' | 'Pacific/Marquesas' | 'Pacific/Nauru' | 'Pacific/Niue' | 'Pacific/Norfolk' | 'Pacific/Noumea' | 'Pacific/Pago_Pago' | 'Pacific/Palau' | 'Pacific/Pitcairn' | 'Pacific/Pohnpei' | 'Pacific/Port_Moresby' | 'Pacific/Rarotonga' | 'Pacific/Tahiti' | 'Pacific/Tarawa' | 'Pacific/Tongatapu' | 'Pacific/Wake' | 'Pacific/Wallis' | 'UTC' | 'W-SU' | 'WET' | 'Zulu' | (string & {});
2
+ export default TimeZone;
@@ -1,6 +1,6 @@
1
- import { ReactNode } from 'react';
2
- export type TranslationValue = string | number | boolean | Date | null | undefined;
3
- type TranslationValues = Record<string, TranslationValue>;
4
- export type RichTranslationValues = Record<string, TranslationValue | ((chunks: ReactNode) => ReactNode)>;
5
- export type RichTranslationValuesPlain = Record<string, TranslationValue | ((chunks: string) => string)>;
6
- export default TranslationValues;
1
+ import { ReactNode } from 'react';
2
+ export type TranslationValue = string | number | boolean | Date | null | undefined;
3
+ type TranslationValues = Record<string, TranslationValue>;
4
+ export type RichTranslationValues = Record<string, TranslationValue | ((chunks: ReactNode) => ReactNode)>;
5
+ export type RichTranslationValuesPlain = Record<string, TranslationValue | ((chunks: string) => string)>;
6
+ export default TranslationValues;
@@ -1,11 +1,11 @@
1
- import { Formats as IntlFormats } from 'intl-messageformat';
2
- import Formats from './Formats';
3
- import TimeZone from './TimeZone';
4
- /**
5
- * `intl-messageformat` uses separate keys for `date` and `time`, but there's
6
- * only one native API: `Intl.DateTimeFormat`. Additionally you might want to
7
- * include both a time and a date in a value, therefore the separation doesn't
8
- * seem so useful. We offer a single `dateTime` namespace instead, but we have
9
- * to convert the format before `intl-messageformat` can be used.
10
- */
11
- export default function convertFormatsToIntlMessageFormat(formats: Partial<Formats>, timeZone?: TimeZone): Partial<IntlFormats>;
1
+ import { Formats as IntlFormats } from 'intl-messageformat';
2
+ import Formats from './Formats';
3
+ import TimeZone from './TimeZone';
4
+ /**
5
+ * `intl-messageformat` uses separate keys for `date` and `time`, but there's
6
+ * only one native API: `Intl.DateTimeFormat`. Additionally you might want to
7
+ * include both a time and a date in a value, therefore the separation doesn't
8
+ * seem so useful. We offer a single `dateTime` namespace instead, but we have
9
+ * to convert the format before `intl-messageformat` can be used.
10
+ */
11
+ export default function convertFormatsToIntlMessageFormat(formats: Partial<Formats>, timeZone?: TimeZone): Partial<IntlFormats>;
@@ -1,21 +1,21 @@
1
- import { ReactElement, ReactNodeArray } from 'react';
2
- import AbstractIntlMessages from './AbstractIntlMessages';
3
- import Formats from './Formats';
4
- import { InitializedIntlConfig } from './IntlConfig';
5
- import IntlError from './IntlError';
6
- import MessageFormatCache from './MessageFormatCache';
7
- import TranslationValues, { RichTranslationValues } from './TranslationValues';
8
- import MessageKeys from './utils/MessageKeys';
9
- import NestedKeyOf from './utils/NestedKeyOf';
10
- import NestedValueOf from './utils/NestedValueOf';
11
- export type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {
12
- messageFormatCache?: MessageFormatCache;
13
- defaultTranslationValues?: RichTranslationValues;
14
- namespace?: string;
15
- messagesOrError: Messages | IntlError;
16
- };
17
- export default function createBaseTranslator<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(config: Omit<CreateBaseTranslatorProps<Messages>, 'messagesOrError'>): {
18
- <TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues | undefined, formats?: Partial<Formats> | undefined): string;
19
- rich: (key: string, values?: RichTranslationValues | undefined, formats?: Partial<Formats> | undefined) => string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | ReactNodeArray;
20
- raw(key: string): any;
21
- };
1
+ import { ReactElement, ReactNodeArray } from 'react';
2
+ import AbstractIntlMessages from './AbstractIntlMessages';
3
+ import Formats from './Formats';
4
+ import { InitializedIntlConfig } from './IntlConfig';
5
+ import IntlError from './IntlError';
6
+ import MessageFormatCache from './MessageFormatCache';
7
+ import TranslationValues, { RichTranslationValues } from './TranslationValues';
8
+ import MessageKeys from './utils/MessageKeys';
9
+ import NestedKeyOf from './utils/NestedKeyOf';
10
+ import NestedValueOf from './utils/NestedValueOf';
11
+ export type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {
12
+ messageFormatCache?: MessageFormatCache;
13
+ defaultTranslationValues?: RichTranslationValues;
14
+ namespace?: string;
15
+ messagesOrError: Messages | IntlError;
16
+ };
17
+ export default function createBaseTranslator<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(config: Omit<CreateBaseTranslatorProps<Messages>, 'messagesOrError'>): {
18
+ <TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues | undefined, formats?: Partial<Formats> | undefined): string;
19
+ rich: (key: string, values?: RichTranslationValues | undefined, formats?: Partial<Formats> | undefined) => string | ReactElement<any, string | import("react").JSXElementConstructor<any>> | ReactNodeArray;
20
+ raw(key: string): any;
21
+ };
@@ -1,19 +1,20 @@
1
- import DateTimeFormatOptions from './DateTimeFormatOptions';
2
- import Formats from './Formats';
3
- import IntlError from './IntlError';
4
- import NumberFormatOptions from './NumberFormatOptions';
5
- import TimeZone from './TimeZone';
6
- type Props = {
7
- locale: string;
8
- timeZone?: TimeZone;
9
- onError?(error: IntlError): void;
10
- formats?: Partial<Formats>;
11
- now?: Date;
12
- };
13
- export default function createFormatter({ formats, locale, now: globalNow, onError, timeZone }: Props): {
14
- dateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
15
- number: (value: number | bigint, formatOrOptions?: string | NumberFormatOptions) => string;
16
- relativeTime: (date: number | Date, now?: number | Date) => string;
17
- list: (value: Iterable<string>, formatOrOptions?: string | Intl.ListFormatOptions) => string;
18
- };
19
- export {};
1
+ import DateTimeFormatOptions from './DateTimeFormatOptions';
2
+ import Formats from './Formats';
3
+ import IntlError from './IntlError';
4
+ import NumberFormatOptions from './NumberFormatOptions';
5
+ import RelativeTimeFormatOptions from './RelativeTimeFormatOptions';
6
+ import TimeZone from './TimeZone';
7
+ type Props = {
8
+ locale: string;
9
+ timeZone?: TimeZone;
10
+ onError?(error: IntlError): void;
11
+ formats?: Partial<Formats>;
12
+ now?: Date;
13
+ };
14
+ export default function createFormatter({ formats, locale, now: globalNow, onError, timeZone: globalTimeZone }: Props): {
15
+ dateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
16
+ number: (value: number | bigint, formatOrOptions?: string | NumberFormatOptions) => string;
17
+ relativeTime: (date: number | Date, nowOrOptions?: RelativeTimeFormatOptions['now'] | RelativeTimeFormatOptions) => string;
18
+ list: (value: Iterable<string>, formatOrOptions?: string | Intl.ListFormatOptions) => string;
19
+ };
20
+ export {};
@@ -1,47 +1,47 @@
1
- import Formats from './Formats';
2
- import IntlConfig from './IntlConfig';
3
- import TranslationValues, { RichTranslationValuesPlain } from './TranslationValues';
4
- import MessageKeys from './utils/MessageKeys';
5
- import NamespaceKeys from './utils/NamespaceKeys';
6
- import NestedKeyOf from './utils/NestedKeyOf';
7
- import NestedValueOf from './utils/NestedValueOf';
8
- /**
9
- * Translates messages from the given namespace by using the ICU syntax.
10
- * See https://formatjs.io/docs/core-concepts/icu-syntax.
11
- *
12
- * If no namespace is provided, all available messages are returned.
13
- * The namespace can also indicate nesting by using a dot
14
- * (e.g. `namespace.Component`).
15
- */
16
- export default function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({ getMessageFallback, messages, namespace, onError, ...rest }: Omit<IntlConfig<IntlMessages>, 'defaultTranslationValues' | 'messages'> & {
17
- messages: NonNullable<IntlConfig<IntlMessages>['messages']>;
18
- namespace?: NestedKey;
19
- }): {
20
- <TargetKey extends MessageKeys<NestedValueOf<{
21
- '!': IntlMessages;
22
- }, [
23
- NestedKey
24
- ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
25
- '!': IntlMessages;
26
- }, [
27
- NestedKey
28
- ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
29
- rich<TargetKey extends MessageKeys<NestedValueOf<{
30
- '!': IntlMessages;
31
- }, [
32
- NestedKey
33
- ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
34
- '!': IntlMessages;
35
- }, [
36
- NestedKey
37
- ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValuesPlain, formats?: Partial<Formats>): string;
38
- raw<TargetKey extends MessageKeys<NestedValueOf<{
39
- '!': IntlMessages;
40
- }, [
41
- NestedKey
42
- ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
43
- '!': IntlMessages;
44
- }, [
45
- NestedKey
46
- ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
47
- };
1
+ import Formats from './Formats';
2
+ import IntlConfig from './IntlConfig';
3
+ import TranslationValues, { RichTranslationValuesPlain } from './TranslationValues';
4
+ import MessageKeys from './utils/MessageKeys';
5
+ import NamespaceKeys from './utils/NamespaceKeys';
6
+ import NestedKeyOf from './utils/NestedKeyOf';
7
+ import NestedValueOf from './utils/NestedValueOf';
8
+ /**
9
+ * Translates messages from the given namespace by using the ICU syntax.
10
+ * See https://formatjs.io/docs/core-concepts/icu-syntax.
11
+ *
12
+ * If no namespace is provided, all available messages are returned.
13
+ * The namespace can also indicate nesting by using a dot
14
+ * (e.g. `namespace.Component`).
15
+ */
16
+ export default function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({ getMessageFallback, messages, namespace, onError, ...rest }: Omit<IntlConfig<IntlMessages>, 'defaultTranslationValues' | 'messages'> & {
17
+ messages: NonNullable<IntlConfig<IntlMessages>['messages']>;
18
+ namespace?: NestedKey;
19
+ }): {
20
+ <TargetKey extends MessageKeys<NestedValueOf<{
21
+ '!': IntlMessages;
22
+ }, [
23
+ NestedKey
24
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
25
+ '!': IntlMessages;
26
+ }, [
27
+ NestedKey
28
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
29
+ rich<TargetKey extends MessageKeys<NestedValueOf<{
30
+ '!': IntlMessages;
31
+ }, [
32
+ NestedKey
33
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
34
+ '!': IntlMessages;
35
+ }, [
36
+ NestedKey
37
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValuesPlain, formats?: Partial<Formats>): string;
38
+ raw<TargetKey extends MessageKeys<NestedValueOf<{
39
+ '!': IntlMessages;
40
+ }, [
41
+ NestedKey
42
+ ] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
43
+ '!': IntlMessages;
44
+ }, [
45
+ NestedKey
46
+ ] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
47
+ };
@@ -1,13 +1,13 @@
1
- import AbstractIntlMessages from './AbstractIntlMessages';
2
- import { InitializedIntlConfig } from './IntlConfig';
3
- import { RichTranslationValuesPlain } from './TranslationValues';
4
- import NestedKeyOf from './utils/NestedKeyOf';
5
- export type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'messages'> & {
6
- namespace: string;
7
- messages: Messages;
8
- };
9
- export default function createTranslatorImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ getMessageFallback, messages, namespace, onError, ...rest }: CreateTranslatorImplProps<Messages>, namespacePrefix: string): {
10
- (key: import("./utils/MessageKeys").default<import("./utils/NestedValueOf").default<Messages, NestedKey>, NestedKeyOf<import("./utils/NestedValueOf").default<Messages, NestedKey>>>, values?: import("./TranslationValues").default | undefined, formats?: Partial<import("./Formats").default> | undefined): string;
11
- rich(key: string, values: RichTranslationValuesPlain, formats?: Partial<import("./Formats").default> | undefined): string;
12
- raw: (key: string) => any;
13
- };
1
+ import AbstractIntlMessages from './AbstractIntlMessages';
2
+ import { InitializedIntlConfig } from './IntlConfig';
3
+ import { RichTranslationValuesPlain } from './TranslationValues';
4
+ import NestedKeyOf from './utils/NestedKeyOf';
5
+ export type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'messages'> & {
6
+ namespace: string;
7
+ messages: Messages;
8
+ };
9
+ export default function createTranslatorImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ getMessageFallback, messages, namespace, onError, ...rest }: CreateTranslatorImplProps<Messages>, namespacePrefix: string): {
10
+ (key: import("./utils/MessageKeys").default<import("./utils/NestedValueOf").default<Messages, NestedKey>, NestedKeyOf<import("./utils/NestedValueOf").default<Messages, NestedKey>>>, values?: import("./TranslationValues").default | undefined, formats?: Partial<import("./Formats").default> | undefined): string;
11
+ rich(key: string, values: RichTranslationValuesPlain, formats?: Partial<import("./Formats").default> | undefined): string;
12
+ raw: (key: string) => any;
13
+ };
@@ -1,11 +1,11 @@
1
- import IntlError from './IntlError';
2
- /**
3
- * Contains defaults that are used for all entry points into the core.
4
- * See also `InitializedIntlConfiguration`.
5
- */
6
- export declare function defaultGetMessageFallback(props: {
7
- error: IntlError;
8
- key: string;
9
- namespace?: string;
10
- }): string;
11
- export declare function defaultOnError(error: IntlError): void;
1
+ import IntlError from './IntlError';
2
+ /**
3
+ * Contains defaults that are used for all entry points into the core.
4
+ * See also `InitializedIntlConfiguration`.
5
+ */
6
+ export declare function defaultGetMessageFallback(props: {
7
+ error: IntlError;
8
+ key: string;
9
+ namespace?: string;
10
+ }): string;
11
+ export declare function defaultOnError(error: IntlError): void;
@@ -1,16 +1,15 @@
1
- export type { default as AbstractIntlMessages } from './AbstractIntlMessages';
2
- export type { default as TranslationValues, RichTranslationValues, RichTranslationValuesPlain } from './TranslationValues';
3
- export type { default as Formats } from './Formats';
4
- export type { default as IntlConfig } from './IntlConfig';
5
- export type { default as DateTimeFormatOptions } from './DateTimeFormatOptions';
6
- export type { default as NumberFormatOptions } from './NumberFormatOptions';
7
- export { default as IntlError, IntlErrorCode } from './IntlError';
8
- export { default as createTranslator } from './createTranslator';
9
- export { default as createBaseTranslator } from './createBaseTranslator';
10
- export { default as createFormatter } from './createFormatter';
11
- export { default as initializeConfig } from './initializeConfig';
12
- export { default as MessageKeys } from './utils/MessageKeys';
13
- export { default as NamespaceKeys } from './utils/NamespaceKeys';
14
- export { default as NestedKeyOf } from './utils/NestedKeyOf';
15
- export { default as NestedValueOf } from './utils/NestedValueOf';
16
- export { default as createIntl } from './createIntl';
1
+ export type { default as AbstractIntlMessages } from './AbstractIntlMessages';
2
+ export type { default as TranslationValues, RichTranslationValues, RichTranslationValuesPlain } from './TranslationValues';
3
+ export type { default as Formats } from './Formats';
4
+ export type { default as IntlConfig } from './IntlConfig';
5
+ export type { default as DateTimeFormatOptions } from './DateTimeFormatOptions';
6
+ export type { default as NumberFormatOptions } from './NumberFormatOptions';
7
+ export { default as IntlError, IntlErrorCode } from './IntlError';
8
+ export { default as createTranslator } from './createTranslator';
9
+ export { default as createBaseTranslator } from './createBaseTranslator';
10
+ export { default as createFormatter } from './createFormatter';
11
+ export { default as initializeConfig } from './initializeConfig';
12
+ export type { default as MessageKeys } from './utils/MessageKeys';
13
+ export type { default as NamespaceKeys } from './utils/NamespaceKeys';
14
+ export type { default as NestedKeyOf } from './utils/NestedKeyOf';
15
+ export type { default as NestedValueOf } from './utils/NestedValueOf';
@@ -1,13 +1,14 @@
1
- import IntlConfig from './IntlConfig';
2
- /**
3
- * Enhances the incoming props with defaults.
4
- */
5
- export default function initializeConfig<Props extends Omit<IntlConfig, 'children'>>({ getMessageFallback, messages, onError, ...rest }: Props): Omit<Props, "onError" | "getMessageFallback" | "messages"> & {
6
- messages: import("./AbstractIntlMessages").default | undefined;
7
- onError: (error: import("./IntlError").default) => void;
8
- getMessageFallback: (info: {
9
- error: import("./IntlError").default;
10
- key: string;
11
- namespace?: string | undefined;
12
- }) => string;
13
- };
1
+ import IntlConfig from './IntlConfig';
2
+ import { defaultOnError } from './defaults';
3
+ /**
4
+ * Enhances the incoming props with defaults.
5
+ */
6
+ export default function initializeConfig<Props extends Omit<IntlConfig, 'children'>>({ getMessageFallback, messages, onError, ...rest }: Props): Omit<Props, "messages" | "onError" | "getMessageFallback"> & {
7
+ messages: import("./AbstractIntlMessages").default | undefined;
8
+ onError: typeof defaultOnError;
9
+ getMessageFallback: (info: {
10
+ error: import("./IntlError").default;
11
+ key: string;
12
+ namespace?: string | undefined;
13
+ }) => string;
14
+ };
@@ -1,5 +1,5 @@
1
- /**
2
- * For the strictly typed messages to work we have to wrap the namespace into
3
- * a mandatory prefix. See https://stackoverflow.com/a/71529575/343045
4
- */
5
- export default function resolveNamespace(namespace: string, namespacePrefix: string): string | undefined;
1
+ /**
2
+ * For the strictly typed messages to work we have to wrap the namespace into
3
+ * a mandatory prefix. See https://stackoverflow.com/a/71529575/343045
4
+ */
5
+ export default function resolveNamespace(namespace: string, namespacePrefix: string): string | undefined;
@@ -1,5 +1,5 @@
1
- import NestedValueOf from './NestedValueOf';
2
- type MessageKeys<ObjectType, Keys extends string> = {
3
- [Property in Keys]: NestedValueOf<ObjectType, Property> extends string ? Property : never;
4
- }[Keys];
5
- export default MessageKeys;
1
+ import NestedValueOf from './NestedValueOf';
2
+ type MessageKeys<ObjectType, Keys extends string> = {
3
+ [Property in Keys]: NestedValueOf<ObjectType, Property> extends string ? Property : never;
4
+ }[Keys];
5
+ export default MessageKeys;
@@ -1,5 +1,5 @@
1
- import NestedValueOf from './NestedValueOf';
2
- type NamespaceKeys<ObjectType, Keys extends string> = {
3
- [Property in Keys]: NestedValueOf<ObjectType, Property> extends string ? never : Property;
4
- }[Keys];
5
- export default NamespaceKeys;
1
+ import NestedValueOf from './NestedValueOf';
2
+ type NamespaceKeys<ObjectType, Keys extends string> = {
3
+ [Property in Keys]: NestedValueOf<ObjectType, Property> extends string ? never : Property;
4
+ }[Keys];
5
+ export default NamespaceKeys;