@justanarthur/payload-plugin-translator 3.4.0 → 3.4.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/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
isTranslateMode,
|
|
9
9
|
createTranslateTask2,
|
|
10
10
|
createTranslateWorkflow2
|
|
11
|
-
} from "./shared/chunk-
|
|
11
|
+
} from "./shared/chunk-2vkxapbb.js";
|
|
12
12
|
import"./shared/chunk-m5jdmn2w.js";
|
|
13
13
|
import {
|
|
14
14
|
readLocales,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
hasTranslateWorkflow,
|
|
17
17
|
queueBulkTranslation,
|
|
18
18
|
runQueuedTranslations
|
|
19
|
-
} from "./shared/chunk-
|
|
19
|
+
} from "./shared/chunk-0d3gtdzw.js";
|
|
20
20
|
import {
|
|
21
21
|
TRANSLATION_STATUS_SLUG2,
|
|
22
22
|
REVIEW_VIEW_PATH
|
package/dist/jobs.js
CHANGED
package/dist/rsc.js
CHANGED
|
@@ -97,12 +97,11 @@ var reviewEntity = (config, source, targetByLocale, targetLocales, hash, rowByLo
|
|
|
97
97
|
const crossLocale = buildCrossLocaleTexts(fieldsPerLocale);
|
|
98
98
|
return Object.fromEntries(fieldsPerLocale.map(({ locale, fields }) => {
|
|
99
99
|
const row = rowByLocale(locale);
|
|
100
|
-
|
|
100
|
+
return [locale, {
|
|
101
101
|
...computeStatus(fields, { locale, check, crossLocale }),
|
|
102
102
|
stale: Boolean(row?.sourceHash) && row?.sourceHash !== hash,
|
|
103
103
|
reviewed: Boolean(row?.reviewedHash) && row?.reviewedHash === hash
|
|
104
|
-
};
|
|
105
|
-
return [locale, review];
|
|
104
|
+
}];
|
|
106
105
|
}));
|
|
107
106
|
};
|
|
108
107
|
var labelOf = (config, doc) => {
|
|
@@ -149,12 +148,13 @@ var loadCollectionReview = async ({ req, collectionSlug, page = 1, limit = 25 })
|
|
|
149
148
|
const source = doc;
|
|
150
149
|
const key = entityKey({ collectionSlug, id: source.id });
|
|
151
150
|
const hash = hashOf(config, source, req);
|
|
151
|
+
const byLocale = reviewEntity(config, source, Object.fromEntries(targetLocales.map((locale) => [locale, targets[locale].get(String(source.id))])), targetLocales, hash, (locale) => rows.find((row) => row.entity === key && row.locale === locale), req, check);
|
|
152
152
|
return {
|
|
153
153
|
key,
|
|
154
154
|
label: labelOf(config, source),
|
|
155
155
|
collectionSlug,
|
|
156
156
|
id: source.id,
|
|
157
|
-
locales:
|
|
157
|
+
locales: Object.fromEntries(Object.entries(byLocale).map(([locale, { fields: _fields, ...review }]) => [locale, review]))
|
|
158
158
|
};
|
|
159
159
|
});
|
|
160
160
|
return {
|
|
@@ -189,7 +189,8 @@ var loadGlobalsReview = async ({ req, globalSlugs }) => {
|
|
|
189
189
|
for (const locale of targetLocales) {
|
|
190
190
|
targetByLocale[locale] = await read(locale);
|
|
191
191
|
}
|
|
192
|
-
const
|
|
192
|
+
const reviews = reviewEntity(config, source, targetByLocale, targetLocales, hash, (locale) => rows.find((row) => row.entity === key && row.locale === locale), req, check);
|
|
193
|
+
const locales = Object.fromEntries(Object.entries(reviews).map(([locale, { fields: _fields, ...review }]) => [locale, review]));
|
|
193
194
|
entities.push({ key, label: globalLabel(config), globalSlug, locales });
|
|
194
195
|
}
|
|
195
196
|
return { entities, locales: targetLocales };
|
|
@@ -170,7 +170,7 @@ var translateOperation2 = async (args) => {
|
|
|
170
170
|
const detectionOn = args.retranslateIdentical && req.payload.config.custom?.translator?.languageDetection !== false;
|
|
171
171
|
const wrongLanguageCheck = detectionOn ? await loadWrongLanguageCheck(localeCodes(req)) : null;
|
|
172
172
|
const crossLocale = detectionOn ? await buildCrossLocaleTextsFor({ config, dataFrom, req, args }) : undefined;
|
|
173
|
-
const isWrongLanguage = wrongLanguageCheck || crossLocale ? (target, path) => Boolean(wrongLanguageCheck?.(plainText(target), args.locale)) || (
|
|
173
|
+
const isWrongLanguage = wrongLanguageCheck || crossLocale ? (target, path) => Boolean(wrongLanguageCheck?.(plainText(target), args.locale)) || Boolean(crossLocale && path && crossLocaleMatch(crossLocale, path, args.locale, plainText(target))) : undefined;
|
|
174
174
|
traverseFields({
|
|
175
175
|
dataFrom,
|
|
176
176
|
emptyOnly: args.emptyOnly,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justanarthur/payload-plugin-translator",
|
|
3
3
|
"description": "Translator plugin for Payload CMS — automatic localization via Google, OpenAI, LibreTranslate, or custom resolvers.",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
7
7
|
"files": [
|