Localize timeline system reasons

This commit is contained in:
SepehrYahyaee
2026-09-13 16:04:51 +03:30
parent 0eaf55e73c
commit f9d4b5df9a
2 changed files with 57 additions and 0 deletions

View File

@@ -190,6 +190,13 @@ export const STEP_KEY_FA_LABELS: Record<string, string> = {
const GENERIC_EVENT_FA_LABEL = "رویداد پرونده";
const GENERIC_EVENT_FA_DESCRIPTION = "رویدادی در روند پرونده ثبت شد.";
const SYSTEM_REASON_FA_TRANSLATIONS: Record<string, string> = {
"IN_PERSON expert-initiated: first party is always guilty; confession auto-resolved":
"در پرونده حضوری ایجادشده توسط کارشناس، طرف اول همیشه مقصر است؛ بنابراین مرحله اقرار به‌صورت خودکار تعیین تکلیف شد.",
"V6 call-center initiated: first party is always guilty; confession auto-resolved":
"در پرونده ایجادشده توسط مرکز تماس، طرف اول همیشه مقصر است؛ بنابراین مرحله اقرار به‌صورت خودکار تعیین تکلیف شد.",
};
/**
* Persian descriptions for workflow-step events. These are deliberately
* complete sentences because the insurer timeline exposes them as the event
@@ -276,10 +283,15 @@ export function localizeTimelineMetadata(event: {
}): Record<string, unknown> | null {
if (!event.metadata) return null;
const reason = event.metadata.reason;
const localizedReason =
typeof reason === "string" ? SYSTEM_REASON_FA_TRANSLATIONS[reason] : null;
return {
...event.metadata,
...(Object.prototype.hasOwnProperty.call(event.metadata, "description")
? { description: getEventFaDescription(event) }
: {}),
...(localizedReason ? { reason: localizedReason } : {}),
};
}