const fs = require('fs');
|
const path = require('path');
|
|
const apiRoot = path.join(__dirname, '../trading-order-admin/src/main/java/com/yami/trading/api');
|
|
const pairs = [
|
['校验IP不合法', 'Invalid IP address'],
|
['资金密码不能为空', 'Fund password is required'],
|
['资金密码不符合设定', 'Fund password does not meet requirements'],
|
['请先登录', 'Please log in first'],
|
['用户名不能为空', 'Username is required'],
|
['密码不能为空', 'Password is required'],
|
['密码必须6-12位', 'Password must be 6-12 characters'],
|
['验证类型不能为空', 'Verification type is required'],
|
['验证码不能为空', 'Verification code is required'],
|
['用户名不存在', 'Username does not exist'],
|
['验证码不正确', 'Incorrect verification code'],
|
['用户名参数为空', 'Username is required'],
|
['请填写正确的电话号码', 'Please enter a valid phone number'],
|
['电话号码已绑定', 'Phone number is already bound'],
|
['电话号码已绑定其他用户', 'Phone number is bound to another user'],
|
['请填写正确的验证码', 'Please enter a valid verification code'],
|
['请输入推荐码', 'Please enter referral code'],
|
['推荐人无权限推荐', 'Referrer is not authorized to refer'],
|
['请填写正确的邮箱地址', 'Please enter a valid email address'],
|
['邮箱已绑定', 'Email is already bound'],
|
['邮箱已绑定其他用户', 'Email is bound to another user'],
|
['旧密码不能为空', 'Old password is required'],
|
['新密码不能为空', 'New password is required'],
|
['新密码确认不能为空', 'Password confirmation is required'],
|
['旧密码不正确!', 'Incorrect old password'],
|
['新密码不一致', 'New passwords do not match'],
|
['旧资金密码不能为空', 'Old fund password is required'],
|
['新资金密码不能为空', 'New fund password is required'],
|
['新资金密码确认不能为空', 'Fund password confirmation is required'],
|
['操作类型为空', 'Operation type is required'],
|
['操作类型不是整数', 'Operation type must be an integer'],
|
['操作类型不能小于0', 'Operation type cannot be negative'],
|
['备注长度超过250', 'Remark exceeds 250 characters'],
|
['请求第三方失败', 'Third-party request failed'],
|
['资金密码必须6-12位', 'Fund password must be 6-12 characters'],
|
['资金密码错误', 'Incorrect fund password'],
|
['订单不存在!', 'Order does not exist'],
|
['页码不是整数', 'Page number must be an integer'],
|
['页码不能小于等于0', 'Page number must be greater than 0'],
|
['k线图获取失败', 'Failed to load chart data'],
|
['请输入正确的货币数量', 'Please enter a valid amount'],
|
['请选择正确的币种', 'Please select a valid currency'],
|
['请稍后再试', 'Please try again later'],
|
['用户已禁用!', 'User account is disabled'],
|
['用户已禁用', 'User account is disabled'],
|
['系统错误,请稍后重试', 'System error, please try again later'],
|
['参数错误', 'Invalid parameters'],
|
['请输入正确的兑换数量', 'Please enter a valid exchange amount'],
|
['生成实时数据失败', 'Failed to generate market data'],
|
['状态不是整数', 'Status must be an integer'],
|
['状态不能小于0', 'Status cannot be negative'],
|
['证件号码长度超过50', 'ID number exceeds 50 characters'],
|
['实名姓名长度超过50', 'Real name exceeds 50 characters'],
|
['账号或密码不正确', 'Incorrect username or password'],
|
['请重新登录', 'Please log in again'],
|
['操作失败,请稍后再试', 'Operation failed, please try again later'],
|
['当前币对不存在', 'Trading pair does not exist'],
|
['未开放合约交易', 'Contract trading is not available'],
|
['停牌禁止交易', 'Trading suspended for this symbol'],
|
['当前已经休市', 'Market is closed'],
|
['订单不存在', 'Order does not exist'],
|
['追加保证金异常', 'Failed to add margin'],
|
['委托单不存在', 'Order does not exist'],
|
['执行撤单异常', 'Failed to cancel order'],
|
['无网络', 'Network unavailable'],
|
['无权限', 'Permission denied'],
|
['请登录!', 'Please log in'],
|
['支付币种不正确', 'Invalid payment currency'],
|
['提交失败,当前有未处理订单', 'Submission failed, pending order exists'],
|
['用户未结束订单数量已达上限', 'Too many open orders'],
|
['今日取消订单次数太多了,请明日再试', 'Too many cancellations today, try again tomorrow'],
|
['广告不存在', 'Advertisement does not exist'],
|
['支付方式不存在', 'Payment method does not exist'],
|
['订单类型不正确', 'Invalid order type'],
|
['支付金额不正确', 'Invalid payment amount'],
|
['币种数量不正确', 'Invalid currency amount'],
|
['承兑商的用户信息不存在', 'Merchant user info does not exist'],
|
['请先通过高级认证', 'Advanced verification required'],
|
['流水小于限额', 'Transaction volume below minimum limit'],
|
['用户不能取消提现', 'Withdrawal cannot be cancelled'],
|
['充值或提现不正确', 'Invalid deposit or withdrawal type'],
|
['订单状态不正确', 'Invalid order status'],
|
['承兑商不存在', 'Merchant does not exist'],
|
['C2C广告id不正确', 'Invalid C2C advertisement ID'],
|
['请上传图片', 'Please upload an image'],
|
['提交失败,当前有未处理银行卡订单', 'Submission failed, pending bank order exists'],
|
['申诉订单号不正确', 'Invalid appeal order number'],
|
['请输入申诉原因', 'Please enter appeal reason'],
|
['请上传申诉凭证', 'Please upload appeal evidence'],
|
['该订单已提交申诉', 'Appeal already submitted for this order'],
|
['申诉不存在', 'Appeal does not exist'],
|
['订单号不能未空', 'Order number is required'],
|
['当前支付方式有未处理完成的订单!', 'Pending orders exist for this payment method'],
|
['广告id不正确', 'Invalid advertisement ID'],
|
['承兑商支付方式未配置', 'Merchant payment method not configured'],
|
['承兑商广告支付方式未配置', 'Merchant ad payment method not configured'],
|
['图片大小不能超过4M', 'Image size cannot exceed 4MB'],
|
['文件上传失败', 'File upload failed'],
|
['实名认证未通过,无法进行高级认证', 'Real-name verification required before advanced verification'],
|
['工作地址长度超过245', 'Work address exceeds 245 characters'],
|
['家庭地址长度超过245', 'Home address exceeds 245 characters'],
|
['该自选组名称已经使用', 'Watchlist name already in use'],
|
['已经添加过该分组了', 'Group already added'],
|
['自选组不存在', 'Watchlist group does not exist'],
|
['谷歌验证码未绑定', 'Google Authenticator is not bound'],
|
['谷歌验证码错误', 'Incorrect Google Authenticator code'],
|
['用户不存在', 'User does not exist'],
|
['推广码不存在', 'Promotion code does not exist'],
|
['推广码已失效', 'Promotion code has expired'],
|
['参数错误!', 'Invalid parameters'],
|
];
|
|
function walk(dir, files = []) {
|
for (const name of fs.readdirSync(dir)) {
|
const p = path.join(dir, name);
|
if (fs.statSync(p).isDirectory()) walk(p, files);
|
else if (name.endsWith('.java')) files.push(p);
|
}
|
return files;
|
}
|
|
let count = 0;
|
for (const file of walk(apiRoot)) {
|
let text = fs.readFileSync(file, 'utf8');
|
const orig = text;
|
text = text.replace(/最低下单金额:/g, 'Minimum order amount: ');
|
text = text.replace(/最低下单金额:/g, 'Minimum order amount: ');
|
const sorted = [...pairs].sort((a, b) => b[0].length - a[0].length);
|
for (const [zh, en] of sorted) {
|
text = text.split(`YamiShopBindException("${zh}")`).join(`YamiShopBindException("${en}")`);
|
text = text.split(`new YamiShopBindException("${zh}")`).join(`new YamiShopBindException("${en}")`);
|
}
|
if (text !== orig) {
|
fs.writeFileSync(file, text, 'utf8');
|
count++;
|
console.log(file);
|
}
|
}
|
console.log('Updated', count, 'files');
|