diff --git a/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts b/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts index 6fdf6508..865a824b 100644 --- a/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts +++ b/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts @@ -342,6 +342,33 @@ export function runTests() { assert(!highlighted.dashed, `${city} settlement runway should be solid`); const auxiliary = seriesByKey(chart.series, "runway_99_00") as any; assert(auxiliary?.dashed === true, `${city} auxiliary runway should be dashed`); + + const englishChart = __buildTemperatureChartDataForTest( + { + city, + local_date: "2026-05-25", + local_time: "10:00", + tz_offset_seconds: 8 * 60 * 60, + runway_plate_history: { + [settlementRwy]: [ + { time: "00:05", temp: 25.1 }, + { time: "00:35", temp: 25.3 }, + ], + }, + } as any, + { localTime: "10:00", times: ["00:00", "00:30"], temps: [25, 26] } as any, + "1D", + true, + ); + const englishSettlement = seriesByKey(englishChart.series, runwayKey(settlementRwy)) as any; + assert( + englishSettlement?.label.includes("Settlement Runway"), + `${city} English settlement runway label should be translated`, + ); + assert( + !englishSettlement?.label.includes("结算跑道"), + `${city} English settlement runway label should not leak Chinese`, + ); }); const shenzhen = __buildTemperatureChartDataForTest( diff --git a/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts b/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts index 6ca22587..13e1d432 100644 --- a/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts +++ b/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts @@ -77,6 +77,11 @@ function runwaySeriesKey(rwy: string) { .join("_")}`; } +function runwaySeriesLabel(rwy: string, isSettlement: boolean, isEn: boolean) { + if (!isSettlement) return rwy; + return `${rwy} ${isEn ? "Settlement Runway" : "结算跑道"}`; +} + function isTemperatureSeriesVisibleByDefault(city: string, seriesKey: string) { if (seriesKey.startsWith("model_curve_")) { return normalizeCityKey(city) === "paris" && seriesKey === "model_curve_AROME HD"; @@ -1153,6 +1158,7 @@ function buildRunwayHistorySeries( tzOffset: number, localDateStr: string, minPoints = 2, + isEn = false, ): RunwayHistorySeries[] { const directHistory = hourly?.runwayPlateHistory ?? @@ -1175,7 +1181,7 @@ function buildRunwayHistorySeries( const isSettlement = isSettlementRunway(row, normalizedRwy); return { key: runwaySeriesKey(normalizedRwy), - label: `${normalizedRwy}${isSettlement ? (row ? " 结算跑道" : " Settlement") : ""}`, + label: runwaySeriesLabel(normalizedRwy, isSettlement, isEn), rwy: normalizedRwy, isSettlement, color: isSettlement ? "#009688" : RUNWAY_LINE_COLORS[index % RUNWAY_LINE_COLORS.length], @@ -1249,7 +1255,7 @@ function buildRunwayHistorySeries( if (values.length < minPoints) return null; return { key: runwaySeriesKey(rwy), - label: `${rwy}${isSettlement ? " 结算跑道" : ""}`, + label: runwaySeriesLabel(rwy, isSettlement, isEn), rwy, isSettlement, color: isSettlement ? "#009688" : RUNWAY_LINE_COLORS[index % RUNWAY_LINE_COLORS.length], @@ -1575,7 +1581,7 @@ function buildFullDayChartData( localDayBounds, ); const runwayHistorySeries = filterRunwayHistoryToLocalDay( - buildRunwayHistorySeries(row, hourly, tzOffset, localDateStr), + buildRunwayHistorySeries(row, hourly, tzOffset, localDateStr, 2, isEn), localDayBounds, );