mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
i18n(core): route order-coordinator and token/margin guards through t()
These files bypassed the i18n table entirely, so a user running LANG=en still got Chinese order logs. Migrating them surfaced structural duplication too: the five order paths each spelled out their own 'quantity invalid' string, now one key parameterised by an order-kind label. Also fixes a type that carried display text as its domain: TrendLabel was '做多' | '做空' | '无信号', so the engine's snapshot value *was* the Chinese string and English rendering depended on matching it. Now 'long' | 'short' | 'none', translated at the edge. Order-coordinator tests asserted the Chinese literals, which is exactly what made the gap invisible; they now assert the resolved key so they hold in either language. 39 new translation keys. 271 pass; tsc and oxlint clean.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it, vi, afterEach } from "vitest";
|
||||
import { standxTokenConfig } from "../src/config";
|
||||
import { t } from "../src/i18n";
|
||||
import { TokenExpiryGuard } from "../src/strategy/common/token-expiry-guard";
|
||||
|
||||
const HOUR_MS = 3_600_000;
|
||||
@@ -83,7 +84,7 @@ describe("TokenExpiryGuard", () => {
|
||||
await guard.evaluate({ positionAmt: 0, openOrderCount: 0 });
|
||||
await guard.evaluate({ positionAmt: 0, openOrderCount: 0 });
|
||||
const entryLogs = logs.filter(
|
||||
([type, detail]) => type === "info" && detail.includes("静默数据接收模式")
|
||||
([type, detail]) => type === "info" && detail === t("log.token.silentEntered")
|
||||
);
|
||||
expect(entryLogs).toHaveLength(1);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user