@localazy/strapi-plugin 1.0.3 → 1.0.8
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/_chunks/{App-CtS6CrNn.mjs → App-C0ogWaOz.mjs} +8 -4
- package/dist/_chunks/{App-NRmSxuW3.js → App-Dl58PZKy.js} +91 -87
- package/dist/_chunks/{ContentTransferSetup-CeKXlzw_.mjs → ContentTransferSetup-ClR8Nwv2.mjs} +41 -452
- package/dist/_chunks/{ContentTransferSetup-DGs8MZPj.js → ContentTransferSetup-DWQg9zDj.js} +91 -502
- package/dist/_chunks/{GlobalSettings-rOwd0Y0E.mjs → GlobalSettings-B_h5sPwa.mjs} +7 -4
- package/dist/_chunks/{GlobalSettings-CRMPRA3Y.js → GlobalSettings-BpY7BoXu.js} +43 -40
- package/dist/_chunks/{LanguagesSelector-Bd8VFHib.js → LanguagesSelector-Bfrsr3-P.js} +10 -8
- package/dist/_chunks/{LanguagesSelector-CeB7tVcb.mjs → LanguagesSelector-u9iDsQqB.mjs} +4 -2
- package/dist/_chunks/LocalazyPanel-BedTxk3C.js +83 -0
- package/dist/_chunks/LocalazyPanel-CuvdSJYx.mjs +83 -0
- package/dist/_chunks/LocalazyStatusColumn-955GpXAv.mjs +51 -0
- package/dist/_chunks/LocalazyStatusColumn-Bf1ntoc7.js +51 -0
- package/dist/_chunks/_commonjsHelpers-Bc2YnDe1.js +7 -0
- package/dist/_chunks/_commonjsHelpers-DWwsNxpa.mjs +8 -0
- package/dist/_chunks/en-CMWcM0nM.js +10 -0
- package/dist/_chunks/en-RX915msK.mjs +10 -0
- package/dist/_chunks/entry-exclusion-service-BlyFqyBY.mjs +60 -0
- package/dist/_chunks/entry-exclusion-service-bm-lp4za.js +60 -0
- package/dist/_chunks/{has-model-changed-gNSOSMBa.js → has-model-changed-B5SSh8XW.js} +4 -3
- package/dist/_chunks/{has-model-changed-DViUIQHk.mjs → has-model-changed-DIHY9LBA.mjs} +3 -2
- package/dist/_chunks/i18n-0dV2P-Hm.js +2378 -0
- package/dist/_chunks/i18n-RoETLXdU.mjs +2378 -0
- package/dist/_chunks/index-1he9s_bs.js +430 -0
- package/dist/_chunks/index-BIbKC7-V.mjs +432 -0
- package/dist/_chunks/{index-Dj68Ixl2.mjs → index-C15Goe6p.mjs} +120 -4
- package/dist/_chunks/{set-Cbi1yYuW.js → index-CaY3BYnQ.js} +878 -4379
- package/dist/_chunks/{set-Dnhh_SyE.mjs → index-DOCSzcPH.mjs} +907 -4409
- package/dist/_chunks/{index-Bbwk3kp3.js → index-Q3-srfXc.js} +142 -4
- package/dist/_chunks/initReactI18next-B0H8_DlW.js +60 -0
- package/dist/_chunks/initReactI18next-MHHxeg_9.mjs +61 -0
- package/dist/_chunks/{isEqual-CC-cEPwY.mjs → isEqual-BazjlHGf.mjs} +1 -1
- package/dist/_chunks/{isEqual-0M0aSdTT.js → isEqual-CrlZhAtq.js} +1 -1
- package/dist/_chunks/set-BRyy4Ra6.mjs +893 -0
- package/dist/_chunks/set-CmcBsVOP.js +891 -0
- package/dist/_chunks/useTranslation-BdIl-aLe.js +188 -0
- package/dist/_chunks/useTranslation-CZQ4lU1m.mjs +189 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LocalazyPanel.d.ts +4 -0
- package/dist/admin/src/components/LocalazyStatusColumn.d.ts +3 -0
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/modules/entry-exclusion/services/entry-exclusion-service.d.ts +18 -0
- package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +8 -0
- package/dist/server/index.js +234 -40
- package/dist/server/index.mjs +234 -40
- package/dist/server/src/controllers/entry-exclusion-controller.d.ts +21 -0
- package/dist/server/src/controllers/index.d.ts +7 -0
- package/dist/server/src/core/index.d.ts +6 -0
- package/dist/server/src/index.d.ts +15 -0
- package/dist/server/src/routes/entry-exclusion-routes.d.ts +9 -0
- package/dist/server/src/services/entry-exclusion-service.d.ts +23 -0
- package/dist/server/src/services/index.d.ts +8 -0
- package/dist/server/src/utils/drop-property-deep.d.ts +2 -0
- package/package.json +2 -2
- package/dist/_chunks/en-BTf8goGM.mjs +0 -8
- package/dist/_chunks/en-CRtsEFtl.js +0 -8
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require("react");
|
|
3
|
+
const initReactI18next = require("./initReactI18next-B0H8_DlW.js");
|
|
4
|
+
const warn = (i18n, code, msg, rest) => {
|
|
5
|
+
const args = [msg, {
|
|
6
|
+
code,
|
|
7
|
+
...rest || {}
|
|
8
|
+
}];
|
|
9
|
+
if (i18n?.services?.logger?.forward) {
|
|
10
|
+
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
11
|
+
}
|
|
12
|
+
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
13
|
+
if (i18n?.services?.logger?.warn) {
|
|
14
|
+
i18n.services.logger.warn(...args);
|
|
15
|
+
} else if (console?.warn) {
|
|
16
|
+
console.warn(...args);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const alreadyWarned = {};
|
|
20
|
+
const warnOnce = (i18n, code, msg, rest) => {
|
|
21
|
+
if (isString(msg) && alreadyWarned[msg]) return;
|
|
22
|
+
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
23
|
+
warn(i18n, code, msg, rest);
|
|
24
|
+
};
|
|
25
|
+
const loadedClb = (i18n, cb) => () => {
|
|
26
|
+
if (i18n.isInitialized) {
|
|
27
|
+
cb();
|
|
28
|
+
} else {
|
|
29
|
+
const initialized = () => {
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
i18n.off("initialized", initialized);
|
|
32
|
+
}, 0);
|
|
33
|
+
cb();
|
|
34
|
+
};
|
|
35
|
+
i18n.on("initialized", initialized);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const loadNamespaces = (i18n, ns, cb) => {
|
|
39
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
40
|
+
};
|
|
41
|
+
const loadLanguages = (i18n, lng, ns, cb) => {
|
|
42
|
+
if (isString(ns)) ns = [ns];
|
|
43
|
+
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
44
|
+
ns.forEach((n) => {
|
|
45
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
46
|
+
});
|
|
47
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
48
|
+
};
|
|
49
|
+
const hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
50
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
51
|
+
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
52
|
+
languages: i18n.languages
|
|
53
|
+
});
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
57
|
+
lng: options.lng,
|
|
58
|
+
precheck: (i18nInstance, loadNotPending) => {
|
|
59
|
+
if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const isString = (obj) => typeof obj === "string";
|
|
64
|
+
const isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
65
|
+
const I18nContext = React.createContext();
|
|
66
|
+
class ReportNamespaces {
|
|
67
|
+
constructor() {
|
|
68
|
+
this.usedNamespaces = {};
|
|
69
|
+
}
|
|
70
|
+
addUsedNamespaces(namespaces) {
|
|
71
|
+
namespaces.forEach((ns) => {
|
|
72
|
+
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
getUsedNamespaces() {
|
|
76
|
+
return Object.keys(this.usedNamespaces);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const usePrevious = (value, ignore) => {
|
|
80
|
+
const ref = React.useRef();
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
ref.current = value;
|
|
83
|
+
}, [value, ignore]);
|
|
84
|
+
return ref.current;
|
|
85
|
+
};
|
|
86
|
+
const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
|
|
87
|
+
const useMemoizedT = (i18n, language, namespace, keyPrefix) => React.useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
88
|
+
const useTranslation = (ns, props = {}) => {
|
|
89
|
+
const {
|
|
90
|
+
i18n: i18nFromProps
|
|
91
|
+
} = props;
|
|
92
|
+
const {
|
|
93
|
+
i18n: i18nFromContext,
|
|
94
|
+
defaultNS: defaultNSFromContext
|
|
95
|
+
} = React.useContext(I18nContext) || {};
|
|
96
|
+
const i18n = i18nFromProps || i18nFromContext || initReactI18next.getI18n();
|
|
97
|
+
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
98
|
+
if (!i18n) {
|
|
99
|
+
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
100
|
+
const notReadyT = (k, optsOrDefaultValue) => {
|
|
101
|
+
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
102
|
+
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
103
|
+
return Array.isArray(k) ? k[k.length - 1] : k;
|
|
104
|
+
};
|
|
105
|
+
const retNotReady = [notReadyT, {}, false];
|
|
106
|
+
retNotReady.t = notReadyT;
|
|
107
|
+
retNotReady.i18n = {};
|
|
108
|
+
retNotReady.ready = false;
|
|
109
|
+
return retNotReady;
|
|
110
|
+
}
|
|
111
|
+
if (i18n.options.react?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
112
|
+
const i18nOptions = {
|
|
113
|
+
...initReactI18next.getDefaults(),
|
|
114
|
+
...i18n.options.react,
|
|
115
|
+
...props
|
|
116
|
+
};
|
|
117
|
+
const {
|
|
118
|
+
useSuspense,
|
|
119
|
+
keyPrefix
|
|
120
|
+
} = i18nOptions;
|
|
121
|
+
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
|
|
122
|
+
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
123
|
+
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
|
|
124
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
125
|
+
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
126
|
+
const getT = () => memoGetT;
|
|
127
|
+
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
128
|
+
const [t, setT] = React.useState(getT);
|
|
129
|
+
let joinedNS = namespaces.join();
|
|
130
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
131
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
132
|
+
const isMounted = React.useRef(true);
|
|
133
|
+
React.useEffect(() => {
|
|
134
|
+
const {
|
|
135
|
+
bindI18n,
|
|
136
|
+
bindI18nStore
|
|
137
|
+
} = i18nOptions;
|
|
138
|
+
isMounted.current = true;
|
|
139
|
+
if (!ready && !useSuspense) {
|
|
140
|
+
if (props.lng) {
|
|
141
|
+
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
142
|
+
if (isMounted.current) setT(getNewT);
|
|
143
|
+
});
|
|
144
|
+
} else {
|
|
145
|
+
loadNamespaces(i18n, namespaces, () => {
|
|
146
|
+
if (isMounted.current) setT(getNewT);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
151
|
+
setT(getNewT);
|
|
152
|
+
}
|
|
153
|
+
const boundReset = () => {
|
|
154
|
+
if (isMounted.current) setT(getNewT);
|
|
155
|
+
};
|
|
156
|
+
if (bindI18n) i18n?.on(bindI18n, boundReset);
|
|
157
|
+
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
158
|
+
return () => {
|
|
159
|
+
isMounted.current = false;
|
|
160
|
+
if (i18n) bindI18n?.split(" ").forEach((e) => i18n.off(e, boundReset));
|
|
161
|
+
if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e) => i18n.store.off(e, boundReset));
|
|
162
|
+
};
|
|
163
|
+
}, [i18n, joinedNS]);
|
|
164
|
+
React.useEffect(() => {
|
|
165
|
+
if (isMounted.current && ready) {
|
|
166
|
+
setT(getT);
|
|
167
|
+
}
|
|
168
|
+
}, [i18n, keyPrefix, ready]);
|
|
169
|
+
const ret = [t, i18n, ready];
|
|
170
|
+
ret.t = t;
|
|
171
|
+
ret.i18n = i18n;
|
|
172
|
+
ret.ready = ready;
|
|
173
|
+
if (ready) return ret;
|
|
174
|
+
if (!ready && !useSuspense) return ret;
|
|
175
|
+
throw new Promise((resolve) => {
|
|
176
|
+
if (props.lng) {
|
|
177
|
+
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
178
|
+
} else {
|
|
179
|
+
loadNamespaces(i18n, namespaces, () => resolve());
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
exports.I18nContext = I18nContext;
|
|
184
|
+
exports.isObject = isObject;
|
|
185
|
+
exports.isString = isString;
|
|
186
|
+
exports.useTranslation = useTranslation;
|
|
187
|
+
exports.warn = warn;
|
|
188
|
+
exports.warnOnce = warnOnce;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { createContext, useContext, useCallback, useState, useRef, useEffect } from "react";
|
|
2
|
+
import { g as getI18n, a as getDefaults } from "./initReactI18next-MHHxeg_9.mjs";
|
|
3
|
+
const warn = (i18n, code, msg, rest) => {
|
|
4
|
+
const args = [msg, {
|
|
5
|
+
code,
|
|
6
|
+
...rest || {}
|
|
7
|
+
}];
|
|
8
|
+
if (i18n?.services?.logger?.forward) {
|
|
9
|
+
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
10
|
+
}
|
|
11
|
+
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
12
|
+
if (i18n?.services?.logger?.warn) {
|
|
13
|
+
i18n.services.logger.warn(...args);
|
|
14
|
+
} else if (console?.warn) {
|
|
15
|
+
console.warn(...args);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const alreadyWarned = {};
|
|
19
|
+
const warnOnce = (i18n, code, msg, rest) => {
|
|
20
|
+
if (isString(msg) && alreadyWarned[msg]) return;
|
|
21
|
+
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
22
|
+
warn(i18n, code, msg, rest);
|
|
23
|
+
};
|
|
24
|
+
const loadedClb = (i18n, cb) => () => {
|
|
25
|
+
if (i18n.isInitialized) {
|
|
26
|
+
cb();
|
|
27
|
+
} else {
|
|
28
|
+
const initialized = () => {
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
i18n.off("initialized", initialized);
|
|
31
|
+
}, 0);
|
|
32
|
+
cb();
|
|
33
|
+
};
|
|
34
|
+
i18n.on("initialized", initialized);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const loadNamespaces = (i18n, ns, cb) => {
|
|
38
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
39
|
+
};
|
|
40
|
+
const loadLanguages = (i18n, lng, ns, cb) => {
|
|
41
|
+
if (isString(ns)) ns = [ns];
|
|
42
|
+
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
43
|
+
ns.forEach((n) => {
|
|
44
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
45
|
+
});
|
|
46
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
47
|
+
};
|
|
48
|
+
const hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
49
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
50
|
+
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
51
|
+
languages: i18n.languages
|
|
52
|
+
});
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
56
|
+
lng: options.lng,
|
|
57
|
+
precheck: (i18nInstance, loadNotPending) => {
|
|
58
|
+
if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const isString = (obj) => typeof obj === "string";
|
|
63
|
+
const isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
64
|
+
const I18nContext = createContext();
|
|
65
|
+
class ReportNamespaces {
|
|
66
|
+
constructor() {
|
|
67
|
+
this.usedNamespaces = {};
|
|
68
|
+
}
|
|
69
|
+
addUsedNamespaces(namespaces) {
|
|
70
|
+
namespaces.forEach((ns) => {
|
|
71
|
+
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
getUsedNamespaces() {
|
|
75
|
+
return Object.keys(this.usedNamespaces);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const usePrevious = (value, ignore) => {
|
|
79
|
+
const ref = useRef();
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
ref.current = value;
|
|
82
|
+
}, [value, ignore]);
|
|
83
|
+
return ref.current;
|
|
84
|
+
};
|
|
85
|
+
const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
|
|
86
|
+
const useMemoizedT = (i18n, language, namespace, keyPrefix) => useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
87
|
+
const useTranslation = (ns, props = {}) => {
|
|
88
|
+
const {
|
|
89
|
+
i18n: i18nFromProps
|
|
90
|
+
} = props;
|
|
91
|
+
const {
|
|
92
|
+
i18n: i18nFromContext,
|
|
93
|
+
defaultNS: defaultNSFromContext
|
|
94
|
+
} = useContext(I18nContext) || {};
|
|
95
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
96
|
+
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
97
|
+
if (!i18n) {
|
|
98
|
+
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
99
|
+
const notReadyT = (k, optsOrDefaultValue) => {
|
|
100
|
+
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
101
|
+
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
102
|
+
return Array.isArray(k) ? k[k.length - 1] : k;
|
|
103
|
+
};
|
|
104
|
+
const retNotReady = [notReadyT, {}, false];
|
|
105
|
+
retNotReady.t = notReadyT;
|
|
106
|
+
retNotReady.i18n = {};
|
|
107
|
+
retNotReady.ready = false;
|
|
108
|
+
return retNotReady;
|
|
109
|
+
}
|
|
110
|
+
if (i18n.options.react?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
111
|
+
const i18nOptions = {
|
|
112
|
+
...getDefaults(),
|
|
113
|
+
...i18n.options.react,
|
|
114
|
+
...props
|
|
115
|
+
};
|
|
116
|
+
const {
|
|
117
|
+
useSuspense,
|
|
118
|
+
keyPrefix
|
|
119
|
+
} = i18nOptions;
|
|
120
|
+
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
|
|
121
|
+
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
122
|
+
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
|
|
123
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
124
|
+
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
125
|
+
const getT = () => memoGetT;
|
|
126
|
+
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
127
|
+
const [t, setT] = useState(getT);
|
|
128
|
+
let joinedNS = namespaces.join();
|
|
129
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
130
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
131
|
+
const isMounted = useRef(true);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const {
|
|
134
|
+
bindI18n,
|
|
135
|
+
bindI18nStore
|
|
136
|
+
} = i18nOptions;
|
|
137
|
+
isMounted.current = true;
|
|
138
|
+
if (!ready && !useSuspense) {
|
|
139
|
+
if (props.lng) {
|
|
140
|
+
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
141
|
+
if (isMounted.current) setT(getNewT);
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
loadNamespaces(i18n, namespaces, () => {
|
|
145
|
+
if (isMounted.current) setT(getNewT);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
150
|
+
setT(getNewT);
|
|
151
|
+
}
|
|
152
|
+
const boundReset = () => {
|
|
153
|
+
if (isMounted.current) setT(getNewT);
|
|
154
|
+
};
|
|
155
|
+
if (bindI18n) i18n?.on(bindI18n, boundReset);
|
|
156
|
+
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
157
|
+
return () => {
|
|
158
|
+
isMounted.current = false;
|
|
159
|
+
if (i18n) bindI18n?.split(" ").forEach((e) => i18n.off(e, boundReset));
|
|
160
|
+
if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e) => i18n.store.off(e, boundReset));
|
|
161
|
+
};
|
|
162
|
+
}, [i18n, joinedNS]);
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (isMounted.current && ready) {
|
|
165
|
+
setT(getT);
|
|
166
|
+
}
|
|
167
|
+
}, [i18n, keyPrefix, ready]);
|
|
168
|
+
const ret = [t, i18n, ready];
|
|
169
|
+
ret.t = t;
|
|
170
|
+
ret.i18n = i18n;
|
|
171
|
+
ret.ready = ready;
|
|
172
|
+
if (ready) return ret;
|
|
173
|
+
if (!ready && !useSuspense) return ret;
|
|
174
|
+
throw new Promise((resolve) => {
|
|
175
|
+
if (props.lng) {
|
|
176
|
+
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
177
|
+
} else {
|
|
178
|
+
loadNamespaces(i18n, namespaces, () => resolve());
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
export {
|
|
183
|
+
I18nContext as I,
|
|
184
|
+
warn as a,
|
|
185
|
+
isObject as b,
|
|
186
|
+
isString as i,
|
|
187
|
+
useTranslation as u,
|
|
188
|
+
warnOnce as w
|
|
189
|
+
};
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default class EntryExclusionService {
|
|
2
|
+
/**
|
|
3
|
+
* Get entry exclusion state for a specific entry
|
|
4
|
+
*/
|
|
5
|
+
static getEntryExclusion(contentType: string, documentId: string): Promise<boolean>;
|
|
6
|
+
/**
|
|
7
|
+
* Set entry exclusion state for a specific entry
|
|
8
|
+
*/
|
|
9
|
+
static setEntryExclusion(contentType: string, documentId: string, isExcluded: boolean): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Set exclusion state for multiple entries
|
|
12
|
+
*/
|
|
13
|
+
static setMultipleEntriesExclusion(contentType: string, documentIds: string[], isExcluded: boolean): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Get all excluded entries for a content type
|
|
16
|
+
*/
|
|
17
|
+
static getContentTypeExclusions(contentType: string): Promise<string[]>;
|
|
18
|
+
}
|
|
@@ -48,5 +48,13 @@ declare const _default: {
|
|
|
48
48
|
tree_item_count_one: string;
|
|
49
49
|
tree_item_count_other: string;
|
|
50
50
|
general: string;
|
|
51
|
+
exclude_from_translation: string;
|
|
52
|
+
bulk_action_exclude_from_translation: string;
|
|
53
|
+
bulk_action_updating_entries: string;
|
|
54
|
+
bulk_action_failed_message: string;
|
|
55
|
+
bulk_action_success_message: string;
|
|
56
|
+
bulk_action_include_to_translation: string;
|
|
57
|
+
status_excluded: string;
|
|
58
|
+
status_included: string;
|
|
51
59
|
};
|
|
52
60
|
export default _default;
|