@panneau/intl 4.0.41 → 4.0.48
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/dist/index.d.ts +3 -2
- package/dist/index.js +68 -42
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import { IntlConfig } from 'react-intl';
|
|
3
4
|
import { Resource, ResourceValues } from '@panneau/core';
|
|
4
5
|
|
|
5
6
|
declare class IntlManager {
|
|
@@ -10,14 +11,14 @@ declare class IntlManager {
|
|
|
10
11
|
getMessages(locale: any): any;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
interface IntlProviderProps {
|
|
14
|
+
interface IntlProviderProps extends Omit<IntlConfig, 'locale' | 'messages'> {
|
|
14
15
|
intlManager?: IntlManager;
|
|
15
16
|
locale?: string | null;
|
|
16
17
|
locales?: string[] | null;
|
|
17
18
|
extraMessages?: Record<string, string> | null;
|
|
18
19
|
children?: ReactNode;
|
|
19
20
|
}
|
|
20
|
-
declare function IntlProvider({ intlManager, locale, locales, children, extraMessages, }: IntlProviderProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
declare function IntlProvider({ intlManager, locale, locales, children, extraMessages, ...props }: IntlProviderProps): react_jsx_runtime.JSX.Element;
|
|
21
22
|
|
|
22
23
|
interface ResourceIntlConfig {
|
|
23
24
|
values?: Record<string, unknown>;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { use } from 'react';
|
|
3
3
|
import { IntlContext, IntlProvider as IntlProvider$1, useIntl, FormattedMessage } from 'react-intl';
|
|
4
4
|
import { useLocales, LocalesProvider, useResource } from '@panneau/core/contexts';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -35,14 +35,37 @@ class IntlManager {
|
|
|
35
35
|
const intlManager = new IntlManager();
|
|
36
36
|
|
|
37
37
|
function IntlProvider(t0) {
|
|
38
|
-
const $ = c(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const $ = c(22);
|
|
39
|
+
let props;
|
|
40
|
+
let t1;
|
|
41
|
+
let t2;
|
|
42
|
+
let t3;
|
|
43
|
+
let t4;
|
|
44
|
+
let t5;
|
|
45
|
+
if ($[0] !== t0) {
|
|
46
|
+
({
|
|
47
|
+
intlManager: t1,
|
|
48
|
+
locale: t2,
|
|
49
|
+
locales: t3,
|
|
50
|
+
children: t4,
|
|
51
|
+
extraMessages: t5,
|
|
52
|
+
...props
|
|
53
|
+
} = t0);
|
|
54
|
+
$[0] = t0;
|
|
55
|
+
$[1] = props;
|
|
56
|
+
$[2] = t1;
|
|
57
|
+
$[3] = t2;
|
|
58
|
+
$[4] = t3;
|
|
59
|
+
$[5] = t4;
|
|
60
|
+
$[6] = t5;
|
|
61
|
+
} else {
|
|
62
|
+
props = $[1];
|
|
63
|
+
t1 = $[2];
|
|
64
|
+
t2 = $[3];
|
|
65
|
+
t3 = $[4];
|
|
66
|
+
t4 = $[5];
|
|
67
|
+
t5 = $[6];
|
|
68
|
+
}
|
|
46
69
|
const intlManager$1 = t1 === undefined ? intlManager : t1;
|
|
47
70
|
const locale = t2 === undefined ? null : t2;
|
|
48
71
|
const locales = t3 === undefined ? null : t3;
|
|
@@ -52,63 +75,66 @@ function IntlProvider(t0) {
|
|
|
52
75
|
const {
|
|
53
76
|
locale: t6,
|
|
54
77
|
messages: t7
|
|
55
|
-
} =
|
|
78
|
+
} = use(IntlContext) || {};
|
|
56
79
|
const previousLocale = t6 === undefined ? null : t6;
|
|
57
80
|
const previousMessages = t7 === undefined ? null : t7;
|
|
58
81
|
let t8;
|
|
59
|
-
if ($[
|
|
82
|
+
if ($[7] !== intlManager$1 || $[8] !== locale) {
|
|
60
83
|
t8 = intlManager$1 !== null ? intlManager$1.getMessages(locale) : null;
|
|
61
|
-
$[
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
84
|
+
$[7] = intlManager$1;
|
|
85
|
+
$[8] = locale;
|
|
86
|
+
$[9] = t8;
|
|
64
87
|
} else {
|
|
65
|
-
t8 = $[
|
|
88
|
+
t8 = $[9];
|
|
66
89
|
}
|
|
67
90
|
const managerMessages = t8;
|
|
68
|
-
const t9 = previousLocale === locale ? previousMessages : null;
|
|
91
|
+
const t9 = previousLocale === locale || locale === null ? previousMessages : null;
|
|
69
92
|
let t10;
|
|
70
|
-
if ($[
|
|
93
|
+
if ($[10] !== extraMessages || $[11] !== managerMessages || $[12] !== t9) {
|
|
71
94
|
t10 = {
|
|
72
95
|
...t9,
|
|
73
96
|
...managerMessages,
|
|
74
97
|
...extraMessages
|
|
75
98
|
};
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
99
|
+
$[10] = extraMessages;
|
|
100
|
+
$[11] = managerMessages;
|
|
101
|
+
$[12] = t9;
|
|
102
|
+
$[13] = t10;
|
|
80
103
|
} else {
|
|
81
|
-
t10 = $[
|
|
104
|
+
t10 = $[13];
|
|
82
105
|
}
|
|
83
106
|
const messages = t10;
|
|
84
|
-
const t11 =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
107
|
+
const t11 = locale || previousLocale;
|
|
108
|
+
const t12 = locales || previousLocales;
|
|
109
|
+
let t13;
|
|
110
|
+
if ($[14] !== children || $[15] !== t12) {
|
|
111
|
+
t13 = /*#__PURE__*/jsx(LocalesProvider, {
|
|
112
|
+
locales: t12,
|
|
89
113
|
children: children
|
|
90
114
|
});
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
115
|
+
$[14] = children;
|
|
116
|
+
$[15] = t12;
|
|
117
|
+
$[16] = t13;
|
|
94
118
|
} else {
|
|
95
|
-
|
|
119
|
+
t13 = $[16];
|
|
96
120
|
}
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
100
|
-
locale:
|
|
121
|
+
let t14;
|
|
122
|
+
if ($[17] !== messages || $[18] !== props || $[19] !== t11 || $[20] !== t13) {
|
|
123
|
+
t14 = /*#__PURE__*/jsx(IntlProvider$1, {
|
|
124
|
+
locale: t11,
|
|
101
125
|
messages: messages,
|
|
102
|
-
|
|
126
|
+
...props,
|
|
127
|
+
children: t13
|
|
103
128
|
});
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
129
|
+
$[17] = messages;
|
|
130
|
+
$[18] = props;
|
|
131
|
+
$[19] = t11;
|
|
132
|
+
$[20] = t13;
|
|
133
|
+
$[21] = t14;
|
|
108
134
|
} else {
|
|
109
|
-
|
|
135
|
+
t14 = $[21];
|
|
110
136
|
}
|
|
111
|
-
return
|
|
137
|
+
return t14;
|
|
112
138
|
}
|
|
113
139
|
|
|
114
140
|
function ResourceMessage(t0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/intl",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.48",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@babel/runtime": "^7.28.6",
|
|
68
68
|
"@formatjs/cli-lib": "^6.6.6",
|
|
69
|
-
"@panneau/core": "^4.0.
|
|
69
|
+
"@panneau/core": "^4.0.48",
|
|
70
70
|
"commander": "^12.0.0",
|
|
71
71
|
"fs-extra": "^11.2.0",
|
|
72
72
|
"gettext-parser": "^7.0.1",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "668d90a05a094fe55fcea760df3f9c294c6cbb31"
|
|
86
86
|
}
|