refactor: update network tool components for improved user experience
- Translated UI text in DNS, Ping, TCPing, and Speed Test components from Chinese to English for better accessibility. - Enhanced user prompts and labels for clarity, including error messages and button texts. - Updated comments in the code to reflect the changes in language and improve code readability.
This commit is contained in:
		| @@ -39,7 +39,7 @@ const Tool: FC = () => { | ||||
|  | ||||
|   const tcping = async () => { | ||||
|     if (!host.trim()) { | ||||
|       toast.error("请输入主机名或 IP"); | ||||
|       toast.error("Please enter a hostname or IP"); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
| @@ -80,7 +80,7 @@ const Tool: FC = () => { | ||||
|       const time = endTime - startTime; | ||||
|  | ||||
|       const errorMessage = | ||||
|         error instanceof Error ? error.message : "连接失败"; | ||||
|         error instanceof Error ? error.message : "Connection failed"; | ||||
|  | ||||
|       const newResult: TCPingResult = { | ||||
|         seq, | ||||
| @@ -122,7 +122,7 @@ const Tool: FC = () => { | ||||
|  | ||||
|   const startTCPing = () => { | ||||
|     if (!host.trim()) { | ||||
|       toast.error("请输入主机名或 IP"); | ||||
|       toast.error("Please enter a hostname or IP"); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
| @@ -177,9 +177,9 @@ const Tool: FC = () => { | ||||
|     <div className="flex flex-col gap-4 h-full"> | ||||
|       <div className="flex flex-col gap-4"> | ||||
|         <div className="flex flex-col gap-2"> | ||||
|           <label className="text-sm font-medium">主机名或 IP</label> | ||||
|           <label className="text-sm font-medium">Hostname or IP</label> | ||||
|           <Input | ||||
|             placeholder="例如: example.com 或 192.168.1.1" | ||||
|             placeholder="e.g. example.com or 192.168.1.1" | ||||
|             value={host} | ||||
|             onChange={(e) => setHost(e.target.value)} | ||||
|             disabled={running} | ||||
| @@ -187,10 +187,10 @@ const Tool: FC = () => { | ||||
|         </div> | ||||
|  | ||||
|         <div className="flex flex-col gap-2"> | ||||
|           <label className="text-sm font-medium">端口</label> | ||||
|           <label className="text-sm font-medium">Port</label> | ||||
|           <Input | ||||
|             type="number" | ||||
|             placeholder="例如: 443" | ||||
|             placeholder="e.g. 443" | ||||
|             value={port} | ||||
|             onChange={(e) => setPort(e.target.value)} | ||||
|             disabled={running} | ||||
| @@ -202,7 +202,7 @@ const Tool: FC = () => { | ||||
|         <div className="flex gap-2"> | ||||
|           {!running ? ( | ||||
|             <Button onClick={startTCPing} className="flex-1"> | ||||
|               开始测试 | ||||
|               Start Test | ||||
|             </Button> | ||||
|           ) : ( | ||||
|             <Button | ||||
| @@ -210,7 +210,7 @@ const Tool: FC = () => { | ||||
|               variant="destructive" | ||||
|               className="flex-1" | ||||
|             > | ||||
|               停止 | ||||
|               Stop | ||||
|             </Button> | ||||
|           )} | ||||
|         </div> | ||||
| @@ -218,26 +218,26 @@ const Tool: FC = () => { | ||||
|  | ||||
|       {stats.sent > 0 && ( | ||||
|         <div className="border rounded-md p-3 bg-card text-card-foreground"> | ||||
|           <div className="text-sm font-medium mb-2">统计信息</div> | ||||
|           <div className="text-sm font-medium mb-2">Statistics</div> | ||||
|           <div className="grid grid-cols-2 gap-2 text-sm"> | ||||
|             <div className="text-muted-foreground">已发送:</div> | ||||
|             <div>{stats.sent} 次</div> | ||||
|             <div className="text-muted-foreground">成功:</div> | ||||
|             <div>{stats.received} 次</div> | ||||
|             <div className="text-muted-foreground">失败:</div> | ||||
|             <div className="text-muted-foreground">Sent:</div> | ||||
|             <div>{stats.sent} times</div> | ||||
|             <div className="text-muted-foreground">Success:</div> | ||||
|             <div>{stats.received} times</div> | ||||
|             <div className="text-muted-foreground">Failed:</div> | ||||
|             <div> | ||||
|               {stats.lost} 次 ({lossRate}%) | ||||
|               {stats.lost} times ({lossRate}%) | ||||
|             </div> | ||||
|             {stats.received > 0 && ( | ||||
|               <> | ||||
|                 <div className="text-muted-foreground">最小延迟:</div> | ||||
|                 <div className="text-muted-foreground">Min Latency:</div> | ||||
|                 <div>{stats.min.toFixed(2)} ms</div> | ||||
|                 <div className="text-muted-foreground">最大延迟:</div> | ||||
|                 <div className="text-muted-foreground">Max Latency:</div> | ||||
|                 <div>{stats.max.toFixed(2)} ms</div> | ||||
|                 <div className="text-muted-foreground">平均延迟:</div> | ||||
|                 <div className="text-muted-foreground">Avg Latency:</div> | ||||
|                 <div>{stats.avg.toFixed(2)} ms</div> | ||||
|                 <div className="text-muted-foreground">端口状态:</div> | ||||
|                 <div className="text-green-500 font-medium">开放</div> | ||||
|                 <div className="text-muted-foreground">Port Status:</div> | ||||
|                 <div className="text-green-500 font-medium">Open</div> | ||||
|               </> | ||||
|             )} | ||||
|           </div> | ||||
| @@ -246,7 +246,7 @@ const Tool: FC = () => { | ||||
|  | ||||
|       {results.length > 0 && ( | ||||
|         <div className="flex flex-col gap-2 flex-1 overflow-hidden"> | ||||
|           <div className="text-sm font-medium">TCPing 结果:</div> | ||||
|           <div className="text-sm font-medium">TCPing Results:</div> | ||||
|           <div | ||||
|             ref={resultsContainerRef} | ||||
|             className="flex-1 overflow-auto space-y-1 font-mono text-sm border rounded-md p-3 bg-card" | ||||
| @@ -262,7 +262,7 @@ const Tool: FC = () => { | ||||
|                   </> | ||||
|                 ) : ( | ||||
|                   <> | ||||
|                     seq={result.seq} port={port} 连接失败 | ||||
|                     seq={result.seq} port={port} Connection failed | ||||
|                     {result.error && ` (${result.error})`} | ||||
|                   </> | ||||
|                 )} | ||||
| @@ -271,7 +271,7 @@ const Tool: FC = () => { | ||||
|             {running && ( | ||||
|               <div className="flex items-center gap-2 text-muted-foreground"> | ||||
|                 <Loader2 className="size-3 animate-spin" /> | ||||
|                 运行中... | ||||
|                 Running... | ||||
|               </div> | ||||
|             )} | ||||
|           </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 typist
					typist