const fs = require('fs');
|
const path = require('path');
|
|
const root = path.join(__dirname, '..');
|
|
const translations = {
|
'参数错误!': 'Invalid parameters!',
|
'参数错误': 'Invalid parameters',
|
'参数异常': 'Invalid parameters',
|
'参数不存在': 'Parameter does not exist',
|
'用户不存在!': 'User does not exist!',
|
'用户不存在': 'User does not exist',
|
'已操作过了!': 'Already processed!',
|
'充值数量不得小于最小限额': 'Recharge amount must not be less than the minimum limit',
|
'充值数量不得大于最大限额': 'Recharge amount must not exceed the maximum limit',
|
'余额不足': 'Insufficient balance',
|
'请输入正确的推荐码': 'Please enter a valid referral code',
|
'推荐人无权限推荐': 'Referrer is not authorized to refer',
|
'用户名重复': 'Username already exists',
|
'操作失败!修正后账户余额小于0。': 'Operation failed! Adjusted account balance is less than 0.',
|
'操作失败!修正后账户锁定余额小于0。': 'Operation failed! Adjusted locked balance is less than 0.',
|
'操作失败!修正后账户冻结余额小于0。': 'Operation failed! Adjusted frozen balance is less than 0.',
|
'请输入正确的手机号码': 'Please enter a valid phone number',
|
'电话号码已绑定其他用户': 'Phone number is already bound to another user',
|
'推荐码不正确': 'Invalid referral code',
|
'谷歌验证码错误!': 'Incorrect Google Authenticator code!',
|
'谷歌验证码错误': 'Incorrect Google Authenticator code',
|
'登录人资金密码错误': 'Incorrect operator fund password',
|
'用户谷歌验证码未绑定!': 'User Google Authenticator is not bound!',
|
'请填入有效数字': 'Please enter a valid number',
|
'修改后金额不能小于0': 'Adjusted amount cannot be less than 0',
|
'请选择转移类型': 'Please select transfer type',
|
'请输入推荐码': 'Please enter referral code',
|
'手机号格式不正常!': 'Invalid phone number format!',
|
'手机号已存在!': 'Phone number already exists!',
|
'邮箱已存在!': 'Email already exists!',
|
'账号已存在!': 'Account already exists!',
|
'用户名不合法!': 'Invalid username!',
|
'注册失败!': 'Registration failed!',
|
'操作钱包失败!': 'Wallet operation failed!',
|
'当前登录账号不存在!': 'Current login account does not exist!',
|
'登录失败': 'Login failed',
|
'密码不正确': 'Incorrect password',
|
'账号不存在': 'Account does not exist',
|
'验证码不正确': 'Incorrect verification code',
|
'密码不正确!': 'Incorrect password!',
|
'资金密码不正确!': 'Incorrect fund password!',
|
'请输入正确的邮箱地址': 'Please enter a valid email address',
|
'邮箱已重复': 'Email already exists',
|
'不在交易时段': 'Outside trading hours',
|
'未开放合约交易': 'Contract trading is not enabled',
|
'停牌禁止交易': 'Trading suspended',
|
'可平仓合约数量不足': 'Insufficient closable contract quantity',
|
'杠杠倍数不存在': 'Leverage multiplier does not exist',
|
'系统错误,请稍后重试': 'System error, please try again later',
|
'您已存在订单': 'You already have an order',
|
'仓位不足': 'Insufficient position',
|
'客服不存在!': 'Customer service agent does not exist!',
|
'客服不存在': 'Customer service agent does not exist',
|
'系统存在相同[系统登录名]!': 'A user with the same system login name already exists!',
|
'谷歌验证码不能为空': 'Google Authenticator code is required',
|
'withdraw_limit_num不能为空': 'withdraw_limit_num cannot be empty',
|
'withdraw_limit不能为空': 'withdraw_limit cannot be empty',
|
'withdraw_limit_turnover_percent不能为空': 'withdraw_limit_turnover_percent cannot be empty',
|
'withdraw_limit_max不能为空': 'withdraw_limit_max cannot be empty',
|
'withdraw_limit_dapp不能为空': 'withdraw_limit_dapp cannot be empty',
|
'每日可提现次数不得小于0': 'Daily withdrawal count must not be less than 0',
|
'提现最低金额不得小于0': 'Minimum withdrawal amount must not be less than 0',
|
'提现限制流水按百分币不得小于0': 'Withdrawal turnover percentage must not be less than 0',
|
'最早提现时间不能为空': 'Earliest withdrawal time cannot be empty',
|
'最晚提现时间不能为空': 'Latest withdrawal time cannot be empty',
|
'最低提现额度不得小于0': 'Minimum withdrawal limit must not be less than 0',
|
'充值最低金额不得小于0': 'Minimum recharge amount must not be less than 0',
|
'充值最高金额不得小于0或小于充值最低金额': 'Maximum recharge amount must not be less than 0 or less than the minimum recharge amount',
|
'币币交易买入手续费不得小于0': 'Spot buy fee must not be less than 0',
|
'币币交易卖出手续费不得小于0': 'Spot sell fee must not be less than 0',
|
'交割合约赢率不得小于0': 'Delivery contract win rate must not be less than 0',
|
'杠杆倍数不能为空': 'Leverage multiplier cannot be empty',
|
'杠杆倍数必须是数字': 'Leverage multiplier must be a number',
|
'杠杆倍数必须大于1': 'Leverage multiplier must be greater than 1',
|
'委托已完成无法撤销': 'Order is completed and cannot be cancelled',
|
'委托单不存在或请稍后再试': 'Order does not exist, please try again later',
|
'委托已完成无法操作': 'Order is completed and cannot be operated',
|
'委托并非限价单,无法限价成交': 'Order is not a limit order and cannot be filled at limit price',
|
'账变金额必填': 'Balance change amount is required',
|
'账变金额输入错误,请输入浮点数': 'Invalid balance change amount, please enter a decimal number',
|
'账变金额不能小于等于0': 'Balance change amount must be greater than 0',
|
'请输入资金密码': 'Please enter fund password',
|
'请选择转移方向': 'Please select transfer direction',
|
'请选择转移币种': 'Please select transfer currency',
|
'请稍后再试': 'Please try again later',
|
'程序错误': 'Program error',
|
'展示图片不能为空': 'Display image cannot be empty',
|
'支付方式模板不存在': 'Payment method template does not exist',
|
'支付方式不存在': 'Payment method does not exist',
|
'支付方式数量已达上限': 'Payment method limit reached',
|
'内容名称不能为空': 'Content name cannot be empty',
|
'要翻译的内容不能为空': 'Content to translate cannot be empty',
|
'翻译不能为空': 'Translation cannot be empty',
|
'暂无用户': 'No users available',
|
'请输入内容': 'Please enter content',
|
'订单号不能未空': 'Order number cannot be empty',
|
'用户承兑商:用户UID不存在': 'User merchant: user UID does not exist',
|
'后台承兑商:注册失败': 'Backend merchant: registration failed',
|
'承兑商类型不正确': 'Invalid merchant type',
|
'承兑商不存在': 'Merchant does not exist',
|
'承兑商参数基础设置不存在': 'Merchant base settings do not exist',
|
'承兑商的用户信息不存在': 'Merchant user info does not exist',
|
'修改方式不正确': 'Invalid modification method',
|
'修改额度未填或格式不正确': 'Modification amount is empty or invalid',
|
'提现额度不能超过总保证金和剩余保证金': 'Withdrawal limit cannot exceed total and remaining margin',
|
'C2C管理员PARTY_ID为空': 'C2C admin PARTY_ID is empty',
|
'承兑商ID为空': 'Merchant ID is empty',
|
'交易币种数量未填或格式不正确': 'Trading currency amount is empty or invalid',
|
'币种单价未填或格式不正确': 'Currency unit price is empty or invalid',
|
'广告数量已达上限': 'Advertisement limit reached',
|
'交易币种数量不能大于最大可交易数量': 'Trading currency amount cannot exceed maximum tradable amount',
|
'单笔订单支付金额下限错误': 'Invalid minimum payment amount per order',
|
'单笔订单支付金额上限错误': 'Invalid maximum payment amount per order',
|
'广告保证金不能小于0': 'Advertisement margin cannot be less than 0',
|
'广告不存在': 'Advertisement does not exist',
|
'广告还有未完结订单,不能修改': 'Advertisement has open orders and cannot be modified',
|
'广告还有未处理的订单申诉,不能修改': 'Advertisement has pending appeals and cannot be modified',
|
'广告保证金增加差值不能大于承兑商剩余总保证金': 'Margin increase cannot exceed merchant remaining total margin',
|
'广告id不正确': 'Invalid advertisement ID',
|
'资金密码错误': 'Incorrect fund password',
|
'广告还有未完结订单,不能关闭': 'Advertisement has open orders and cannot be closed',
|
'广告还有未处理的订单申诉,不能关闭': 'Advertisement has pending appeals and cannot be closed',
|
'k线图初始化失败': 'K-line chart initialization failed',
|
'保存场控失败:': 'Failed to save market control:',
|
'申诉已处理了': 'Appeal has already been processed',
|
'订单已操作,请不要重复操作!': 'Order already processed, please do not repeat!',
|
'无权限': 'Permission denied',
|
'无网络': 'No network connection',
|
'未基础认证': 'Basic verification not completed',
|
'请先通过高级认证': 'Please complete advanced verification first',
|
'未安全认证,无提现权限': 'Security verification not completed, no withdrawal permission',
|
'无提现权限': 'No withdrawal permission',
|
'提现不得大于限额': 'Withdrawal amount cannot exceed the limit',
|
'推荐人UID错误': 'Invalid referrer UID',
|
'执行撤单异常': 'Failed to cancel order',
|
'文件上传失败': 'File upload failed',
|
'AES解密错误': 'AES decryption error',
|
'该用户已存在': 'User already exists',
|
'代理商不存在!': 'Agent does not exist!',
|
'新币不存在': 'New coin does not exist',
|
'申请数量不能为空': 'Application quantity cannot be empty',
|
'未开售': 'Not yet on sale',
|
'已结束': 'Already ended',
|
'请先缴清待补资金': 'Please pay outstanding supplementary funds first',
|
'请输入参数': 'Please enter parameters',
|
'记录不存在': 'Record does not exist',
|
'不能更改申购状态': 'Subscription status cannot be changed',
|
'中签数量不能小于0': 'Allotted quantity cannot be less than 0',
|
'配置中签数量不能超过申请数量': 'Configured allotted quantity cannot exceed application quantity',
|
'当前为开市时间,不能删除': 'Market is open, deletion is not allowed',
|
'没有满足条件的趋势图': 'No trend chart matching the criteria',
|
'行情获取异常,请重试': 'Failed to fetch market data, please try again',
|
'合约参数不存在': 'Contract parameter does not exist',
|
'交易参数不存在': 'Trading parameter does not exist',
|
'订单不存在': 'Order does not exist',
|
'系统繁忙,请稍后重试': 'System busy, please try again later',
|
'操作类型不正确': 'Invalid operation type',
|
'资金密码不能为空': 'Fund password cannot be empty',
|
'资金密码不符合设定': 'Fund password does not meet requirements',
|
'资金密码确认不能为空': 'Fund password confirmation cannot be empty',
|
'两次输入的资金密码不相同': 'Fund passwords do not match',
|
'实名认证尚未通过,无法重置': 'Identity verification not passed, cannot reset',
|
'您的申请之前已提交过': 'Your application has already been submitted',
|
'申请不存在,或请刷新重试': 'Application does not exist, please refresh and try again',
|
'认证尚未通过,无法重置': 'Verification not passed, cannot reset',
|
'订单已完成,无法放行': 'Order completed, cannot release',
|
'订单已取消,无法放行': 'Order cancelled, cannot release',
|
'该订单已取消': 'Order has been cancelled',
|
'该订单已完成': 'Order has been completed',
|
'广告已下架': 'Advertisement has been delisted',
|
'用户信息不存在': 'User info does not exist',
|
'支付方式不匹配该用户': 'Payment method does not match this user',
|
'支付方式不匹配该承兑商': 'Payment method does not match this merchant',
|
'买卖方式不正确': 'Invalid buy/sell method',
|
'金额不在购买区间': 'Amount is outside purchase range',
|
'用户剩余数量不足': 'Insufficient user remaining quantity',
|
'该广告剩余数量不足': 'Insufficient advertisement remaining quantity',
|
'订单不处于待支付或申诉中状态,无法转账': 'Order is not pending payment or appeal, cannot transfer',
|
'充值或提现不正确': 'Invalid deposit or withdrawal type',
|
'提交失败,当前有未处理USDT订单': 'Submission failed, pending USDT order exists',
|
'提交失败,当前有未处理银行卡订单': 'Submission failed, pending bank card order exists',
|
'验证码不能为空': 'Verification code cannot be empty',
|
'超级管理员谷歌验证码错误': 'Incorrect super admin Google Authenticator code',
|
'资金密码未设置!': 'Fund password is not set!',
|
'系统错误!': 'System error!',
|
'菜单URL不能为空': 'Menu URL cannot be empty',
|
'自己不能是自己的上级': 'Cannot set yourself as parent',
|
'上级菜单只能为目录类型': 'Parent menu must be a directory',
|
'上级菜单只能为菜单类型': 'Parent menu must be a menu type',
|
'调整偏差过大,超过10%': 'Adjustment deviation too large, exceeds 10%',
|
'此币还没有发行时间': 'This coin has no issue time yet',
|
'充值链错误': 'Invalid recharge chain',
|
'资金密码已经设置过了!': 'Fund password has already been set!',
|
'用户未绑定,无需解绑': 'User is not bound, no need to unbind',
|
'目标用户不属于登录人下级': 'Target user is not a subordinate of the logged-in user',
|
'k线图获取失败': 'Failed to fetch K-line chart',
|
'最低投资额: ': 'Minimum investment: ',
|
'最高投资额: ': 'Maximum investment: ',
|
};
|
|
const chineseRe = /[\u4e00-\u9fff]/;
|
const sortedKeys = Object.keys(translations).sort((a, b) => b.length - a.length);
|
|
function walk(dir, files = []) {
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
if (entry.name === 'target' || entry.name === '.git' || entry.name === 'node_modules') continue;
|
const full = path.join(dir, entry.name);
|
if (entry.isDirectory()) walk(full, files);
|
else if (entry.name.endsWith('.java')) files.push(full);
|
}
|
return files;
|
}
|
|
let updatedFiles = 0;
|
const remaining = new Set();
|
|
for (const file of walk(root)) {
|
let content = fs.readFileSync(file, 'utf8');
|
const original = content;
|
for (const cn of sortedKeys) {
|
const en = translations[cn];
|
content = content.split(`throw new YamiShopBindException("${cn}")`).join(`throw new YamiShopBindException("${en}")`);
|
content = content.split(`throw new YamiShopBindException('${cn}')`).join(`throw new YamiShopBindException('${en}')`);
|
content = content.split(`throw new YamiShopBindException(1001,"${cn}")`).join(`throw new YamiShopBindException(1001,"${en}")`);
|
content = content.split(`throw new YamiShopBindException(1, "${cn}")`).join(`throw new YamiShopBindException(1, "${en}")`);
|
content = content.split(`throw new YamiShopBindException(1,"${cn}")`).join(`throw new YamiShopBindException(1,"${en}")`);
|
}
|
if (content !== original) {
|
fs.writeFileSync(file, content, 'utf8');
|
updatedFiles++;
|
}
|
const matches = content.match(/throw new YamiShopBindException\([^)]+\)/g) || [];
|
for (const m of matches) {
|
if (chineseRe.test(m)) remaining.add(m.trim());
|
}
|
}
|
|
console.log(`Updated ${updatedFiles} files`);
|
if (remaining.size) {
|
console.log('Remaining Chinese exceptions:');
|
for (const r of [...remaining].sort()) console.log(` ${r}`);
|
}
|