Skip to content

Commit 525136d

Browse files
committed
fix: route SkipRoute error messages through i18n translations
Replace 5 hardcoded English strings in SkipRoute.ts with i18n.t() calls and add corresponding translation keys to both locale files.
1 parent 17e7ea9 commit 525136d

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

backend/config/locales/active/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@
314314
"route": "Route",
315315
"tx-copied-successfully": "TX Hash Copied",
316316
"tx-raw-copied-successfully": "TX Raw Copied",
317+
"tx-tracking-failed": "Transaction submitted but status couldn't be confirmed, check your wallet or explorer",
318+
"tx-state-abandoned": "Transaction was abandoned",
319+
"tx-state-error": "Transaction completed with an error",
320+
"tx-state-pending-error": "Transaction encountered an error",
321+
"tx-action-not-supported": "Action not supported",
317322
"account": "Account",
318323
"stop-loss": "Stop Loss",
319324
"stop-loss-price-per": "Stop Loss price per",

backend/config/locales/en.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@
318318
"route": "Route",
319319
"tx-copied-successfully": "TX Hash Copied",
320320
"tx-raw-copied-successfully": "TX Raw Copied",
321+
"tx-tracking-failed": "Transaction submitted but status couldn't be confirmed, check your wallet or explorer",
322+
"tx-state-abandoned": "Transaction was abandoned",
323+
"tx-state-error": "Transaction completed with an error",
324+
"tx-state-pending-error": "Transaction encountered an error",
325+
"tx-action-not-supported": "Action not supported",
321326
"account": "Account",
322327
"stop-loss": "Stop Loss",
323328
"stop-loss-price-per": "Stop Loss price per",

src/common/utils/SkipRoute.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { SkipRouteRequest, SkipMessagesRequest, SkipMsg } from "@/common/ap
33

44
import { fetchNetworkStatus } from "./ConfigService";
55
import { BackendApi } from "@/common/api";
6+
import { i18n } from "@/i18n";
67
import { MsgTransfer } from "cosmjs-types/ibc/applications/transfer/v1/tx";
78
import type { BaseWallet } from "@/networks";
89
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
@@ -209,16 +210,16 @@ export class SkipRouter {
209210

210211
switch (status.state) {
211212
case "STATE_ABANDONED": {
212-
throw new Error("STATE_ABANDONED");
213+
throw new Error(i18n.t("message.tx-state-abandoned"));
213214
}
214215
case "STATE_COMPLETED_SUCCESS": {
215216
return status;
216217
}
217218
case "STATE_COMPLETED_ERROR": {
218-
throw new Error("STATE_COMPLETED_ERROR");
219+
throw new Error(i18n.t("message.tx-state-error"));
219220
}
220221
case "STATE_PENDING_ERROR": {
221-
throw new Error("STATE_PENDING_ERROR");
222+
throw new Error(i18n.t("message.tx-state-pending-error"));
222223
}
223224
}
224225

@@ -256,7 +257,7 @@ export class SkipRouter {
256257
});
257258
}
258259
default: {
259-
throw new Error("Action not supported");
260+
throw new Error(i18n.t("message.tx-action-not-supported"));
260261
}
261262
}
262263
}
@@ -279,7 +280,7 @@ export class SkipRouter {
279280
});
280281
} catch {
281282
if (attempts >= 5) {
282-
throw new Error("Transaction tracking failed — please check your transaction manually");
283+
throw new Error(i18n.t("message.tx-tracking-failed"));
283284
}
284285
await SkipRouter.wait(4000);
285286
await SkipRouter.track(chainId, hash, attempts + 1);

0 commit comments

Comments
 (0)