fix(editor): verifier gaps: ratified wordings, copy messages, real SVG journeys
This commit is contained in:
1 parent
9ba6d2b66c
commit
d10ba5d5dd
18 files changed
+227
-97
No files matched your search
@@ -17,7 +17,21 @@ function named(text: string, offer: RecoveryOffer, locale: Locale): string {
|
||||
.replace('{time}', formatParisTime(offer.writtenAt, locale))
|
||||
}
|
||||
|
||||
/** The notice text: unreadable (the loss named), refused by the core, or the offer. */
|
||||
const REFUSED_KINDS = ['invalid_shape', 'core_unavailable', 'unknown']
|
||||
|
||||
/** The refusal line of a copy the core refused: its kind through a label, never raw. */
|
||||
function refusalLine(t: Translate, refused: string): string {
|
||||
const kind = REFUSED_KINDS.includes(refused) ? refused : 'other'
|
||||
return t('editor.draft.recovery.refused').replace(
|
||||
'{kind}',
|
||||
t(`editor.draft.recovery.refused_kind.${kind}`),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The notice text: unreadable (the loss named), or the offer (temporary, this tab's, not
|
||||
* on the server) with, for a copy the core refused, the refusal line added after it.
|
||||
*/
|
||||
function noticeText(
|
||||
t: Translate,
|
||||
locale: Locale,
|
||||
@@ -26,14 +40,13 @@ function noticeText(
|
||||
): string {
|
||||
if (!offer || refused === 'unreadable')
|
||||
return t('editor.draft.recovery.unreadable')
|
||||
if (refused !== null)
|
||||
return t('editor.draft.recovery.refused').replace('{kind}', refused)
|
||||
const base = named(t('editor.draft.recovery.offer'), offer, locale)
|
||||
if (offer.revision >= offer.serverRevision) return base
|
||||
const older = t('editor.draft.recovery.older')
|
||||
.replace('{revision}', String(offer.revision))
|
||||
.replace('{server}', String(offer.serverRevision))
|
||||
return `${base} ${older}`
|
||||
let text = named(t('editor.draft.recovery.offer'), offer, locale)
|
||||
if (offer.revision < offer.serverRevision) {
|
||||
text += ` ${t('editor.draft.recovery.older')
|
||||
.replace('{revision}', String(offer.revision))
|
||||
.replace('{server}', String(offer.serverRevision))}`
|
||||
}
|
||||
return refused === null ? text : `${text} ${refusalLine(t, refused)}`
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user