use-intl 2.22.1 → 2.22.2
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 +1 -1
- package/_IntlProvider.d.ts +1 -0
- package/_useLocale.d.ts +1 -0
- package/core.d.ts +1 -0
- package/dist/_IntlProvider.js +7 -0
- package/dist/_useLocale.js +7 -0
- package/dist/core.js +7 -0
- package/dist/development/IntlContext-b5cc6be8.js +8 -0
- package/dist/development/_IntlProvider.js +53 -0
- package/dist/development/_useLocale-321e619f.js +19 -0
- package/dist/development/_useLocale.js +11 -0
- package/dist/development/core.js +66 -0
- package/dist/development/createFormatter-4848f6c8.js +453 -0
- package/dist/development/index.js +28 -0
- package/dist/development/initializeConfig-0a0b87a7.js +120 -0
- package/dist/development/react.js +145 -0
- package/dist/esm/IntlContext-381f3ce4.js +1 -0
- package/dist/esm/_IntlProvider.js +1 -0
- package/dist/esm/_useLocale-89b32eb9.js +1 -0
- package/dist/esm/_useLocale.js +1 -0
- package/dist/esm/core.js +1 -0
- package/dist/esm/createFormatter-c871a8ce.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/initializeConfig-29e7ba4c.js +1 -0
- package/dist/esm/react.js +1 -0
- package/dist/index.js +3 -4
- package/dist/production/IntlContext-381f3ce4.js +1 -0
- package/dist/production/_IntlProvider.js +1 -0
- package/dist/production/_useLocale-8e23751a.js +1 -0
- package/dist/production/_useLocale.js +1 -0
- package/dist/production/core.js +1 -0
- package/dist/production/createFormatter-7a8c6f36.js +1 -0
- package/dist/production/index.js +1 -0
- package/dist/production/initializeConfig-984a566d.js +1 -0
- package/dist/production/react.js +1 -0
- package/dist/react.js +7 -0
- package/dist/types/src/_IntlProvider.d.ts +1 -0
- package/dist/types/src/_useLocale.d.ts +1 -0
- package/dist/{src → types/src}/core/IntlConfig.d.ts +1 -1
- package/dist/{core → types/src/core}/TranslationValues.d.ts +6 -5
- package/dist/{src → types/src}/core/createBaseTranslator.d.ts +5 -9
- package/dist/{src → types/src}/core/createTranslator.d.ts +16 -4
- package/dist/types/src/core/createTranslatorImpl.d.ts +16 -0
- package/dist/{core → types/src/core}/index.d.ts +14 -9
- package/dist/types/src/core/initializeConfig.d.ts +14 -0
- package/dist/types/src/core.d.ts +1 -0
- package/dist/types/src/react/IntlProvider.d.ts +7 -0
- package/dist/{src → types/src}/react/index.d.ts +0 -1
- package/dist/types/src/react/useMessages.d.ts +2 -0
- package/dist/{src → types/src}/react/useTranslations.d.ts +10 -1
- package/dist/{src → types/src}/react/useTranslationsImpl.d.ts +2 -1
- package/dist/types/src/react.d.ts +1 -0
- package/dist/types/test/core/createFormatter.test.d.ts +1 -0
- package/dist/types/test/core/createTranslator.test.d.ts +1 -0
- package/dist/types/test/react/IntlProvider.test.d.ts +1 -0
- package/dist/types/test/react/useFormatter.test.d.ts +1 -0
- package/dist/types/test/react/useLocale.test.d.ts +1 -0
- package/dist/types/test/react/useMessages.test.d.ts +1 -0
- package/dist/types/test/react/useNow.test.d.ts +1 -0
- package/dist/types/test/react/useTimeZone.test.d.ts +1 -0
- package/dist/types/test/react/useTranslations.test.d.ts +1 -0
- package/dist/types/test/setup.d.ts +1 -0
- package/package.json +38 -21
- package/react.d.ts +1 -0
- package/dist/_virtual/use-intl.esm.js +0 -102
- package/dist/_virtual/use-intl.esm.js.map +0 -1
- package/dist/core/AbstractIntlMessages.d.ts +0 -9
- package/dist/core/DateTimeFormatOptions.d.ts +0 -73
- package/dist/core/Formats.d.ts +0 -8
- package/dist/core/IntlConfig.d.ts +0 -54
- package/dist/core/IntlError.d.ts +0 -14
- package/dist/core/MessageFormatCache.d.ts +0 -5
- package/dist/core/NumberFormatOptions.d.ts +0 -2
- package/dist/core/RelativeTimeFormatOptions.d.ts +0 -5
- package/dist/core/TimeZone.d.ts +0 -2
- package/dist/core/convertFormatsToIntlMessageFormat.d.ts +0 -11
- package/dist/core/createBaseTranslator.d.ts +0 -26
- package/dist/core/createFormatter.d.ts +0 -20
- package/dist/core/createIntl.d.ts +0 -7
- package/dist/core/createTranslator.d.ts +0 -48
- package/dist/core/createTranslatorImpl.d.ts +0 -14
- package/dist/core/defaults.d.ts +0 -11
- package/dist/core/resolveNamespace.d.ts +0 -5
- package/dist/core/use-intl.esm.js +0 -34
- package/dist/core/use-intl.esm.js.map +0 -1
- package/dist/core/use-intl.esm10.js +0 -37
- package/dist/core/use-intl.esm10.js.map +0 -1
- package/dist/core/use-intl.esm2.js +0 -36
- package/dist/core/use-intl.esm2.js.map +0 -1
- package/dist/core/use-intl.esm3.js +0 -161
- package/dist/core/use-intl.esm3.js.map +0 -1
- package/dist/core/use-intl.esm4.js +0 -14
- package/dist/core/use-intl.esm4.js.map +0 -1
- package/dist/core/use-intl.esm5.js +0 -53
- package/dist/core/use-intl.esm5.js.map +0 -1
- package/dist/core/use-intl.esm6.js +0 -15
- package/dist/core/use-intl.esm6.js.map +0 -1
- package/dist/core/use-intl.esm7.js +0 -200
- package/dist/core/use-intl.esm7.js.map +0 -1
- package/dist/core/use-intl.esm8.js +0 -10
- package/dist/core/use-intl.esm8.js.map +0 -1
- package/dist/core/use-intl.esm9.js +0 -28
- package/dist/core/use-intl.esm9.js.map +0 -1
- package/dist/core/utils/MessageKeys.d.ts +0 -5
- package/dist/core/utils/NamespaceKeys.d.ts +0 -5
- package/dist/core/utils/NestedKeyOf.d.ts +0 -4
- package/dist/core/utils/NestedValueOf.d.ts +0 -2
- package/dist/core/validateMessages.d.ts +0 -3
- package/dist/index.d.ts +0 -2
- package/dist/react/IntlContext.d.ts +0 -13
- package/dist/react/IntlProvider.d.ts +0 -7
- package/dist/react/getInitializedConfig.d.ts +0 -13
- package/dist/react/index.d.ts +0 -8
- package/dist/react/use-intl.esm.js +0 -22
- package/dist/react/use-intl.esm.js.map +0 -1
- package/dist/react/use-intl.esm10.js +0 -29
- package/dist/react/use-intl.esm10.js.map +0 -1
- package/dist/react/use-intl.esm11.js +0 -13
- package/dist/react/use-intl.esm11.js.map +0 -1
- package/dist/react/use-intl.esm12.js +0 -43
- package/dist/react/use-intl.esm12.js.map +0 -1
- package/dist/react/use-intl.esm2.js +0 -26
- package/dist/react/use-intl.esm2.js.map +0 -1
- package/dist/react/use-intl.esm3.js +0 -8
- package/dist/react/use-intl.esm3.js.map +0 -1
- package/dist/react/use-intl.esm4.js +0 -45
- package/dist/react/use-intl.esm4.js.map +0 -1
- package/dist/react/use-intl.esm5.js +0 -8
- package/dist/react/use-intl.esm5.js.map +0 -1
- package/dist/react/use-intl.esm6.js +0 -8
- package/dist/react/use-intl.esm6.js.map +0 -1
- package/dist/react/use-intl.esm7.js +0 -24
- package/dist/react/use-intl.esm7.js.map +0 -1
- package/dist/react/use-intl.esm8.js +0 -30
- package/dist/react/use-intl.esm8.js.map +0 -1
- package/dist/react/use-intl.esm9.js +0 -6
- package/dist/react/use-intl.esm9.js.map +0 -1
- package/dist/react/useFormatter.d.ts +0 -6
- package/dist/react/useIntl.d.ts +0 -6
- package/dist/react/useIntlContext.d.ts +0 -10
- package/dist/react/useLocale.d.ts +0 -1
- package/dist/react/useMessages.d.ts +0 -1
- package/dist/react/useNow.d.ts +0 -23
- package/dist/react/useTimeZone.d.ts +0 -1
- package/dist/react/useTranslations.d.ts +0 -44
- package/dist/react/useTranslationsImpl.d.ts +0 -8
- package/dist/src/core/AbstractIntlMessages.js +0 -2
- package/dist/src/core/AbstractIntlMessages.js.map +0 -1
- package/dist/src/core/DateTimeFormatOptions.js +0 -3
- package/dist/src/core/DateTimeFormatOptions.js.map +0 -1
- package/dist/src/core/Formats.js +0 -2
- package/dist/src/core/Formats.js.map +0 -1
- package/dist/src/core/IntlConfig.js +0 -2
- package/dist/src/core/IntlConfig.js.map +0 -1
- package/dist/src/core/IntlError.js +0 -24
- package/dist/src/core/IntlError.js.map +0 -1
- package/dist/src/core/MessageFormatCache.js +0 -2
- package/dist/src/core/MessageFormatCache.js.map +0 -1
- package/dist/src/core/NumberFormatOptions.js +0 -2
- package/dist/src/core/NumberFormatOptions.js.map +0 -1
- package/dist/src/core/RelativeTimeFormatOptions.js +0 -2
- package/dist/src/core/RelativeTimeFormatOptions.js.map +0 -1
- package/dist/src/core/TimeZone.js +0 -2
- package/dist/src/core/TimeZone.js.map +0 -1
- package/dist/src/core/TranslationValues.d.ts +0 -5
- package/dist/src/core/TranslationValues.js +0 -2
- package/dist/src/core/TranslationValues.js.map +0 -1
- package/dist/src/core/convertFormatsToIntlMessageFormat.js +0 -47
- package/dist/src/core/convertFormatsToIntlMessageFormat.js.map +0 -1
- package/dist/src/core/createBaseTranslator.js +0 -218
- package/dist/src/core/createBaseTranslator.js.map +0 -1
- package/dist/src/core/createFormatter.js +0 -163
- package/dist/src/core/createFormatter.js.map +0 -1
- package/dist/src/core/createIntl.d.ts +0 -7
- package/dist/src/core/createIntl.js +0 -11
- package/dist/src/core/createIntl.js.map +0 -1
- package/dist/src/core/createTranslator.js +0 -23
- package/dist/src/core/createTranslator.js.map +0 -1
- package/dist/src/core/createTranslatorImpl.d.ts +0 -14
- package/dist/src/core/createTranslatorImpl.js +0 -43
- package/dist/src/core/createTranslatorImpl.js.map +0 -1
- package/dist/src/core/defaults.js +0 -11
- package/dist/src/core/defaults.js.map +0 -1
- package/dist/src/core/index.d.ts +0 -9
- package/dist/src/core/index.js +0 -6
- package/dist/src/core/index.js.map +0 -1
- package/dist/src/core/resolveNamespace.js +0 -10
- package/dist/src/core/resolveNamespace.js.map +0 -1
- package/dist/src/core/utils/MessageKeys.js +0 -2
- package/dist/src/core/utils/MessageKeys.js.map +0 -1
- package/dist/src/core/utils/NamespaceKeys.js +0 -2
- package/dist/src/core/utils/NamespaceKeys.js.map +0 -1
- package/dist/src/core/utils/NestedKeyOf.js +0 -2
- package/dist/src/core/utils/NestedKeyOf.js.map +0 -1
- package/dist/src/core/utils/NestedValueOf.js +0 -2
- package/dist/src/core/utils/NestedValueOf.js.map +0 -1
- package/dist/src/core/validateMessages.js +0 -56
- package/dist/src/core/validateMessages.js.map +0 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +0 -1
- package/dist/src/react/IntlContext.js +0 -4
- package/dist/src/react/IntlContext.js.map +0 -1
- package/dist/src/react/IntlProvider.d.ts +0 -7
- package/dist/src/react/IntlProvider.js +0 -11
- package/dist/src/react/IntlProvider.js.map +0 -1
- package/dist/src/react/getInitializedConfig.d.ts +0 -13
- package/dist/src/react/getInitializedConfig.js +0 -21
- package/dist/src/react/getInitializedConfig.js.map +0 -1
- package/dist/src/react/index.js +0 -10
- package/dist/src/react/index.js.map +0 -1
- package/dist/src/react/useFormatter.js +0 -14
- package/dist/src/react/useFormatter.js.map +0 -1
- package/dist/src/react/useIntl.d.ts +0 -6
- package/dist/src/react/useIntl.js +0 -20
- package/dist/src/react/useIntl.js.map +0 -1
- package/dist/src/react/useIntlContext.js +0 -12
- package/dist/src/react/useIntlContext.js.map +0 -1
- package/dist/src/react/useLocale.js +0 -5
- package/dist/src/react/useLocale.js.map +0 -1
- package/dist/src/react/useMessages.d.ts +0 -1
- package/dist/src/react/useMessages.js +0 -5
- package/dist/src/react/useMessages.js.map +0 -1
- package/dist/src/react/useNow.js +0 -40
- package/dist/src/react/useNow.js.map +0 -1
- package/dist/src/react/useTimeZone.js +0 -5
- package/dist/src/react/useTimeZone.js.map +0 -1
- package/dist/src/react/useTranslations.js +0 -21
- package/dist/src/react/useTranslations.js.map +0 -1
- package/dist/src/react/useTranslationsImpl.js +0 -35
- package/dist/src/react/useTranslationsImpl.js.map +0 -1
- package/dist/use-intl.cjs.development.js +0 -863
- package/dist/use-intl.cjs.development.js.map +0 -1
- package/dist/use-intl.cjs.production.min.js +0 -2
- package/dist/use-intl.cjs.production.min.js.map +0 -1
- package/dist/use-intl.esm.js +0 -13
- package/dist/use-intl.esm.js.map +0 -1
- package/src/core/AbstractIntlMessages.tsx +0 -10
- package/src/core/DateTimeFormatOptions.tsx +0 -130
- package/src/core/Formats.tsx +0 -10
- package/src/core/IntlConfig.tsx +0 -59
- package/src/core/IntlError.tsx +0 -27
- package/src/core/MessageFormatCache.tsx +0 -10
- package/src/core/NumberFormatOptions.tsx +0 -3
- package/src/core/RelativeTimeFormatOptions.tsx +0 -6
- package/src/core/TimeZone.tsx +0 -426
- package/src/core/TranslationValues.tsx +0 -22
- package/src/core/convertFormatsToIntlMessageFormat.tsx +0 -63
- package/src/core/createBaseTranslator.tsx +0 -352
- package/src/core/createFormatter.tsx +0 -242
- package/src/core/createIntl.tsx +0 -13
- package/src/core/createTranslator.tsx +0 -111
- package/src/core/createTranslatorImpl.tsx +0 -87
- package/src/core/defaults.tsx +0 -18
- package/src/core/index.tsx +0 -14
- package/src/core/resolveNamespace.tsx +0 -12
- package/src/core/utils/MessageKeys.tsx +0 -9
- package/src/core/utils/NamespaceKeys.tsx +0 -9
- package/src/core/utils/NestedKeyOf.tsx +0 -9
- package/src/core/utils/NestedValueOf.tsx +0 -12
- package/src/core/validateMessages.tsx +0 -77
- package/src/index.tsx +0 -2
- package/src/react/IntlContext.tsx +0 -12
- package/src/react/IntlProvider.tsx +0 -23
- package/src/react/getInitializedConfig.tsx +0 -29
- package/src/react/index.tsx +0 -10
- package/src/react/useFormatter.tsx +0 -19
- package/src/react/useIntl.tsx +0 -29
- package/src/react/useIntlContext.tsx +0 -16
- package/src/react/useLocale.tsx +0 -5
- package/src/react/useMessages.tsx +0 -5
- package/src/react/useNow.tsx +0 -49
- package/src/react/useTimeZone.tsx +0 -5
- package/src/react/useTranslations.tsx +0 -103
- package/src/react/useTranslationsImpl.tsx +0 -61
- /package/dist/{src → types/src}/core/AbstractIntlMessages.d.ts +0 -0
- /package/dist/{src → types/src}/core/DateTimeFormatOptions.d.ts +0 -0
- /package/dist/{src → types/src}/core/Formats.d.ts +0 -0
- /package/dist/{src → types/src}/core/IntlError.d.ts +0 -0
- /package/dist/{src → types/src}/core/MessageFormatCache.d.ts +0 -0
- /package/dist/{src → types/src}/core/NumberFormatOptions.d.ts +0 -0
- /package/dist/{src → types/src}/core/RelativeTimeFormatOptions.d.ts +0 -0
- /package/dist/{src → types/src}/core/TimeZone.d.ts +0 -0
- /package/dist/{src → types/src}/core/convertFormatsToIntlMessageFormat.d.ts +0 -0
- /package/dist/{src → types/src}/core/createFormatter.d.ts +0 -0
- /package/dist/{src → types/src}/core/defaults.d.ts +0 -0
- /package/dist/{src → types/src}/core/resolveNamespace.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/MessageKeys.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/NamespaceKeys.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/NestedKeyOf.d.ts +0 -0
- /package/dist/{src → types/src}/core/utils/NestedValueOf.d.ts +0 -0
- /package/dist/{src → types/src}/core/validateMessages.d.ts +0 -0
- /package/dist/{src → types/src}/index.d.ts +0 -0
- /package/dist/{src → types/src}/react/IntlContext.d.ts +0 -0
- /package/dist/{src → types/src}/react/useFormatter.d.ts +0 -0
- /package/dist/{src → types/src}/react/useIntlContext.d.ts +0 -0
- /package/dist/{src → types/src}/react/useLocale.d.ts +0 -0
- /package/dist/{src → types/src}/react/useNow.d.ts +0 -0
- /package/dist/{src → types/src}/react/useTimeZone.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-intl",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"description": "Minimal, but complete solution for managing internationalization in React apps.",
|
|
@@ -11,20 +11,43 @@
|
|
|
11
11
|
"url": "https://github.com/amannn/next-intl/tree/main/packages/use-intl"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "
|
|
15
|
-
"build:default": "rm -rf dist && dts build",
|
|
16
|
-
"build:rsc": "tsc && rm -rf dist/test",
|
|
14
|
+
"build": "rm -rf dist && rollup -c",
|
|
17
15
|
"test": "TZ=Europe/Berlin vitest",
|
|
18
16
|
"lint": "eslint src test && tsc --noEmit",
|
|
19
17
|
"prepublishOnly": "CI=true turbo test && turbo lint && turbo build",
|
|
20
18
|
"size": "size-limit"
|
|
21
19
|
},
|
|
22
|
-
"main": "dist/index.js",
|
|
23
|
-
"module": "dist/
|
|
24
|
-
"typings": "dist/index.d.ts",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"module": "dist/esm/index.js",
|
|
22
|
+
"typings": "./dist/types/src/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/types/src/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./core": {
|
|
29
|
+
"types": "./core.d.ts",
|
|
30
|
+
"default": "./dist/core.js"
|
|
31
|
+
},
|
|
32
|
+
"./react": {
|
|
33
|
+
"types": "./react.d.ts",
|
|
34
|
+
"default": "./dist/react.js"
|
|
35
|
+
},
|
|
36
|
+
"./_useLocale": {
|
|
37
|
+
"types": "./_useLocale.d.ts",
|
|
38
|
+
"default": "./dist/_useLocale.js"
|
|
39
|
+
},
|
|
40
|
+
"./_IntlProvider": {
|
|
41
|
+
"types": "./_IntlProvider.d.ts",
|
|
42
|
+
"default": "./dist/_IntlProvider.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
25
45
|
"files": [
|
|
26
46
|
"dist",
|
|
27
|
-
"
|
|
47
|
+
"core.d.ts",
|
|
48
|
+
"react.d.ts",
|
|
49
|
+
"_useLocale.d.ts",
|
|
50
|
+
"_IntlProvider.d.ts"
|
|
28
51
|
],
|
|
29
52
|
"keywords": [
|
|
30
53
|
"react",
|
|
@@ -48,29 +71,23 @@
|
|
|
48
71
|
"@size-limit/preset-big-lib": "^8.2.6",
|
|
49
72
|
"@testing-library/react": "^13.0.0",
|
|
50
73
|
"@types/node": "^17.0.23",
|
|
51
|
-
"@types/react": "^18.2.
|
|
74
|
+
"@types/react": "^18.2.29",
|
|
75
|
+
"@types/react-dom": "^18.2.5",
|
|
52
76
|
"date-fns": "^2.16.1",
|
|
53
|
-
"dts-cli": "^1.4.0",
|
|
54
77
|
"eslint": "^8.46.0",
|
|
55
78
|
"eslint-config-molindo": "^7.0.0",
|
|
56
79
|
"react": "^18.2.0",
|
|
57
80
|
"react-dom": "^18.2.0",
|
|
81
|
+
"rollup": "^3.28.1",
|
|
58
82
|
"size-limit": "^8.2.6",
|
|
59
|
-
"typescript": "^5.
|
|
83
|
+
"typescript": "^5.2.2",
|
|
60
84
|
"vitest": "^0.32.2"
|
|
61
85
|
},
|
|
62
86
|
"size-limit": [
|
|
63
87
|
{
|
|
64
|
-
"path": "dist/
|
|
65
|
-
"limit": "
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"path": "dist/use-intl.cjs.development.js",
|
|
69
|
-
"limit": "10.3 kB"
|
|
88
|
+
"path": "dist/production/index.js",
|
|
89
|
+
"limit": "12.355 kB"
|
|
70
90
|
}
|
|
71
91
|
],
|
|
72
|
-
"
|
|
73
|
-
"node": ">=10"
|
|
74
|
-
},
|
|
75
|
-
"gitHead": "b1688dea14c9367972568239160e7f2403bfb4ab"
|
|
92
|
+
"gitHead": "367f37fe8f8a36dfeeb350c20a18831ba26ec5c0"
|
|
76
93
|
}
|
package/react.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/types/src/react';
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
3
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4
|
-
var source = arguments[i];
|
|
5
|
-
for (var key in source) {
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7
|
-
target[key] = source[key];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
return _extends.apply(this, arguments);
|
|
14
|
-
}
|
|
15
|
-
function _inheritsLoose(subClass, superClass) {
|
|
16
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
17
|
-
subClass.prototype.constructor = subClass;
|
|
18
|
-
_setPrototypeOf(subClass, superClass);
|
|
19
|
-
}
|
|
20
|
-
function _getPrototypeOf(o) {
|
|
21
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
22
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
23
|
-
};
|
|
24
|
-
return _getPrototypeOf(o);
|
|
25
|
-
}
|
|
26
|
-
function _setPrototypeOf(o, p) {
|
|
27
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
28
|
-
o.__proto__ = p;
|
|
29
|
-
return o;
|
|
30
|
-
};
|
|
31
|
-
return _setPrototypeOf(o, p);
|
|
32
|
-
}
|
|
33
|
-
function _isNativeReflectConstruct() {
|
|
34
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
35
|
-
if (Reflect.construct.sham) return false;
|
|
36
|
-
if (typeof Proxy === "function") return true;
|
|
37
|
-
try {
|
|
38
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
39
|
-
return true;
|
|
40
|
-
} catch (e) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function _construct(Parent, args, Class) {
|
|
45
|
-
if (_isNativeReflectConstruct()) {
|
|
46
|
-
_construct = Reflect.construct.bind();
|
|
47
|
-
} else {
|
|
48
|
-
_construct = function _construct(Parent, args, Class) {
|
|
49
|
-
var a = [null];
|
|
50
|
-
a.push.apply(a, args);
|
|
51
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
52
|
-
var instance = new Constructor();
|
|
53
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
54
|
-
return instance;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return _construct.apply(null, arguments);
|
|
58
|
-
}
|
|
59
|
-
function _isNativeFunction(fn) {
|
|
60
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
61
|
-
}
|
|
62
|
-
function _wrapNativeSuper(Class) {
|
|
63
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
64
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
65
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
66
|
-
if (typeof Class !== "function") {
|
|
67
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
68
|
-
}
|
|
69
|
-
if (typeof _cache !== "undefined") {
|
|
70
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
71
|
-
_cache.set(Class, Wrapper);
|
|
72
|
-
}
|
|
73
|
-
function Wrapper() {
|
|
74
|
-
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
75
|
-
}
|
|
76
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
77
|
-
constructor: {
|
|
78
|
-
value: Wrapper,
|
|
79
|
-
enumerable: false,
|
|
80
|
-
writable: true,
|
|
81
|
-
configurable: true
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
85
|
-
};
|
|
86
|
-
return _wrapNativeSuper(Class);
|
|
87
|
-
}
|
|
88
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
89
|
-
if (source == null) return {};
|
|
90
|
-
var target = {};
|
|
91
|
-
var sourceKeys = Object.keys(source);
|
|
92
|
-
var key, i;
|
|
93
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
94
|
-
key = sourceKeys[i];
|
|
95
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
96
|
-
target[key] = source[key];
|
|
97
|
-
}
|
|
98
|
-
return target;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { _construct as construct, _extends as extends, _getPrototypeOf as getPrototypeOf, _inheritsLoose as inheritsLoose, _isNativeFunction as isNativeFunction, _isNativeReflectConstruct as isNativeReflectConstruct, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose, _setPrototypeOf as setPrototypeOf, _wrapNativeSuper as wrapNativeSuper };
|
|
102
|
-
//# sourceMappingURL=use-intl.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-intl.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** A generic type that describes the shape of messages.
|
|
2
|
-
*
|
|
3
|
-
* Optionally `IntlMessages` can be provided to get type safety for message
|
|
4
|
-
* namespaces and keys. See https://next-intl-docs.vercel.app/docs/usage/typescript
|
|
5
|
-
*/
|
|
6
|
-
type AbstractIntlMessages = {
|
|
7
|
-
[id: string]: AbstractIntlMessages | string;
|
|
8
|
-
};
|
|
9
|
-
export default AbstractIntlMessages;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import TimeZone from './TimeZone';
|
|
2
|
-
/**
|
|
3
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
4
|
-
*/
|
|
5
|
-
type DateTimeFormatOptions = Intl.DateTimeFormatOptions & {
|
|
6
|
-
/**
|
|
7
|
-
* Examples:
|
|
8
|
-
* - numeric: "2021"
|
|
9
|
-
* - 2-digit: "21"
|
|
10
|
-
*/
|
|
11
|
-
year?: 'numeric' | '2-digit';
|
|
12
|
-
/** Examples:
|
|
13
|
-
* - numeric: "3"
|
|
14
|
-
* - 2-digit: "03"
|
|
15
|
-
* - long: "March"
|
|
16
|
-
* - short: "Mar"
|
|
17
|
-
* - narrow: "M"
|
|
18
|
-
*/
|
|
19
|
-
month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';
|
|
20
|
-
/** Examples:
|
|
21
|
-
* - numeric: "2"
|
|
22
|
-
* - 2-digit: "02"
|
|
23
|
-
*/
|
|
24
|
-
day?: 'numeric' | '2-digit';
|
|
25
|
-
/** Examples:
|
|
26
|
-
* - numeric: "2"
|
|
27
|
-
* - 2-digit: "02"
|
|
28
|
-
*/
|
|
29
|
-
hour?: 'numeric' | '2-digit';
|
|
30
|
-
/** Examples:
|
|
31
|
-
* - numeric: "2"
|
|
32
|
-
* - 2-digit: "02"
|
|
33
|
-
*/
|
|
34
|
-
minute?: 'numeric' | '2-digit';
|
|
35
|
-
/** Examples:
|
|
36
|
-
* - numeric: "2"
|
|
37
|
-
* - 2-digit: "02"
|
|
38
|
-
*/
|
|
39
|
-
second?: 'numeric' | '2-digit';
|
|
40
|
-
/** Examples:
|
|
41
|
-
* - long: "Thursday"
|
|
42
|
-
* - short: "Thu"
|
|
43
|
-
* - narrow: "T"
|
|
44
|
-
*/
|
|
45
|
-
weekday?: 'long' | 'short' | 'narrow';
|
|
46
|
-
/** Examples:
|
|
47
|
-
* - long: "Anno Domini"
|
|
48
|
-
* - short: "AD", narrow "A"
|
|
49
|
-
*/
|
|
50
|
-
era?: 'long' | 'short' | 'narrow';
|
|
51
|
-
/** If this is set to `true`, a 12-hour am/pm format is used. Otherwise a 24-hour time.
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
hour12?: boolean;
|
|
55
|
-
/** Examples:
|
|
56
|
-
* - long: "Pacific Daylight Time"
|
|
57
|
-
* - short: "PDT"
|
|
58
|
-
*/
|
|
59
|
-
timeZoneName?: 'long' | 'short';
|
|
60
|
-
/**
|
|
61
|
-
* One of the [database names from the TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List).
|
|
62
|
-
*/
|
|
63
|
-
timeZone?: TimeZone;
|
|
64
|
-
localeMatcher?: 'best fit' | 'lookup';
|
|
65
|
-
formatMatcher?: 'best fit' | 'basic';
|
|
66
|
-
dateStyle?: 'full' | 'long' | 'medium' | 'short';
|
|
67
|
-
timeStyle?: 'full' | 'long' | 'medium' | 'short';
|
|
68
|
-
calendar?: 'buddhist' | 'chinese' | 'coptic' | 'ethiopia' | 'ethiopic' | 'gregory' | 'hebrew' | 'indian' | 'islamic' | 'iso8601' | 'japanese' | 'persian' | 'roc';
|
|
69
|
-
dayPeriod?: 'narrow' | 'short' | 'long';
|
|
70
|
-
numberingSystem?: 'arab' | 'arabext' | 'bali' | 'beng' | 'deva' | 'fullwide' | 'gujr' | 'guru' | 'hanidec' | 'khmr' | 'knda' | 'laoo' | 'latn' | 'limb' | 'mlym' | 'mong' | 'mymr' | 'orya' | 'tamldec' | 'telu' | 'thai' | 'tibt';
|
|
71
|
-
hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
|
|
72
|
-
};
|
|
73
|
-
export default DateTimeFormatOptions;
|
package/dist/core/Formats.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import DateTimeFormatOptions from './DateTimeFormatOptions';
|
|
2
|
-
import NumberFormatOptions from './NumberFormatOptions';
|
|
3
|
-
type Formats = {
|
|
4
|
-
number: Record<string, NumberFormatOptions>;
|
|
5
|
-
dateTime: Record<string, DateTimeFormatOptions>;
|
|
6
|
-
list: Record<string, Intl.ListFormatOptions>;
|
|
7
|
-
};
|
|
8
|
-
export default Formats;
|
|
@@ -1,54 +0,0 @@
|
|
|
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;
|
package/dist/core/IntlError.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/core/TimeZone.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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,11 +0,0 @@
|
|
|
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,26 +0,0 @@
|
|
|
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 declare function getMessagesOrError<Messages extends AbstractIntlMessages>({ messages, namespace, onError }: {
|
|
12
|
-
messages: Messages;
|
|
13
|
-
namespace?: string;
|
|
14
|
-
onError?(error: IntlError): void;
|
|
15
|
-
}): AbstractIntlMessages | IntlError;
|
|
16
|
-
export type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {
|
|
17
|
-
messageFormatCache?: MessageFormatCache;
|
|
18
|
-
defaultTranslationValues?: RichTranslationValues;
|
|
19
|
-
namespace?: string;
|
|
20
|
-
messagesOrError: Messages | IntlError;
|
|
21
|
-
};
|
|
22
|
-
export default function createBaseTranslator<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ defaultTranslationValues, formats: globalFormats, getMessageFallback, locale, messageFormatCache, messagesOrError, namespace, onError, timeZone }: CreateBaseTranslatorProps<Messages>): {
|
|
23
|
-
<TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
24
|
-
rich: (key: string, values?: RichTranslationValues, formats?: Partial<Formats>) => string | ReactElement | ReactNodeArray;
|
|
25
|
-
raw(key: string): any;
|
|
26
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
1
|
-
import createFormatter from './createFormatter';
|
|
2
|
-
/** @deprecated Switch to `createFormatter` */
|
|
3
|
-
export default function createIntl(...args: Parameters<typeof createFormatter>): {
|
|
4
|
-
formatDateTime: (value: number | Date, formatOrOptions?: string | import("./DateTimeFormatOptions").default | undefined) => string;
|
|
5
|
-
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
6
|
-
formatRelativeTime: (date: number | Date, nowOrOptions?: number | Date | import("./RelativeTimeFormatOptions").default | undefined) => string;
|
|
7
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import Formats from './Formats';
|
|
2
|
-
import IntlConfig from './IntlConfig';
|
|
3
|
-
import TranslationValues from './TranslationValues';
|
|
4
|
-
import { CoreRichTranslationValues } from './createTranslatorImpl';
|
|
5
|
-
import MessageKeys from './utils/MessageKeys';
|
|
6
|
-
import NamespaceKeys from './utils/NamespaceKeys';
|
|
7
|
-
import NestedKeyOf from './utils/NestedKeyOf';
|
|
8
|
-
import NestedValueOf from './utils/NestedValueOf';
|
|
9
|
-
/**
|
|
10
|
-
* Translates messages from the given namespace by using the ICU syntax.
|
|
11
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax.
|
|
12
|
-
*
|
|
13
|
-
* If no namespace is provided, all available messages are returned.
|
|
14
|
-
* The namespace can also indicate nesting by using a dot
|
|
15
|
-
* (e.g. `namespace.Component`).
|
|
16
|
-
*/
|
|
17
|
-
export default function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({ getMessageFallback, messages, namespace, onError, ...rest }: Omit<IntlConfig<IntlMessages>, 'defaultTranslationValues' | 'messages'> & {
|
|
18
|
-
messages: NonNullable<IntlConfig<IntlMessages>['messages']>;
|
|
19
|
-
namespace?: NestedKey;
|
|
20
|
-
}): {
|
|
21
|
-
<TargetKey extends MessageKeys<NestedValueOf<{
|
|
22
|
-
'!': IntlMessages;
|
|
23
|
-
}, [
|
|
24
|
-
NestedKey
|
|
25
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
26
|
-
'!': IntlMessages;
|
|
27
|
-
}, [
|
|
28
|
-
NestedKey
|
|
29
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
30
|
-
rich<TargetKey extends MessageKeys<NestedValueOf<{
|
|
31
|
-
'!': IntlMessages;
|
|
32
|
-
}, [
|
|
33
|
-
NestedKey
|
|
34
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
35
|
-
'!': IntlMessages;
|
|
36
|
-
}, [
|
|
37
|
-
NestedKey
|
|
38
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: CoreRichTranslationValues, formats?: Partial<Formats>): string;
|
|
39
|
-
raw<TargetKey extends MessageKeys<NestedValueOf<{
|
|
40
|
-
'!': IntlMessages;
|
|
41
|
-
}, [
|
|
42
|
-
NestedKey
|
|
43
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
44
|
-
'!': IntlMessages;
|
|
45
|
-
}, [
|
|
46
|
-
NestedKey
|
|
47
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
|
|
48
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import AbstractIntlMessages from './AbstractIntlMessages';
|
|
2
|
-
import { InitializedIntlConfig } from './IntlConfig';
|
|
3
|
-
import { TranslationValue } from './TranslationValues';
|
|
4
|
-
import NestedKeyOf from './utils/NestedKeyOf';
|
|
5
|
-
export type CoreRichTranslationValues = Record<string, TranslationValue | ((chunks: string) => string)>;
|
|
6
|
-
export type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'messages'> & {
|
|
7
|
-
namespace: string;
|
|
8
|
-
messages: Messages;
|
|
9
|
-
};
|
|
10
|
-
export default function createTranslatorImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ getMessageFallback, messages, namespace, onError, ...rest }: CreateTranslatorImplProps<Messages>, namespacePrefix: string): {
|
|
11
|
-
(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;
|
|
12
|
-
rich(key: string, values: CoreRichTranslationValues, formats?: Partial<import("./Formats").default> | undefined): string;
|
|
13
|
-
raw: (key: string) => any;
|
|
14
|
-
};
|
package/dist/core/defaults.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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,34 +0,0 @@
|
|
|
1
|
-
import { inheritsLoose as _inheritsLoose, wrapNativeSuper as _wrapNativeSuper } from '../_virtual/use-intl.esm.js';
|
|
2
|
-
|
|
3
|
-
var IntlErrorCode;
|
|
4
|
-
(function (IntlErrorCode) {
|
|
5
|
-
IntlErrorCode["MISSING_MESSAGE"] = "MISSING_MESSAGE";
|
|
6
|
-
IntlErrorCode["MISSING_FORMAT"] = "MISSING_FORMAT";
|
|
7
|
-
IntlErrorCode["ENVIRONMENT_FALLBACK"] = "ENVIRONMENT_FALLBACK";
|
|
8
|
-
IntlErrorCode["INSUFFICIENT_PATH"] = "INSUFFICIENT_PATH";
|
|
9
|
-
IntlErrorCode["INVALID_MESSAGE"] = "INVALID_MESSAGE";
|
|
10
|
-
IntlErrorCode["INVALID_KEY"] = "INVALID_KEY";
|
|
11
|
-
IntlErrorCode["FORMATTING_ERROR"] = "FORMATTING_ERROR";
|
|
12
|
-
})(IntlErrorCode || (IntlErrorCode = {}));
|
|
13
|
-
var IntlError = /*#__PURE__*/function (_Error) {
|
|
14
|
-
_inheritsLoose(IntlError, _Error);
|
|
15
|
-
function IntlError(code, originalMessage) {
|
|
16
|
-
var _this;
|
|
17
|
-
var message = code;
|
|
18
|
-
if (originalMessage) {
|
|
19
|
-
message += ': ' + originalMessage;
|
|
20
|
-
}
|
|
21
|
-
_this = _Error.call(this, message) || this;
|
|
22
|
-
_this.code = void 0;
|
|
23
|
-
_this.originalMessage = void 0;
|
|
24
|
-
_this.code = code;
|
|
25
|
-
if (originalMessage) {
|
|
26
|
-
_this.originalMessage = originalMessage;
|
|
27
|
-
}
|
|
28
|
-
return _this;
|
|
29
|
-
}
|
|
30
|
-
return IntlError;
|
|
31
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
32
|
-
|
|
33
|
-
export { IntlErrorCode, IntlError as default };
|
|
34
|
-
//# sourceMappingURL=use-intl.esm.js.map
|