smart-home/smart-home-app/批量英文化.js
2026-02-26 09:16:34 +08:00

174 lines
5.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 批量英文化脚本
* 一键将所有中文文案替换为英文
*/
// 中英文对照表
const translations = {
// 通用词汇
"确认": "Confirm",
"取消": "Cancel",
"保存": "Save",
"删除": "Delete",
"编辑": "Edit",
"添加": "Add",
"返回": "Back",
"刷新": "Refresh",
"加载中": "Loading",
"成功": "Success",
"错误": "Error",
"警告": "Warning",
"信息": "Info",
"设置": "Settings",
"状态": "Status",
"在线": "Online",
"离线": "Offline",
"已连接": "Connected",
"未连接": "Disconnected",
// 主页相关
"智能家居": "Smart Home",
"欢迎使用": "Welcome to",
"设备数量": "Device Count",
"房间数量": "Room Count",
"场景数量": "Scene Count",
// 设备管理
"设备管理": "Device Management",
"设备列表": "Device List",
"添加设备": "Add Device",
"设备详情": "Device Details",
"设备名称": "Device Name",
"设备类型": "Device Type",
"所在房间": "Room",
"设备状态": "Device Status",
"温度": "Temperature",
"湿度": "Humidity",
"电池电量": "Battery Level",
// 厨房监控
"厨房监控": "Kitchen Monitor",
"实时监控": "Real-time Monitor",
"报警历史": "Alarm History",
"高级选项": "Advanced Options",
"火灾检测": "Fire Detection",
"人员检测": "Person Detection",
"报警": "Alarm",
"正常": "Normal",
"警告": "Warning",
"危险": "Danger",
"当前最高温度": "Current Max Temperature",
"平均温度": "Average Temperature",
"热点区域": "Hot Spot Area",
"灶台区域": "Stove Area",
"灶台附近": "Near Stove",
"刚刚更新": "Just Updated",
"刚刚": "Just Now",
"有人": "Person Detected",
"无人": "No Person",
"设备绑定": "Device Binding",
"设备配置": "Device Configuration",
"网络设置": "Network Settings",
"手机号绑定": "Phone Binding",
"通知设置": "Notification Settings",
"调试模式": "Debug Mode",
"开发者工具": "Developer Tools",
"红外遥控": "IR Control",
"空调控制": "AC Control",
"燃气阀控制": "Gas Valve Control",
"其他房间": "Other Rooms",
"系统信息": "System Info",
"版本信息": "Version Info",
"固件版本": "Firmware Version",
"连接状态": "Connection Status",
"个设备": " Devices",
// 房间名称
"客厅": "Living Room",
"卧室": "Bedroom",
"书房": "Study Room",
"阳台": "Balcony",
"卫生间": "Bathroom",
"餐厅": "Dining Room",
"厨房": "Kitchen",
// 状态文本
"未绑定": "Not Bound",
"已绑定": "Bound",
"调试模式已开启": "Debug Mode Enabled",
"调试模式已关闭": "Debug Mode Disabled",
"语言已切换为中文": "Language switched to Chinese",
"保存成功": "Save Successful",
"保存中": "Saving",
"重置中": "Resetting",
"重置成功请重启APP": "Reset successful, please restart APP",
"请输入设备名称": "Please enter device name",
"请选择房间": "Please select room",
"重置设备数据": "Reset Device Data",
"这将清除所有设备配置并恢复到默认状态,确定要继续吗?": "This will clear all device configurations and restore to default state. Are you sure to continue?",
// 时间相关
"分钟": "minutes",
"秒": "seconds",
"小时": "hours",
"天": "days",
// 单位
"°C": "°C",
"个": "",
"台": "",
"次": " times",
// 新增StillSense相关
"时间设置": "Timing Settings",
"频率设置": "Frequency Settings",
"声音设置": "Sound Settings",
"灯光设置": "Light Settings",
"较短": "Shorter",
"默认": "Default",
"较长": "Longer",
"一次": "Once",
"每隔几分钟": "Every few minutes",
"直到确认": "Until acknowledged",
"轻柔": "Soft",
"清晰": "Clear",
"方向LED": "Directional LED",
"灯光强度": "Light intensity",
"开启": "On",
"关闭": "Off",
"低": "Low",
"中": "Medium",
"高": "High",
// 语言设置
"语言设置": "Language Settings",
"中文": "Chinese",
"关于": "About"
}
console.log("=== 批量英文化对照表 ===")
console.log("共计翻译条目:", Object.keys(translations).length)
console.log("\n主要翻译示例:")
Object.entries(translations).slice(0, 10).forEach(([zh, en]) => {
console.log(`"${zh}" → "${en}"`)
})
console.log("\n使用方法:")
console.log("1. 在VS Code中使用查找替换功能")
console.log("2. 启用正则表达式模式")
console.log("3. 逐个替换或使用批量替换")
// 生成VS Code查找替换的正则表达式
console.log("\n=== VS Code查找替换正则表达式 ===")
const regexPairs = Object.entries(translations).map(([zh, en]) => {
// 转义特殊字符
const escapedZh = zh.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const escapedEn = en.replace(/\$/g, '$$$$') // VS Code替换中$需要转义为$$
return `查找: ${escapedZh}\n替换: ${escapedEn}\n`
}).slice(0, 5)
console.log("前5个替换示例:")
regexPairs.forEach(pair => console.log(pair))
module.exports = translations