新版仿ok交易所-后端
1
zj
9 days ago 579177ac64462d0fec885eb10af3097245134f80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# -*- coding: utf-8 -*-
import os
import re
 
API_ROOT = os.path.join(
    os.path.dirname(os.path.dirname(__file__)),
    "trading-order-admin", "src", "main", "java", "com", "yami", "trading", "api",
)
 
ZH_TO_EN = {
    "参数错误": "Invalid parameters",
    "参数错误!": "Invalid parameters",
    "系统错误,请稍后重试": "System error, please try again later",
    "请稍后再试": "Please try again later",
    "操作失败,请稍后再试": "Operation failed, please try again later",
    "无权限": "Permission denied",
    "无网络": "Network unavailable",
    "请先登录": "Please log in first",
    "请登录!": "Please log in",
    "请重新登录": "Please log in again",
    "用户已禁用": "User account is disabled",
    "用户已禁用!": "User account is disabled",
    "校验IP不合法": "Invalid IP address",
    "账号或密码不正确": "Incorrect username or password",
    "用户名不能为空": "Username is required",
    "用户名不存在": "Username does not exist",
    "用户名参数为空": "Username is required",
    "密码不能为空": "Password is required",
    "密码必须6-12位": "Password must be 6-12 characters",
    "验证类型不能为空": "Verification type is required",
    "验证码不能为空": "Verification code is required",
    "验证码不正确": "Incorrect verification code",
    "请填写正确的电话号码": "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",
    "资金密码不能为空": "Fund password is required",
    "资金密码不符合设定": "Fund password does not meet requirements",
    "资金密码必须6-12位": "Fund password must be 6-12 characters",
    "资金密码错误": "Incorrect fund password",
    "旧资金密码不能为空": "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",
    "订单不存在!": "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 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",
    "当前币对不存在": "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",
    "支付币种不正确": "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",
    "用户已禁用!": "User account is disabled",
    "推广码不存在": "Promotion code does not exist",
    "推广码已失效": "Promotion code has expired",
}
 
 
def main():
    items = sorted(ZH_TO_EN.items(), key=lambda x: -len(x[0]))
    changed = 0
    for dirpath, _, files in os.walk(API_ROOT):
        for fn in files:
            if not fn.endswith(".java"):
                continue
            path = os.path.join(dirpath, fn)
            with open(path, "r", encoding="utf-8") as f:
                text = f.read()
            orig = text
            text = text.replace("最低下单金额:", "Minimum order amount: ")
            text = text.replace("最低下单金额:", "Minimum order amount: ")
            for zh, en in items:
                text = text.replace(f'YamiShopBindException("{zh}")', f'YamiShopBindException("{en}")')
                text = text.replace(f"new YamiShopBindException(\"{zh}\")", f'new YamiShopBindException("{en}")')
            if text != orig:
                with open(path, "w", encoding="utf-8", newline="\n") as f:
                    f.write(text)
                changed += 1
                print(path)
    print("updated files:", changed)
 
 
if __name__ == "__main__":
    main()