@nocode-factory/sanity-kit 2.65.0-rc.4 → 2.65.0-rc.6
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/CHANGELOG.md +20 -0
- package/bin/ncf-kit.mjs +99 -1
- package/bin/translation-audit.mjs +39 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +82 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/PropagatePublish.tsx +25 -1
- package/src/lib/linkedTranslations.ts +51 -0
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -39,6 +39,21 @@
|
|
|
39
39
|
- **Source affichée sous un slug « To translate »** : le slug de la version principale (il
|
|
40
40
|
s'affichait « vide »).
|
|
41
41
|
- **`doctor` nomme les pages** sans version ou seulement en brouillon (5 au plus).
|
|
42
|
+
- **Page liée sans version dans la langue** : la fenêtre de propagation le dit AVANT de
|
|
43
|
+
créer la version (« Links to 1 page with no published EN version (« Page cible ») : this
|
|
44
|
+
version can be saved as a draft, but not published until that page is translated »).
|
|
45
|
+
Page volontairement non traduite : dans la version de cette langue, lien de type URL vers
|
|
46
|
+
son adresse (règle « viser exprès une autre langue ») ou lien retiré. Avant, la version se
|
|
47
|
+
créait puis refusait d'être publiée, sans explication (vu sur JAF).
|
|
48
|
+
- **`doctor` : traductions faites avant la 2.65.0**, que la mise à jour ne corrige pas :
|
|
49
|
+
⚠ « ancres traduites » (ancre différente de la version principale, liens cassés) et ⚠
|
|
50
|
+
« textes alternatifs » (identiques à la version principale, donc non traduits), page par
|
|
51
|
+
page, sous le titre de la version TRADUITE. Sur Société Paul Ricard : 47 versions
|
|
52
|
+
anglaises avec des textes alternatifs en français.
|
|
53
|
+
- **`npx ncf-kit translations audit [--apply]`** : le détail (chemin, valeur actuelle, valeur
|
|
54
|
+
attendue) ; `--apply` corrige EN BROUILLON (rien n'est publié) : ancres remises à celle de
|
|
55
|
+
la version principale (règle : une ancre ne se traduit jamais), textes alternatifs marqués
|
|
56
|
+
« To translate » pour Pages → Languages → « Unfinished translations, retry ».
|
|
42
57
|
- **Textes rendus à l'identique par l'IA** (noms propres, marques) : comptés comme
|
|
43
58
|
traduits, plus reproposés sans fin, et signalés « à vérifier » (vu sur JAF : 12 textes).
|
|
44
59
|
- **`doctor`, « Langues : contenus »** : une langue ne compte que si sa version est
|
|
@@ -49,6 +64,11 @@
|
|
|
49
64
|
### À brancher dans le projet
|
|
50
65
|
|
|
51
66
|
- Rien dans le code. Redéployer le Studio (`npm run deploy`).
|
|
67
|
+
- Si `doctor` affiche ⚠ « ancres traduites » ou « textes alternatifs » : depuis studio/,
|
|
68
|
+
`npx ncf-kit translations audit` (liste), puis `--apply` (brouillons), puis Pages →
|
|
69
|
+
Languages → « Unfinished translations, retry », relire et publier chaque version.
|
|
70
|
+
- CLAUDE.md du starter : règle « une ancre ne se traduit jamais » (rubrique ANCRES DE
|
|
71
|
+
SECTION) ; la reprendre.
|
|
52
72
|
- CLAUDE.md du starter : rubriques PROPAGATION ET TRADUCTION PAR IA et « Ajouter une
|
|
53
73
|
langue » mises à jour (brouillons à relire, puis publier) ; les reprendre.
|
|
54
74
|
|
package/bin/ncf-kit.mjs
CHANGED
|
@@ -42,6 +42,7 @@ function usage(code = 0) {
|
|
|
42
42
|
npx ncf-kit translate-json [--from <langue>] [--apply] textes du site (messages/<langue>.json, titres du registre) traduits par IA
|
|
43
43
|
npx ncf-kit translations [export] [--out <fichier>] champs « À traduire » → JSON (texte source et actuel)
|
|
44
44
|
npx ncf-kit translations apply <fichier> écrit les traductions dans les brouillons
|
|
45
|
+
npx ncf-kit translations audit [--apply] ancres traduites, textes alternatifs non traduits (--apply : corrige en brouillon)
|
|
45
46
|
npx ncf-kit item-types [--apply] éléments de liste sans _type (écrits par script) ; --apply corrige
|
|
46
47
|
|
|
47
48
|
Depuis le dossier du studio (celui de sanity.config.ts et de .env).
|
|
@@ -668,6 +669,38 @@ async function doctor() {
|
|
|
668
669
|
.join(' ; ')} : Studio → Pages → Languages (« Translate with AI », brouillons à relire), puis publier chaque version.`,
|
|
669
670
|
)
|
|
670
671
|
: ok('Langues : contenus', `${sources.length} document(s) ${main.toUpperCase()}, chacun publié dans ${locales.length - 1} autre(s) langue(s)`)
|
|
672
|
+
// Traductions faites avant le kit 2.65.0 : ancres traduites (liens cassés) et
|
|
673
|
+
// textes alternatifs restés dans la langue principale. Une mise à jour du kit ne les
|
|
674
|
+
// corrige pas : on les nomme, page par page, pour que l'équipe les reprenne.
|
|
675
|
+
{
|
|
676
|
+
const {auditTranslation} = await import('./translation-audit.mjs')
|
|
677
|
+
const pairs = []
|
|
678
|
+
for (const m of metas) {
|
|
679
|
+
const refs = m.refs ?? []
|
|
680
|
+
const master = refs.find((r) => r.lang === main)
|
|
681
|
+
if (master) for (const r of refs) if (r.lang !== main && published.has(r.id)) pairs.push([master.id, r.id, r.lang])
|
|
682
|
+
}
|
|
683
|
+
const ids = [...new Set(pairs.flatMap(([a, b]) => [a, b]))].slice(0, 600)
|
|
684
|
+
const docs = ids.length ? ((await q(`*[_id in $ids]`, {ids})) ?? []) : []
|
|
685
|
+
const byId = new Map(docs.map((d) => [d._id, d]))
|
|
686
|
+
const anchorPages = []
|
|
687
|
+
const altPages = []
|
|
688
|
+
for (const [a, b, lang] of pairs) {
|
|
689
|
+
if (!byId.has(a) || !byId.has(b)) continue
|
|
690
|
+
const {anchors, alts} = auditTranslation(byId.get(a), byId.get(b))
|
|
691
|
+
const doc = byId.get(b)
|
|
692
|
+
// Titre de la version TRADUITE (« Middle school »), celui qu'on cherche dans l'onglet Pages.
|
|
693
|
+
const label = doc._type === 'componentDefaults' ? 'Component defaults' : (doc.title ?? doc.name ?? titles.get(a) ?? b)
|
|
694
|
+
const name = `${lang.toUpperCase()} « ${label} »`
|
|
695
|
+
if (anchors.length) anchorPages.push(`${name} (${anchors.length})`)
|
|
696
|
+
if (alts.length) altPages.push(`${name} (${alts.length})`)
|
|
697
|
+
}
|
|
698
|
+
const list = (pages) => `${pages.slice(0, 20).join(', ')}${pages.length > 20 ? `, +${pages.length - 20}` : ''}`
|
|
699
|
+
if (anchorPages.length)
|
|
700
|
+
warn('Langues : ancres traduites', `${anchorPages.length} version(s) traduite(s) dont une ancre diffère de la version principale (traduite par l'IA avant le kit 2.65.0 : les liens qui la visent sont cassés) : ${list(anchorPages)}. Détail et correction en brouillon : npx ncf-kit translations audit, puis --apply ; relire et publier.`)
|
|
701
|
+
if (altPages.length)
|
|
702
|
+
warn('Langues : textes alternatifs', `${altPages.length} version(s) traduite(s) avec des textes alternatifs d'images identiques à la version principale (non traduits avant le kit 2.65.0 ; un nom propre peut rester identique) : ${list(altPages)}. Détail : npx ncf-kit translations audit ; --apply les marque « To translate », puis Pages → Languages → « Unfinished translations, retry » (brouillons), relire et publier.`)
|
|
703
|
+
}
|
|
671
704
|
// Textes « To translate » en attente (échec de l'IA, texte gardé à la main...).
|
|
672
705
|
const todos = (await q(`*[_type == "ncfTranslationTodo" && count(paths) > 0]{"n": count(paths)}`)) ?? []
|
|
673
706
|
const pending = todos.reduce((n, t) => n + (t.n ?? 0), 0)
|
|
@@ -981,7 +1014,72 @@ async function translations() {
|
|
|
981
1014
|
console.log(`\n${written} champ(s) écrit(s). Rien n'est publié : relire puis publier chaque langue dans le Studio.`)
|
|
982
1015
|
return
|
|
983
1016
|
}
|
|
984
|
-
|
|
1017
|
+
// AUDIT des traductions faites avant le kit 2.65.0 (kit >= 2.65.0) : ancres différentes
|
|
1018
|
+
// de la version principale (règle : une section garde l'ancre du master dans toutes les
|
|
1019
|
+
// langues) et textes alternatifs d'images identiques (non traduits). Sans --apply : liste.
|
|
1020
|
+
// Avec --apply, en BROUILLON seulement (rien n'est publié) : ancres remises à la valeur de
|
|
1021
|
+
// la version principale ; textes alternatifs marqués « To translate », à traduire par
|
|
1022
|
+
// Studio → Pages → Languages → « Unfinished translations, retry », puis relire et publier.
|
|
1023
|
+
if (sub === 'audit') {
|
|
1024
|
+
const {auditTranslation} = await import('./translation-audit.mjs')
|
|
1025
|
+
const locales = String(env.SANITY_STUDIO_LOCALES ?? process.env.SANITY_STUDIO_LOCALES ?? '').split(',').map((l) => l.trim()).filter(Boolean)
|
|
1026
|
+
if (locales.length < 2) fail('SANITY_STUDIO_LOCALES : une seule langue, rien à auditer.')
|
|
1027
|
+
const main = locales[0]
|
|
1028
|
+
const apply = has('apply')
|
|
1029
|
+
const metas = await query(`*[_type == "translation.metadata"]{"refs": translations[]{"lang": coalesce(language, _key), "id": value._ref}}`)
|
|
1030
|
+
const pairs = []
|
|
1031
|
+
for (const m of metas) {
|
|
1032
|
+
const refs = m.refs ?? []
|
|
1033
|
+
const master = refs.find((r) => r.lang === main)
|
|
1034
|
+
if (master) for (const r of refs) if (r.lang !== main) pairs.push([master.id, r.id, r.lang])
|
|
1035
|
+
}
|
|
1036
|
+
let anchorsFixed = 0
|
|
1037
|
+
let altsMarked = 0
|
|
1038
|
+
for (const [masterId, id, lang] of pairs) {
|
|
1039
|
+
const [master, published, draft] = await Promise.all([
|
|
1040
|
+
query(`*[_id == $id][0]`, {id: masterId}),
|
|
1041
|
+
query(`*[_id == $id][0]`, {id}),
|
|
1042
|
+
query(`*[_id == $id][0]`, {id: `drafts.${id}`}),
|
|
1043
|
+
])
|
|
1044
|
+
const target = draft ?? published
|
|
1045
|
+
if (!master || !target) continue
|
|
1046
|
+
const {anchors, alts} = auditTranslation(master, target)
|
|
1047
|
+
if (!anchors.length && !alts.length) continue
|
|
1048
|
+
const title = target.title ?? target.name ?? (target._type === 'componentDefaults' ? 'Component defaults' : id)
|
|
1049
|
+
console.log(`\n${lang.toUpperCase()} « ${title} » (${id})`)
|
|
1050
|
+
for (const a of anchors) console.log(` ancre ${a} : « ${valueAt(target, a)} » → « ${valueAt(master, a)} »`)
|
|
1051
|
+
for (const a of alts) console.log(` texte alternatif ${a} : « ${valueAt(target, a)} » (identique à ${main.toUpperCase()})`)
|
|
1052
|
+
if (!apply) continue
|
|
1053
|
+
const draftId = `drafts.${id}`
|
|
1054
|
+
const mutations = []
|
|
1055
|
+
if (!draft) {
|
|
1056
|
+
const {_rev, _updatedAt, _createdAt, ...copy} = published
|
|
1057
|
+
mutations.push({createIfNotExists: {...copy, _id: draftId}})
|
|
1058
|
+
}
|
|
1059
|
+
if (anchors.length) {
|
|
1060
|
+
const set = {}
|
|
1061
|
+
for (const a of anchors) set[patchPath(target, a)] = valueAt(master, a)
|
|
1062
|
+
mutations.push({patch: {id: draftId, set}})
|
|
1063
|
+
}
|
|
1064
|
+
if (alts.length) {
|
|
1065
|
+
const todoId = `ncfTodo.${id}`
|
|
1066
|
+
const todo = await query(`*[_id == $id][0]{paths}`, {id: todoId})
|
|
1067
|
+
mutations.push({createIfNotExists: {_id: todoId, _type: TODO_TYPE, documentId: id, sourceId: masterId, sourceLanguage: main, paths: []}})
|
|
1068
|
+
mutations.push({patch: {id: todoId, set: {paths: [...new Set([...(todo?.paths ?? []), ...alts])]}}})
|
|
1069
|
+
}
|
|
1070
|
+
await mutate(mutations)
|
|
1071
|
+
anchorsFixed += anchors.length
|
|
1072
|
+
altsMarked += alts.length
|
|
1073
|
+
}
|
|
1074
|
+
if (!apply) {
|
|
1075
|
+
console.log('\nLecture seule. `npx ncf-kit translations audit --apply` : ancres remises et textes alternatifs marqués « To translate », EN BROUILLON (rien n\'est publié).')
|
|
1076
|
+
return
|
|
1077
|
+
}
|
|
1078
|
+
console.log(`\n✔ ${anchorsFixed} ancre(s) remise(s) à la valeur de la version principale, ${altsMarked} texte(s) alternatif(s) marqué(s) « To translate », en brouillon.`)
|
|
1079
|
+
console.log('Ensuite : Studio → Pages → Languages → « Unfinished translations, retry » (brouillons), relire chaque version, la publier, puis `npx ncf-kit doctor`.')
|
|
1080
|
+
return
|
|
1081
|
+
}
|
|
1082
|
+
fail(`translations : sous-commande inconnue « ${sub} » (export | apply <fichier> | audit [--apply])`)
|
|
985
1083
|
}
|
|
986
1084
|
|
|
987
1085
|
// ─── check-deploy : ne jamais écraser le Studio d'un autre projet ───
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Contrôle des traductions faites AVANT le kit 2.65.0 (lu par `doctor`) : une mise à jour du
|
|
2
|
+
// kit ne les corrige pas. Compare une version traduite à sa version principale, élément par
|
|
3
|
+
// élément (mêmes _key) :
|
|
4
|
+
// - ancre (champ « anchor » ou « …Anchor ») DIFFÉRENTE de la version principale : l'IA
|
|
5
|
+
// l'avait traduite (« start of school year »), les liens qui la visent sont cassés ;
|
|
6
|
+
// - texte alternatif d'image (« alt ») IDENTIQUE à la version principale : jamais traduit.
|
|
7
|
+
// Pur (sans réseau), testé dans test/translationAudit.test.ts.
|
|
8
|
+
|
|
9
|
+
const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
10
|
+
const ANCHOR = /^(anchor|.*Anchor)$/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Écarts d'une version traduite : {anchors: [chemin...], alts: [chemin...]}.
|
|
14
|
+
* Seuls les éléments présents des deux côtés (même chemin, mêmes _key) sont comparés.
|
|
15
|
+
*/
|
|
16
|
+
export function auditTranslation(master, translated) {
|
|
17
|
+
const anchors = []
|
|
18
|
+
const alts = []
|
|
19
|
+
const walk = (a, b, path) => {
|
|
20
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
21
|
+
const byKey = new Map(b.filter((i) => isObj(i) && i._key).map((i) => [i._key, i]))
|
|
22
|
+
for (const item of a) if (isObj(item) && item._key && byKey.has(item._key)) walk(item, byKey.get(item._key), `${path}[${item._key}]`)
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
if (!isObj(a) || !isObj(b)) return
|
|
26
|
+
for (const [k, v] of Object.entries(a)) {
|
|
27
|
+
if (k.startsWith('_')) continue
|
|
28
|
+
const w = b[k]
|
|
29
|
+
const at = path ? `${path}.${k}` : k
|
|
30
|
+
if (typeof v === 'string' && ANCHOR.test(k)) {
|
|
31
|
+
if (v && typeof w === 'string' && w && w !== v) anchors.push(at)
|
|
32
|
+
} else if (typeof v === 'string' && k === 'alt' && isObj(a.asset)) {
|
|
33
|
+
if (v.trim() && w === v) alts.push(at)
|
|
34
|
+
} else walk(v, w, at)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
walk(master, translated, '')
|
|
38
|
+
return {anchors, alts}
|
|
39
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1483,7 +1483,7 @@ export declare function ActorName(props: {
|
|
|
1483
1483
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1484
1484
|
* le vérifie.
|
|
1485
1485
|
*/
|
|
1486
|
-
export declare const KIT_VERSION = "2.65.0-rc.
|
|
1486
|
+
export declare const KIT_VERSION = "2.65.0-rc.6";
|
|
1487
1487
|
/**
|
|
1488
1488
|
* Données de la page proposées comme colonnes.
|
|
1489
1489
|
*
|
package/dist/index.js
CHANGED
|
@@ -1423,7 +1423,7 @@ function explainGrantError(error) {
|
|
|
1423
1423
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1424
1424
|
* le vérifie.
|
|
1425
1425
|
*/
|
|
1426
|
-
const KIT_VERSION = "2.65.0-rc.
|
|
1426
|
+
const KIT_VERSION = "2.65.0-rc.6";
|
|
1427
1427
|
/**
|
|
1428
1428
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1429
1429
|
*
|
|
@@ -1931,7 +1931,7 @@ function useKitUpdate() {
|
|
|
1931
1931
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1932
1932
|
}).catch(() => {}), () => controller.abort();
|
|
1933
1933
|
}, []);
|
|
1934
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.65.0-rc.
|
|
1934
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.65.0-rc.6") > 0);
|
|
1935
1935
|
return {
|
|
1936
1936
|
current: KIT_VERSION,
|
|
1937
1937
|
latest,
|
|
@@ -12134,6 +12134,37 @@ function withLanguageMismatch(Inner, config) {
|
|
|
12134
12134
|
}
|
|
12135
12135
|
return LanguageMismatch;
|
|
12136
12136
|
}
|
|
12137
|
+
/** Identifiants des documents référencés par `doc` (liens, pages liées...), hors images et fichiers. */
|
|
12138
|
+
function referencedIds(doc) {
|
|
12139
|
+
let out = /* @__PURE__ */ new Set(), walk = (node) => {
|
|
12140
|
+
if (Array.isArray(node)) return node.forEach(walk);
|
|
12141
|
+
if (!node || typeof node != "object") return;
|
|
12142
|
+
let ref = node._ref;
|
|
12143
|
+
typeof ref == "string" && !/^(image|file)-/.test(ref) && out.add(ref.replace(/^drafts\./, ""));
|
|
12144
|
+
for (let [k, v] of Object.entries(node)) k.startsWith("_") || walk(v);
|
|
12145
|
+
};
|
|
12146
|
+
return walk(doc), [...out];
|
|
12147
|
+
}
|
|
12148
|
+
/**
|
|
12149
|
+
* Pages liées depuis `doc` qui n'ont pas de version PUBLIÉE dans chacune des `languages`
|
|
12150
|
+
* (kit >= 2.65.0). La version traduite d'un document qui les vise ne peut pas être
|
|
12151
|
+
* publiée (« Cette page est en FR et n'a pas de version EN », vu sur JAF) : on le dit
|
|
12152
|
+
* AVANT de la créer, avec les pages à traduire d'abord.
|
|
12153
|
+
*/
|
|
12154
|
+
async function linkedWithoutVersion(client, doc, languages, field = "language") {
|
|
12155
|
+
let result = /* @__PURE__ */ new Map(), ids = referencedIds(doc);
|
|
12156
|
+
if (!ids.length || !languages.length) return result;
|
|
12157
|
+
let linked = await client.fetch(`*[_id in $ids && defined(${field})]{
|
|
12158
|
+
_id, "title": coalesce(title, name, slug.current, _id), "language": ${field},
|
|
12159
|
+
"versions": *[_type == "translation.metadata" && references(^._id)][0].translations[]{"language": coalesce(language, _key), "id": value._ref}
|
|
12160
|
+
}`, { ids }), versionIds = linked.flatMap((d) => (d.versions ?? []).map((v) => v.id ?? "")).filter(Boolean), published = new Set(versionIds.length ? await client.fetch("*[_id in $ids]._id", { ids: versionIds }) : []);
|
|
12161
|
+
for (let language of languages) for (let d of linked) {
|
|
12162
|
+
if (d.language === language) continue;
|
|
12163
|
+
let version = (d.versions ?? []).find((v) => v.language === language);
|
|
12164
|
+
version?.id && published.has(version.id) || result.set(language, [...result.get(language) ?? [], d.title]);
|
|
12165
|
+
}
|
|
12166
|
+
return result;
|
|
12167
|
+
}
|
|
12137
12168
|
/**
|
|
12138
12169
|
* Publier la version PRINCIPALE d'une page :
|
|
12139
12170
|
* - page déjà publiée qui a des traductions : « Propagate to other languages? »
|
|
@@ -12228,7 +12259,19 @@ async function findMissing(client, id, source, locales) {
|
|
|
12228
12259
|
return locales.filter((l) => l !== source && !existing.has(l));
|
|
12229
12260
|
}
|
|
12230
12261
|
function PropagateDialog(props) {
|
|
12231
|
-
let { config, id, type, mode, after, onDone } = props, client = useKitClient(), schema = useSchema(), field = config.i18n?.field ?? "language", source = String(after[field] ?? ""), [targets, setTargets] = useState(props.targets), [
|
|
12262
|
+
let { config, id, type, mode, after, onDone } = props, client = useKitClient(), schema = useSchema(), field = config.i18n?.field ?? "language", source = String(after[field] ?? ""), [targets, setTargets] = useState(props.targets), [unlinked, setUnlinked] = useState(/* @__PURE__ */ new Map());
|
|
12263
|
+
useEffect(() => {
|
|
12264
|
+
let alive = !0;
|
|
12265
|
+
return linkedWithoutVersion(client, after, props.targets.map((t) => t.language), field).then((m) => alive && setUnlinked(m)).catch(() => {}), () => {
|
|
12266
|
+
alive = !1;
|
|
12267
|
+
};
|
|
12268
|
+
}, [
|
|
12269
|
+
client,
|
|
12270
|
+
after,
|
|
12271
|
+
props.targets,
|
|
12272
|
+
field
|
|
12273
|
+
]);
|
|
12274
|
+
let [busy, setBusy] = useState(!1), toast = useToast(), [error, setError] = useState(null), [ai, setAi] = useState(!!config.history), [publishNow, setPublishNow] = useState(!1), [overwrite, setOverwrite] = useState(!1), editedCount = targets.reduce((n, t) => n + (t.selected ? t.edited.length : 0), 0), hasTexts = targets.some((t) => t.result.toTranslate.length), apply = async () => {
|
|
12232
12275
|
setBusy(!0), setError(null);
|
|
12233
12276
|
try {
|
|
12234
12277
|
let published = [], drafted = [], aiError = null;
|
|
@@ -12378,15 +12421,42 @@ function PropagateDialog(props) {
|
|
|
12378
12421
|
flex: 1,
|
|
12379
12422
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
12380
12423
|
gap: 2,
|
|
12381
|
-
children: [
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12424
|
+
children: [
|
|
12425
|
+
/* @__PURE__ */ jsx(Text, {
|
|
12426
|
+
size: 1,
|
|
12427
|
+
weight: "semibold",
|
|
12428
|
+
children: t.language.toUpperCase()
|
|
12429
|
+
}),
|
|
12430
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
12431
|
+
size: 1,
|
|
12432
|
+
muted: !0,
|
|
12433
|
+
children: [mode === "create" ? `New version (${t.result.toTranslate.length} texts)` : summary(t.result), t.edited.length ? ` · ${t.edited.length} edited by hand` : ""]
|
|
12434
|
+
}),
|
|
12435
|
+
unlinked.get(t.language)?.length ? /* @__PURE__ */ jsx(Card, {
|
|
12436
|
+
tone: "caution",
|
|
12437
|
+
padding: 2,
|
|
12438
|
+
radius: 2,
|
|
12439
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
12440
|
+
size: 1,
|
|
12441
|
+
children: [
|
|
12442
|
+
"Links to ",
|
|
12443
|
+
unlinked.get(t.language).length,
|
|
12444
|
+
" page",
|
|
12445
|
+
unlinked.get(t.language).length > 1 ? "s" : "",
|
|
12446
|
+
" with no published ",
|
|
12447
|
+
t.language.toUpperCase(),
|
|
12448
|
+
" version (",
|
|
12449
|
+
unlinked.get(t.language).slice(0, 4).map((title) => `« ${title} »`).join(", "),
|
|
12450
|
+
unlinked.get(t.language).length > 4 ? ", …" : "",
|
|
12451
|
+
"): this version can be saved as a draft, but not published until",
|
|
12452
|
+
unlinked.get(t.language).length > 1 ? " those pages are" : " that page is",
|
|
12453
|
+
" translated and published. Not meant to be translated? In the ",
|
|
12454
|
+
t.language.toUpperCase(),
|
|
12455
|
+
" version, link to its address directly (link type URL) or remove the link."
|
|
12456
|
+
]
|
|
12457
|
+
})
|
|
12458
|
+
}) : null
|
|
12459
|
+
]
|
|
12390
12460
|
})
|
|
12391
12461
|
})]
|
|
12392
12462
|
})
|