From bad4dff2d19d08849cec8021d656c16d8786df8e Mon Sep 17 00:00:00 2001
From: Shubham Agrawal <shubham.agra1206@gmail.com>
Date: Sat, 27 Dec 2025 21:15:57 +0530
Subject: [PATCH] Refactor: IOU actions from translateLocal to
 getMicroSecondOnyxErrorWithTranslationKey

---
 src/libs/ModifiedExpenseMessage.ts |  3 +--
 src/libs/actions/IOU.ts            | 16 ++++------------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/libs/ModifiedExpenseMessage.ts b/src/libs/ModifiedExpenseMessage.ts
index 18ffffe3a266..cd27eb77f950 100644
--- a/src/libs/ModifiedExpenseMessage.ts
+++ b/src/libs/ModifiedExpenseMessage.ts
@@ -67,8 +67,7 @@ function buildMessageFragmentForValue(
 
     // If the valueName is category and the old value was Uncategorized, show it in lowercase without quotes
     let oldValueToDisplay;
-    // eslint-disable-next-line @typescript-eslint/no-deprecated
-    if (valueName.includes(translateLocal('common.category').toLowerCase()) && isCategoryMissing(oldValue)) {
+    if (valueName.includes(translate('common.category').toLowerCase()) && isCategoryMissing(oldValue)) {
         oldValueToDisplay = oldValue.toLowerCase();
     } else if (valueInQuotes) {
         oldValueToDisplay = `"${oldValue}"`;
diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
index 618480ba9dce..c7526d79a2b5 100644
--- a/src/libs/actions/IOU.ts
+++ b/src/libs/actions/IOU.ts
@@ -4552,8 +4552,7 @@ function getUpdateMoneyRequestParams(params: GetUpdateMoneyRequestParamsType): U
     // Step 1: Set any "pending fields" (ones updated while the user was offline) to have error messages in the failureData
     const pendingFields: OnyxTypes.Transaction['pendingFields'] = Object.fromEntries(Object.keys(transactionChanges).map((key) => [key, CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE]));
     const clearedPendingFields = getClearedPendingFields(transactionChanges);
-    // eslint-disable-next-line @typescript-eslint/no-deprecated
-    const errorFields = Object.fromEntries(Object.keys(pendingFields).map((key) => [key, {[DateUtils.getMicroseconds()]: Localize.translateLocal('iou.error.genericEditFailureMessage')}]));
+    const errorFields = Object.fromEntries(Object.keys(pendingFields).map((key) => [key, getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericEditFailureMessage')]));
 
     // Step 2: Get all the collections being updated
     const transactionThread = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`] ?? null;
@@ -5087,8 +5086,7 @@ function getUpdateTrackExpenseParams(
     // Step 1: Set any "pending fields" (ones updated while the user was offline) to have error messages in the failureData
     const pendingFields = Object.fromEntries(Object.keys(transactionChanges).map((key) => [key, CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE]));
     const clearedPendingFields = getClearedPendingFields(transactionChanges);
-    // eslint-disable-next-line @typescript-eslint/no-deprecated
-    const errorFields = Object.fromEntries(Object.keys(pendingFields).map((key) => [key, {[DateUtils.getMicroseconds()]: Localize.translateLocal('iou.error.genericEditFailureMessage')}]));
+    const errorFields = Object.fromEntries(Object.keys(pendingFields).map((key) => [key, getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericEditFailureMessage')]));
 
     // Step 2: Get all the collections being updated
     const transactionThread = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`] ?? null;
@@ -9600,10 +9598,7 @@ function deleteMoneyRequest({
                 [reportAction.reportActionID]: {
                     ...reportAction,
                     pendingAction: null,
-                    errors: {
-                        // eslint-disable-next-line @typescript-eslint/no-deprecated
-                        [errorKey]: Localize.translateLocal('iou.error.genericDeleteFailureMessage'),
-                    },
+                    errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericDeleteFailureMessage', errorKey),
                 },
             },
         },
@@ -9629,10 +9624,7 @@ function deleteMoneyRequest({
                 [reportPreviewAction.reportActionID]: {
                     ...reportPreviewAction,
                     pendingAction: null,
-                    errors: {
-                        // eslint-disable-next-line @typescript-eslint/no-deprecated
-                        [errorKey]: Localize.translateLocal('iou.error.genericDeleteFailureMessage'),
-                    },
+                    errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericDeleteFailureMessage', errorKey),
                 },
             },
         });
