mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-02-06 10:44:25 +00:00
feat: initial official i18n support for backend
This commit is contained in:
parent
562964238c
commit
8f40e11c97
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ data
|
||||
cmd.md
|
||||
.env
|
||||
/one-api
|
||||
temp
|
72
common/i18n/i18n.go
Normal file
72
common/i18n/i18n.go
Normal file
@ -0,0 +1,72 @@
|
||||
package i18n
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
//go:embed locales/*.json
|
||||
var localesFS embed.FS
|
||||
|
||||
var (
|
||||
translations = make(map[string]map[string]string)
|
||||
defaultLang = "en"
|
||||
ContextKey = "i18n"
|
||||
)
|
||||
|
||||
// Init loads all translation files from embedded filesystem
|
||||
func Init() error {
|
||||
entries, err := localesFS.ReadDir("locales")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".json") {
|
||||
continue
|
||||
}
|
||||
|
||||
langCode := strings.TrimSuffix(entry.Name(), ".json")
|
||||
content, err := localesFS.ReadFile("locales/" + entry.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var translation map[string]string
|
||||
if err := json.Unmarshal(content, &translation); err != nil {
|
||||
return err
|
||||
}
|
||||
translations[langCode] = translation
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetLang(c *gin.Context) string {
|
||||
rawLang, ok := c.Get(ContextKey)
|
||||
if !ok {
|
||||
return defaultLang
|
||||
}
|
||||
lang, _ := rawLang.(string)
|
||||
if lang != "" {
|
||||
return lang
|
||||
}
|
||||
return defaultLang
|
||||
}
|
||||
|
||||
func Translate(c *gin.Context, message string) string {
|
||||
lang := GetLang(c)
|
||||
return translateHelper(lang, message)
|
||||
}
|
||||
|
||||
func translateHelper(lang, message string) string {
|
||||
if trans, ok := translations[lang]; ok {
|
||||
if translated, exists := trans[message]; exists {
|
||||
return translated
|
||||
}
|
||||
}
|
||||
return message
|
||||
}
|
11
common/i18n/locales/en.json
Normal file
11
common/i18n/locales/en.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": "Success",
|
||||
"unauthorized": "Unauthorized",
|
||||
"forbidden": "Forbidden",
|
||||
"invalid_token": "Invalid token",
|
||||
"channel_not_found": "Channel not found",
|
||||
"invalid_request": "Invalid request",
|
||||
"internal_error": "Internal server error",
|
||||
"quota_exceeded": "Quota exceeded",
|
||||
"invalid_input": "Invalid input, please check your input"
|
||||
}
|
11
common/i18n/locales/zh-CN.json
Normal file
11
common/i18n/locales/zh-CN.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"success": "成功",
|
||||
"unauthorized": "未授权",
|
||||
"forbidden": "禁止访问",
|
||||
"invalid_token": "无效的令牌",
|
||||
"channel_not_found": "未找到渠道",
|
||||
"invalid_request": "无效的请求",
|
||||
"internal_error": "服务器内部错误",
|
||||
"quota_exceeded": "配额已用尽",
|
||||
"invalid_input": "无效的输入,请检查您的输入"
|
||||
}
|
@ -3,17 +3,19 @@ package controller
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/songquanpeng/one-api/common"
|
||||
"github.com/songquanpeng/one-api/common/config"
|
||||
"github.com/songquanpeng/one-api/common/ctxkey"
|
||||
"github.com/songquanpeng/one-api/common/random"
|
||||
"github.com/songquanpeng/one-api/model"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/songquanpeng/one-api/common"
|
||||
"github.com/songquanpeng/one-api/common/config"
|
||||
"github.com/songquanpeng/one-api/common/ctxkey"
|
||||
"github.com/songquanpeng/one-api/common/i18n"
|
||||
"github.com/songquanpeng/one-api/common/random"
|
||||
"github.com/songquanpeng/one-api/model"
|
||||
)
|
||||
|
||||
type LoginRequest struct {
|
||||
@ -136,7 +138,7 @@ func Register(c *gin.Context) {
|
||||
if err := common.Validate.Struct(&user); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": false,
|
||||
"message": "输入不合法 " + err.Error(),
|
||||
"message": i18n.Translate(c, "invalid_input"),
|
||||
})
|
||||
return
|
||||
}
|
||||
@ -379,7 +381,7 @@ func UpdateUser(c *gin.Context) {
|
||||
if err := common.Validate.Struct(&updatedUser); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": false,
|
||||
"message": "输入不合法 " + err.Error(),
|
||||
"message": i18n.Translate(c, "invalid_input"),
|
||||
})
|
||||
return
|
||||
}
|
||||
@ -550,7 +552,7 @@ func CreateUser(c *gin.Context) {
|
||||
if err := common.Validate.Struct(&user); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": false,
|
||||
"message": "输入不合法 " + err.Error(),
|
||||
"message": i18n.Translate(c, "invalid_input"),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
778
i18n/en.json
778
i18n/en.json
@ -1,778 +0,0 @@
|
||||
{
|
||||
"$%.6f 额度": "$%.6f quota",
|
||||
"%d 点额度": "%d point quota",
|
||||
"尚未实现": "Not yet implemented",
|
||||
"余额不足": "Insufficient balance",
|
||||
"危险操作": "Hazardous operations",
|
||||
"输入你的账户名": "Enter your account name",
|
||||
"确认删除": "Confirm Delete",
|
||||
"确认绑定": "Confirm Binding",
|
||||
"您正在删除自己的帐户,将清空所有数据且不可恢复": "You are deleting your account, all data will be cleared and unrecoverable.",
|
||||
"\"渠道「%s」(#%d)已被禁用\"": "\"Channel %s (#%d) has been disabled\"",
|
||||
"渠道「%s」(#%d)已被禁用,原因:%s": "Channel %s (#%d) has been disabled, reason: %s",
|
||||
"测试已在运行中": "Test is already running",
|
||||
"响应时间 %.2fs 超过阈值 %.2fs": "Response time %.2fs exceeds threshold %.2fs",
|
||||
"渠道测试完成": "Channel test completed",
|
||||
"渠道测试完成,如果没有收到禁用通知,说明所有渠道都正常": "Channel test completed, if you have not received the disable notification, it means that all channels are normal",
|
||||
"无法连接至 GitHub 服务器,请稍后重试!": "Unable to connect to GitHub server, please try again later!",
|
||||
"返回值非法,用户字段为空,请稍后重试!": "The return value is illegal, the user field is empty, please try again later!",
|
||||
"管理员未开启通过 GitHub 登录以及注册": "The administrator did not turn on login and registration via GitHub",
|
||||
"管理员关闭了新用户注册": "The administrator has turned off new user registration",
|
||||
"用户已被封禁": "User has been banned",
|
||||
"该 GitHub 账户已被绑定": "The GitHub account has been bound",
|
||||
"邮箱地址已被占用": "Email address is occupied",
|
||||
"%s邮箱验证邮件": "%s Email verification email",
|
||||
"<p>您好,你正在进行%s邮箱验证。</p>": "<p>Hello, you are verifying %s email.</p>",
|
||||
"<p>您的验证码为: <strong>%s</strong></p>": "<p>Your verification code is: <strong>%s</strong></p>",
|
||||
"<p>验证码 %d 分钟内有效,如果不是本人操作,请忽略。</p>": "<p>The verification code is valid within %d minutes. If it is not your operation, please ignore it.</p>",
|
||||
"无效的参数": "Invalid parameter",
|
||||
"该邮箱地址未注册": "The email address is not registered",
|
||||
"%s密码重置": "%s Password reset",
|
||||
"<p>您好,你正在进行%s密码重置。</p>": "<p>Hello, you are resetting %s password.</p>",
|
||||
"<p>点击<a href='%s'>此处</a>进行密码重置。</p>": "<p>Click <a href='%s'>here</a> to reset your password.</p>",
|
||||
"<p>重置链接 %d 分钟内有效,如果不是本人操作,请忽略。</p>": "<p>The reset link is valid within %d minutes. If it is not your operation, please ignore it.</p>",
|
||||
"重置链接非法或已过期": "Reset link is illegal or expired",
|
||||
"无法启用 GitHub OAuth,请先填入 GitHub Client ID 以及 GitHub Client Secret!": "Unable to enable GitHub OAuth, please fill in GitHub Client ID and GitHub Client Secret first!",
|
||||
"无法启用微信登录,请先填入微信登录相关配置信息!": "Unable to enable WeChat login, please fill in the relevant configuration information for WeChat login first!",
|
||||
"无法启用 Turnstile 校验,请先填入 Turnstile 校验相关配置信息!": "Unable to enable Turnstile verification, please fill in the relevant configuration information for Turnstile verification first!",
|
||||
"兑换码名称长度必须在1-20之间": "The length of the redemption code name must be between 1-20",
|
||||
"兑换码个数必须大于0": "The number of redemption codes must be greater than 0",
|
||||
"一次兑换码批量生成的个数不能大于 100": "The number of redemption codes generated in a batch cannot be greater than 100",
|
||||
"通过令牌「%s」使用模型 %s 消耗 %s(模型倍率 %.2f,分组倍率 %.2f)": "Using model %s with token %s consumes %s (model rate %.2f, group rate %.2f)",
|
||||
"当前分组上游负载已饱和,请稍后再试": "The current group load is saturated, please try again later",
|
||||
"令牌名称过长": "Token name is too long",
|
||||
"令牌已过期,无法启用,请先修改令牌过期时间,或者设置为永不过期": "The token has expired and cannot be enabled. Please modify the expiration time of the token, or set it to never expire.",
|
||||
"令牌可用额度已用尽,无法启用,请先修改令牌剩余额度,或者设置为无限额度": "The available quota of the token has been used up and cannot be enabled. Please modify the remaining quota of the token, or set it to unlimited quota",
|
||||
"管理员关闭了密码登录": "The administrator has turned off password login",
|
||||
"无法保存会话信息,请重试": "Unable to save session information, please try again",
|
||||
"管理员关闭了通过密码进行注册,请使用第三方账户验证的形式进行注册": "The administrator has turned off registration via password. Please use the form of third-party account verification to register",
|
||||
"输入不合法 ": "Input is illegal ",
|
||||
"管理员开启了邮箱验证,请输入邮箱地址和验证码": "The administrator has turned on email verification, please enter the email address and verification code",
|
||||
"验证码错误或已过期": "Verification code error or expired",
|
||||
"无权获取同级或更高等级用户的信息": "No permission to get information of users at the same level or higher",
|
||||
"请重试,系统生成的 UUID 竟然重复了!": "Please try again, the system-generated UUID is actually duplicated!",
|
||||
"输入不合法": "Input is illegal",
|
||||
"无权更新同权限等级或更高权限等级的用户信息": "No permission to update user information with the same permission level or higher permission level",
|
||||
"管理员将用户额度从 %s修改为 %s": "The administrator changed the user quota from %s to %s",
|
||||
"无权删除同权限等级或更高权限等级的用户": "No permission to delete users with the same permission level or higher permission level",
|
||||
"无法创建权限大于等于自己的用户": "Unable to create users with permissions greater than or equal to your own",
|
||||
"用户不存在": "User does not exist",
|
||||
"无法禁用超级管理员用户": "Unable to disable super administrator user",
|
||||
"无法删除超级管理员用户": "Unable to delete super administrator user",
|
||||
"普通管理员用户无法提升其他用户为管理员": "Ordinary administrator users cannot promote other users to administrators",
|
||||
"该用户已经是管理员": "The user is already an administrator",
|
||||
"无法降级超级管理员用户": "Unable to downgrade super administrator user",
|
||||
"该用户已经是普通用户": "The user is already an ordinary user",
|
||||
"管理员未开启通过微信登录以及注册": "The administrator has not enabled login and registration via WeChat",
|
||||
"该微信账号已被绑定": "The WeChat account has been bound",
|
||||
"无权进行此操作,未登录且未提供 access token": "No permission to perform this operation, not logged in and no access token provided",
|
||||
"无权进行此操作,access token 无效": "No permission to perform this operation, access token is invalid",
|
||||
"无权进行此操作,权限不足": "No permission to perform this operation, insufficient permissions",
|
||||
"普通用户不支持指定渠道": "Ordinary users do not support specifying channels",
|
||||
"无效的渠道 ID": "Invalid channel ID",
|
||||
"该渠道已被禁用": "The channel has been disabled",
|
||||
"无效的请求": "Invalid request",
|
||||
"无可用渠道": "No available channels",
|
||||
"Turnstile token 为空": "Turnstile token is empty",
|
||||
"Turnstile 校验失败,请刷新重试!": "Turnstile verification failed, please refresh and try again!",
|
||||
"id 为空!": "id is empty!",
|
||||
"未提供兑换码": "No redemption code provided",
|
||||
"无效的 user id": "Invalid user id",
|
||||
"无效的兑换码": "Invalid redemption code",
|
||||
"该兑换码已被使用": "The redemption code has been used",
|
||||
"通过兑换码充值 %s": "Recharge %s through redemption code",
|
||||
"未提供令牌": "No token provided",
|
||||
"该令牌状态不可用": "The token status is not available",
|
||||
"该令牌已过期": "The token has expired",
|
||||
"该令牌额度已用尽": "The token quota has been used up",
|
||||
"无效的令牌": "Invalid token",
|
||||
"令牌验证失败": "Token verification failed",
|
||||
"id 或 userId 为空!": "id or userId is empty!",
|
||||
"quota 不能为负数!": "quota cannot be negative!",
|
||||
"令牌额度不足": "Insufficient token quota",
|
||||
"用户额度不足": "Insufficient user quota",
|
||||
"您的额度即将用尽": "Your quota is about to run out",
|
||||
"您的额度已用尽": "Your quota has been used up",
|
||||
"%s,当前剩余额度为 %d,为了不影响您的使用,请及时充值。<br/>充值链接:<a href='%s'>%s</a>": "%s, the current remaining quota is %d, in order not to affect your use, please recharge in time. <br/> Recharge link: <a href='%s'>%s</a>",
|
||||
"affCode 为空!": "affCode is empty!",
|
||||
"新用户注册赠送 %s": "New user registration gives %s",
|
||||
"使用邀请码赠送 %s": "Use invitation code to give %s",
|
||||
"邀请用户赠送 %s": "Invite users to give %s",
|
||||
"用户名或密码为空": "Username or password is empty",
|
||||
"用户名或密码错误,或用户已被封禁": "Username or password is wrong, or user has been banned",
|
||||
"email 为空!": "email is empty!",
|
||||
"GitHub id 为空!": "GitHub id is empty!",
|
||||
"WeChat id 为空!": "WeChat id is empty!",
|
||||
"username 为空!": "username is empty!",
|
||||
"邮箱地址或密码为空!": "Email address or password is empty!",
|
||||
"OpenAI 接口聚合管理,支持多种渠道包括 Azure,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用": "OpenAI interface aggregation management, supports multiple channels including Azure, can be used for secondary distribution management key, only single executable file, Docker image has been packaged, one-click deployment, out of the box",
|
||||
"未知类型": "Unknown type",
|
||||
"不支持": "Not supported",
|
||||
"操作成功完成!": "Operation completed successfully!",
|
||||
"已启用": "Enabled",
|
||||
"已禁用": "Disabled",
|
||||
"未知状态": "Unknown status",
|
||||
" 秒": "s",
|
||||
" 分钟 ": " m ",
|
||||
" 小时 ": " h ",
|
||||
" 天 ": " d ",
|
||||
" 个月 ": " M ",
|
||||
" 年 ": " y ",
|
||||
"未测试": "Not tested",
|
||||
"渠道 ${name} 测试成功,耗时 ${time.toFixed(2)} 秒。": "Channel ${name} test succeeded, time consumed ${time.toFixed(2)} s.",
|
||||
"已成功开始测试所有渠道,请刷新页面查看结果。": "All channels have been successfully tested, please refresh the page to view the results.",
|
||||
"已成功开始测试所有已启用渠道,请刷新页面查看结果。": "All enabled channels have been successfully tested, please refresh the page to view the results.",
|
||||
"渠道 ${name} 余额更新成功!": "Channel ${name} balance updated successfully!",
|
||||
"已更新完毕所有已启用渠道余额!": "The balance of all enabled channels has been updated!",
|
||||
"搜索渠道的 ID,名称和密钥 ...": "Search for channel ID, name and key ...",
|
||||
"名称": "Name",
|
||||
"分组": "Group",
|
||||
"类型": "Type",
|
||||
"状态": "Status",
|
||||
"响应时间": "Response time",
|
||||
"余额": "Balance",
|
||||
"操作": "Operation",
|
||||
"未更新": "Not updated",
|
||||
"测试": "Test",
|
||||
"更新余额": "Update balance",
|
||||
"删除": "Delete",
|
||||
"删除渠道 {channel.name}": "Delete channel {channel.name}",
|
||||
"禁用": "Disable",
|
||||
"启用": "Enable",
|
||||
"编辑": "Edit",
|
||||
"添加新的渠道": "Add a new channel",
|
||||
"测试所有渠道": "Test all channels",
|
||||
"测试所有已启用渠道": "Test all enabled channels",
|
||||
"更新所有已启用渠道余额": "Update the balance of all enabled channels",
|
||||
"刷新": "Refresh",
|
||||
"处理中...": "Processing...",
|
||||
"绑定成功!": "Binding succeeded!",
|
||||
"登录成功!": "Login succeeded!",
|
||||
"操作失败,重定向至登录界面中...": "Operation failed, redirecting to the login page...",
|
||||
"出现错误,第 ${count} 次重试中...": "An error occurred, retrying for the ${count} time...",
|
||||
"首页": "Home",
|
||||
"渠道": "Channel",
|
||||
"令牌": "Token",
|
||||
"兑换": "Redeem",
|
||||
"充值": "Recharge",
|
||||
"用户": "User",
|
||||
"日志": "Log",
|
||||
"设置": "Settings",
|
||||
"关于": "About",
|
||||
"聊天": "Chat",
|
||||
"注销成功!": "Logout succeeded!",
|
||||
"注销": "Logout",
|
||||
"登录": "Login",
|
||||
"注册": "Register",
|
||||
"加载{name}中...": "Loading {name}...",
|
||||
"未登录或登录已过期,请重新登录!": "Not logged in or login has expired, please log in again!",
|
||||
"用户登录": "User login",
|
||||
"\"用户名\"": "\"Username\"",
|
||||
"\"密码\"": "\"Password\"",
|
||||
"忘记密码?": "Forget password?",
|
||||
"点击重置": "Click to reset",
|
||||
"; 没有账户?": "; No account?",
|
||||
"点击注册": "Click to register",
|
||||
"微信扫码关注公众号,输入「验证码」获取验证码(三分钟内有效)": "Scan the QR code of WeChat to follow the official account, enter \"verification code\" to get the verification code (valid within three minutes)",
|
||||
"\"验证码\"": "\"Verification code\"",
|
||||
"全部用户": "All users",
|
||||
"当前用户": "Current user",
|
||||
"'全部'": "'All'",
|
||||
"'充值'": "'Recharge'",
|
||||
"'消费'": "'Consumption'",
|
||||
"'管理'": "'Management'",
|
||||
"'系统'": "'System'",
|
||||
" 充值 ": " Recharge ",
|
||||
" 消费 ": " Consumption ",
|
||||
" 管理 ": " Management ",
|
||||
" 系统 ": " System ",
|
||||
" 未知 ": " Unknown ",
|
||||
"时间": "Time",
|
||||
"详情": "Details",
|
||||
"选择模式": "Select mode",
|
||||
"选择明细分类": "Select details category",
|
||||
"模型倍率不是合法的 JSON 字符串": "Model rate is not a valid JSON string",
|
||||
"分组倍率不是合法的 JSON 字符串": "Group rate is not a valid JSON string",
|
||||
"通用设置": "General Settings",
|
||||
"充值链接": "Recharge Link",
|
||||
"例如发卡网站的购买链接": "For example, the purchase link of the card issuing website",
|
||||
"聊天页面链接": "Chat Page Link",
|
||||
"例如 ChatGPT Next Web 的部署地址": "For example, the deployment address of ChatGPT Next Web",
|
||||
"单位美元额度": "Unit Dollar Quota",
|
||||
"一单位货币能兑换的额度": "Quota that can be exchanged for one unit of currency",
|
||||
"启用额度消费日志记录": "Enable quota consumption log recording",
|
||||
"以货币形式显示额度": "Display quota in the form of currency",
|
||||
"相关 API 显示令牌额度而非用户额度": "Related API displays token quota instead of user quota",
|
||||
"保存通用设置": "Save General Settings",
|
||||
"监控设置": "Monitoring Settings",
|
||||
"最长响应时间": "Longest Response Time",
|
||||
"单位秒": "Unit in seconds",
|
||||
"当运行渠道全部测试时": "When all operating channels are tested",
|
||||
"超过此时间将自动禁用渠道": "Channels will be automatically disabled if this time is exceeded",
|
||||
"额度提醒阈值": "Quota reminder threshold",
|
||||
"低于此额度时将发送邮件提醒用户": "Email will be sent to remind users when the quota is below this",
|
||||
"失败时自动禁用渠道": "Automatically disable the channel when it fails",
|
||||
"保存监控设置": "Save Monitoring Settings",
|
||||
"额度设置": "Quota Settings",
|
||||
"新用户初始额度": "Initial quota for new users",
|
||||
"例如": "For example",
|
||||
"请求预扣费额度": "Request for pre-deducted quota",
|
||||
"请求结束后多退少补": "Refund more or less after the request ends",
|
||||
"邀请新用户奖励额度": "Invite new users to reward quota",
|
||||
"新用户使用邀请码奖励额度": "New user rewards quota using invitation code",
|
||||
"保存额度设置": "Save Quota Settings",
|
||||
"倍率设置": "Rate Settings",
|
||||
"模型倍率": "Model rate",
|
||||
"为一个 JSON 文本": "Is a JSON text",
|
||||
"键为模型名称": "Key is model name",
|
||||
"值为倍率": "Value is the rate",
|
||||
"分组倍率": "Group rate",
|
||||
"键为分组名称": "Key is group name",
|
||||
"保存倍率设置": "Save Rate Settings",
|
||||
"已是最新版本": "Is the latest version",
|
||||
"检查更新": "Check for updates",
|
||||
"公告": "Announcement",
|
||||
"在此输入新的公告内容,支持 Markdown & HTML 代码": "Enter the new announcement content here, supports Markdown & HTML code",
|
||||
"保存公告": "Save Announcement",
|
||||
"个性化设置": "Personalization Settings",
|
||||
"系统名称": "System Name",
|
||||
"在此输入系统名称": "Enter the system name here",
|
||||
"设置系统名称": "Set system name",
|
||||
"图片地址": "Image URL",
|
||||
"在此输入 Logo 图片地址": "Enter the Logo image URL here",
|
||||
"首页内容": "Home Page Content",
|
||||
"在此输入首页内容,支持 Markdown & HTML 代码,设置后首页的状态信息将不再显示。如果输入的是一个链接,则会使用该链接作为 iframe 的 src 属性,这允许你设置任意网页作为首页": "Enter the homepage content here, supports Markdown & HTML code. Once set, the status information of the homepage will not be displayed. If a link is entered, it will be used as the src attribute of the iframe, allowing you to set any webpage as the homepage.",
|
||||
"保存首页内容": "Save Home Page Content",
|
||||
"在此输入新的关于内容,支持 Markdown & HTML 代码。如果输入的是一个链接,则会使用该链接作为 iframe 的 src 属性,这允许你设置任意网页作为关于页面": "Enter new about content here, supports Markdown & HTML code. If a link is entered, it will be used as the src attribute of the iframe, allowing you to set any webpage as the about page.",
|
||||
"保存关于": "Save About",
|
||||
"移除 One API 的版权标识必须首先获得授权,项目维护需要花费大量精力,如果本项目对你有意义,请主动支持本项目": "Removal of One API copyright mark must first be authorized. Project maintenance requires a lot of effort. If this project is meaningful to you, please actively support it.",
|
||||
"页脚": "Footer",
|
||||
"在此输入新的页脚,留空则使用默认页脚,支持 HTML 代码": "Enter the new footer here, leave blank to use the default footer, supports HTML code.",
|
||||
"设置页脚": "Set Footer",
|
||||
"新版本": "New Version",
|
||||
"关闭": "Close",
|
||||
"密码已重置并已复制到剪贴板": "Password has been reset and copied to clipboard",
|
||||
"密码重置确认": "Password Reset Confirmation",
|
||||
"邮箱地址": "Email Address",
|
||||
"提交": "Submit",
|
||||
"请稍后几秒重试": "Please retry in a few seconds",
|
||||
"正在检查用户环境": "Checking user environment",
|
||||
"重置邮件发送成功": "Reset mail sent successfully",
|
||||
"请检查邮箱": "Please check your email",
|
||||
"密码重置": "Password Reset",
|
||||
"令牌已重置并已复制到剪贴板": "Token has been reset and copied to clipboard",
|
||||
"邀请链接已复制到剪切板": "Invitation link has been copied to clipboard",
|
||||
"微信账户绑定成功": "WeChat account binding succeeded",
|
||||
"验证码发送成功": "Verification code sent successfully",
|
||||
"邮箱账户绑定成功": "Email account binding succeeded",
|
||||
"注意": "Note",
|
||||
"此处生成的令牌用于系统管理": "The token generated here is used for system management",
|
||||
"而非用于请求 OpenAI 相关的服务": "Not for requesting OpenAI related services",
|
||||
"请知悉": "Please be aware",
|
||||
"更新个人信息": "Update Personal Information",
|
||||
"生成系统访问令牌": "Generate System Access Token",
|
||||
"复制邀请链接": "Copy Invitation Link",
|
||||
"账号绑定": "Account Binding",
|
||||
"绑定微信账号": "Bind WeChat Account",
|
||||
"微信扫码关注公众号": "Scan the QR code with WeChat to follow the official account",
|
||||
"输入": "Enter",
|
||||
"验证码": "Verification Code",
|
||||
"获取验证码": "Get Verification Code",
|
||||
"三分钟内有效": "Valid for three minutes",
|
||||
"绑定": "Bind",
|
||||
"绑定 GitHub 账号": "Bind GitHub Account",
|
||||
"绑定邮箱地址": "Bind Email Address",
|
||||
"输入邮箱地址": "Enter Email Address",
|
||||
"未使用": "Unused",
|
||||
"已使用": "Used",
|
||||
"操作成功完成": "Operation successfully completed",
|
||||
"搜索兑换码的 ID 和名称": "Search for ID and name",
|
||||
"额度": "Quota",
|
||||
"创建时间": "Creation Time",
|
||||
"兑换时间": "Redemption Time",
|
||||
"尚未兑换": "Not yet redeemed",
|
||||
"已复制到剪贴板": "Copied to clipboard",
|
||||
"无法复制到剪贴板": "Unable to copy to clipboard",
|
||||
"请手动复制": "Please copy manually",
|
||||
"已将兑换码填入搜索框": "The voucher code has been filled into the search box",
|
||||
"复制": "Copy",
|
||||
"添加新的兑换码": "Add a new voucher",
|
||||
"密码长度不得小于 8 位": "Password length must not be less than 8 characters",
|
||||
"两次输入的密码不一致": "The two passwords entered do not match",
|
||||
"注册成功": "Registration succeeded",
|
||||
"请稍后几秒重试,Turnstile 正在检查用户环境": "Please retry in a few seconds, Turnstile is checking user environment",
|
||||
"验证码发送成功,请检查你的邮箱": "Verification code sent successfully, please check your email",
|
||||
"新用户注册": "New User Registration",
|
||||
"输入用户名,最长 12 位": "Enter username, up to 12 characters",
|
||||
"输入密码,最短 8 位,最长 20 位": "Enter password, at least 8 characters and up to 20 characters",
|
||||
"输入验证码": "Enter Verification Code",
|
||||
"已有账户": "Already have an account",
|
||||
"点击登录": "Click to log in",
|
||||
"服务器地址": "Server Address",
|
||||
"更新服务器地址": "Update Server Address",
|
||||
"配置登录注册": "Configure Login/Registration",
|
||||
"允许通过密码进行登录": "Allow login via password",
|
||||
"允许通过密码进行注册": "Allow registration via password",
|
||||
"通过密码注册时需要进行邮箱验证": "Email verification is required when registering via password",
|
||||
"允许通过 GitHub 账户登录 & 注册": "Allow login & registration via GitHub account",
|
||||
"允许通过微信登录 & 注册": "Allow login & registration via WeChat",
|
||||
"允许新用户注册(此项为否时,新用户将无法以任何方式进行注册": "Allow new user registration (if this option is off, new users will not be able to register in any way",
|
||||
"启用 Turnstile 用户校验": "Enable Turnstile user verification",
|
||||
"配置 SMTP": "Configure SMTP",
|
||||
"用以支持系统的邮件发送": "To support the system email sending",
|
||||
"SMTP 服务器地址": "SMTP Server Address",
|
||||
"例如:smtp.qq.com": "For example: smtp.qq.com",
|
||||
"SMTP 端口": "SMTP Port",
|
||||
"默认: 587": "Default: 587",
|
||||
"SMTP 账户": "SMTP Account",
|
||||
"通常是邮箱地址": "Usually an email address",
|
||||
"发送者邮箱": "Sender email",
|
||||
"通常和邮箱地址保持一致": "Usually consistent with the email address",
|
||||
"SMTP 访问凭证": "SMTP Access Credential",
|
||||
"敏感信息不会发送到前端显示": "Sensitive information will not be displayed in the frontend",
|
||||
"保存 SMTP 设置": "Save SMTP Settings",
|
||||
"配置 GitHub OAuth App": "Configure GitHub OAuth App",
|
||||
"用以支持通过 GitHub 进行登录注册": "To support login & registration via GitHub",
|
||||
"点击此处": "Click here",
|
||||
"管理你的 GitHub OAuth App": "Manage your GitHub OAuth App",
|
||||
"输入你注册的 GitHub OAuth APP 的 ID": "Enter your registered GitHub OAuth APP ID",
|
||||
"保存 GitHub OAuth 设置": "Save GitHub OAuth Settings",
|
||||
"配置 WeChat Server": "Configure WeChat Server",
|
||||
"用以支持通过微信进行登录注册": "To support login & registration via WeChat",
|
||||
"了解 WeChat Server": "Learn about WeChat Server",
|
||||
"WeChat Server 访问凭证": "WeChat Server Access Credential",
|
||||
"微信公众号二维码图片链接": "WeChat Public Account QR Code Image Link",
|
||||
"输入一个图片链接": "Enter an image link",
|
||||
"保存 WeChat Server 设置": "Save WeChat Server Settings",
|
||||
"配置 Turnstile": "Configure Turnstile",
|
||||
"用以支持用户校验": "To support user verification",
|
||||
"管理你的 Turnstile Sites,推荐选择 Invisible Widget Type": "Manage your Turnstile Sites, recommend selecting Invisible Widget Type",
|
||||
"输入你注册的 Turnstile Site Key": "Enter your registered Turnstile Site Key",
|
||||
"保存 Turnstile 设置": "Save Turnstile Settings",
|
||||
"已过期": "Expired",
|
||||
"已耗尽": "Exhausted",
|
||||
"搜索令牌的名称 ...": "Search for the name of the token...",
|
||||
"已用额度": "Quota used",
|
||||
"剩余额度": "Remaining quota",
|
||||
"过期时间": "Expiration time",
|
||||
"无": "None",
|
||||
"无限制": "Unlimited",
|
||||
"永不过期": "Never expires",
|
||||
"无法复制到剪贴板,请手动复制,已将令牌填入搜索框": "Unable to copy to clipboard, please copy manually, the token has been entered into the search box",
|
||||
"删除令牌": "Delete Token",
|
||||
"添加新的令牌": "Add New Token",
|
||||
"普通用户": "Regular User",
|
||||
"管理员": "Admin",
|
||||
"超级管理员": "Super Admin",
|
||||
"未知身份": "Unknown Identity",
|
||||
"已激活": "Activated",
|
||||
"已封禁": "Banned",
|
||||
"搜索用户的 ID,用户名,显示名称,以及邮箱地址 ...": "Search user ID, username, display name, and email address...",
|
||||
"用户名": "Username",
|
||||
"统计信息": "Statistics",
|
||||
"用户角色": "User Role",
|
||||
"未绑定邮箱地址": "Email not bound",
|
||||
"请求次数": "Number of Requests",
|
||||
"提升": "Promote",
|
||||
"降级": "Demote",
|
||||
"删除用户": "Delete User",
|
||||
"添加新的用户": "Add New User",
|
||||
"自定义": "Custom",
|
||||
"等价金额": "Equivalent Amount",
|
||||
"未登录或登录已过期,请重新登录": "Not logged in or login has expired, please log in again",
|
||||
"请求次数过多,请稍后再试": "Too many requests, please try again later",
|
||||
"服务器内部错误,请联系管理员": "Server internal error, please contact the administrator",
|
||||
"本站仅作演示之用,无服务端": "This site is for demonstration purposes only, no server-side",
|
||||
"超级管理员未设置充值链接!": "Super administrator has not set the recharge link!",
|
||||
"错误:": "Error: ",
|
||||
"新版本可用:${data.version},请使用快捷键 Shift + F5 刷新页面": "New version available: ${data.version}, please refresh the page using shortcut Shift + F5",
|
||||
"无法正常连接至服务器": "Unable to connect to the server normally",
|
||||
"管理渠道": "Manage Channels",
|
||||
"系统状况": "System Status",
|
||||
"系统信息": "System Information",
|
||||
"系统信息总览": "System Information Overview",
|
||||
"版本": "Version",
|
||||
"源码": "Source Code",
|
||||
"启动时间": "Startup Time",
|
||||
"系统配置": "System Configuration",
|
||||
"系统配置总览": "System Configuration Overview",
|
||||
"邮箱验证": "Email Verification",
|
||||
"未启用": "Not Enabled",
|
||||
"GitHub 身份验证": "GitHub Authentication",
|
||||
"微信身份验证": "WeChat Authentication",
|
||||
"Turnstile 用户校验": "Turnstile User Verification",
|
||||
"创建新的渠道": "Create New Channel",
|
||||
"镜像": "Mirror",
|
||||
"请输入镜像站地址,格式为:https://domain.com,可不填,不填则使用渠道默认值": "Please enter the mirror site address, the format is: https://domain.com, it can be left blank, if left blank, the default value of the channel will be used",
|
||||
"模型": "Model",
|
||||
"请选择该渠道所支持的模型": "Please select the model supported by the channel",
|
||||
"填入基础模型": "Fill in the basic model",
|
||||
"填入所有模型": "Fill in all models",
|
||||
"清除所有模型": "Clear all models",
|
||||
"密钥": "Key",
|
||||
"请输入密钥": "Please enter the key",
|
||||
"批量创建": "Batch Create",
|
||||
"更新渠道信息": "Update Channel Information",
|
||||
"我的令牌": "My Tokens",
|
||||
"管理兑换码": "Manage Redeem Codes",
|
||||
"兑换码": "Redeem Code",
|
||||
"管理用户": "Manage Users",
|
||||
"额度明细": "Quota Details",
|
||||
"个人设置": "Personal Settings",
|
||||
"运营设置": "Operation Settings",
|
||||
"系统设置": "System Settings",
|
||||
"其他设置": "Other Settings",
|
||||
"项目仓库地址": "Project Repository Address",
|
||||
"可在设置页面设置关于内容,支持 HTML & Markdown": "You can set the content about in the settings page, support HTML & Markdown",
|
||||
"由{' '}": "built by{' '}",
|
||||
"构建,源代码遵循{' '}": ", the source code licensed under{' '}",
|
||||
"MIT 协议": "MIT License",
|
||||
"充值额度": "Recharge Quota",
|
||||
"获取兑换码": "Get Redeem Code",
|
||||
"一个月后过期": "Expires after one month",
|
||||
"一天后过期": "Expires after one day",
|
||||
"一小时后过期": "Expires after one hour",
|
||||
"一分钟后过期": "Expires after one minute",
|
||||
"创建新的令牌": "Create New Token",
|
||||
"注意,令牌的额度仅用于限制令牌本身的最大额度使用量,实际的使用受到账户的剩余额度限制。": "Note that the quota of the token is only used to limit the maximum quota usage of the token itself, and the actual usage is limited by the remaining quota of the account.",
|
||||
"设为无限额度": "Set to unlimited quota",
|
||||
"更新令牌信息": "Update Token Information",
|
||||
"请输入充值码!": "Please enter the recharge code!",
|
||||
"请输入名称": "Please enter a name",
|
||||
"请输入密钥,一行一个": "Please enter the key, one per line",
|
||||
"请输入额度": "Please enter the quota",
|
||||
"令牌创建成功": "Token created successfully",
|
||||
"令牌更新成功": "Token updated successfully",
|
||||
"充值成功!": "Recharge successful!",
|
||||
"更新用户信息": "Update User Information",
|
||||
"请输入新的用户名": "Please enter a new username",
|
||||
"密码": "Password",
|
||||
"请输入新的密码": "Please enter a new password",
|
||||
"显示名称": "Display Name",
|
||||
"请输入新的显示名称": "Please enter a new display name",
|
||||
"已绑定的 GitHub 账户": "GitHub Account Bound",
|
||||
"此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改": "This item is read-only. Users need to bind through the relevant binding button on the personal settings page, and cannot be modified directly",
|
||||
"已绑定的微信账户": "WeChat Account Bound",
|
||||
"已绑定的邮箱账户": "Email Account Bound",
|
||||
"用户信息更新成功!": "User information updated successfully!",
|
||||
"模型倍率 %.2f,分组倍率 %.2f": "model rate %.2f, group rate %.2f",
|
||||
"模型倍率 %.2f,分组倍率 %.2f,补全倍率 %.2f": "model rate %.2f, group rate %.2f, completion rate %.2f",
|
||||
"使用明细(总消耗额度:{renderQuota(stat.quota)})": "Usage Details (Total Consumption Quota: {renderQuota(stat.quota)})",
|
||||
"用户名称": "User Name",
|
||||
"令牌名称": "Token Name",
|
||||
"默认令牌": "Default Token",
|
||||
"留空则查询全部用户": "Leave blank to query all users",
|
||||
"留空则查询全部令牌": "Leave blank to query all tokens",
|
||||
"模型名称": "Model Name",
|
||||
"留空则查询全部模型": "Leave blank to query all models",
|
||||
"起始时间": "Start Time",
|
||||
"结束时间": "End Time",
|
||||
"查询": "Query",
|
||||
"提示": "Prompt",
|
||||
"补全": "Completion",
|
||||
"消耗额度": "Used Quota",
|
||||
"可选值": "Optional Values",
|
||||
"渠道不存在:%d": "Channel does not exist: %d",
|
||||
"数据库一致性已被破坏,请联系管理员": "Database consistency has been broken, please contact the administrator",
|
||||
"使用近似的方式估算 token 数以减少计算量": "Estimate the number of tokens in an approximate way to reduce computational load",
|
||||
"请填写ChannelName和ChannelKey!": "Please fill in the ChannelName and ChannelKey!",
|
||||
"请至少选择一个Model!": "Please select at least one Model!",
|
||||
"加载首页内容失败": "Failed to load the homepage content",
|
||||
"加载关于内容失败": "Failed to load the About content",
|
||||
"兑换码更新成功!": "Redemption code updated successfully!",
|
||||
"兑换码创建成功!": "Redemption code created successfully!",
|
||||
"用户账户创建成功!": "User account created successfully!",
|
||||
"生成数量": "Generate quantity",
|
||||
"请输入生成数量": "Please enter the quantity to generate",
|
||||
"创建新用户账户": "Create new user account",
|
||||
"渠道更新成功!": "Channel updated successfully!",
|
||||
"渠道创建成功!": "Channel created successfully!",
|
||||
"请选择分组": "Please select a group",
|
||||
"更新兑换码信息": "Update redemption code information",
|
||||
"创建新的兑换码": "Create a new redemption code",
|
||||
"请在系统设置页面编辑分组倍率以添加新的分组:": "Please edit the group ratio in the system settings page to add a new group:",
|
||||
"未找到所请求的页面": "The requested page was not found",
|
||||
"过期时间格式错误!": "Expiration time format error!",
|
||||
"请输入过期时间,格式为 yyyy-MM-dd HH:mm:ss,-1 表示无限制": "Please enter the expiration time, the format is yyyy-MM-dd HH:mm:ss, -1 means no limit",
|
||||
"此项可选,为一个 JSON 文本,键为用户请求的模型名称,值为要替换的模型名称,例如:": "This is optional, it's a JSON text, the key is the model name requested by the user, and the value is the model name to be replaced, for example:",
|
||||
"此项可选,输入镜像站地址,格式为:": "This is optional, enter the mirror site address, the format is:",
|
||||
"模型映射": "Model mapping",
|
||||
"请输入默认 API 版本,例如:2023-03-15-preview,该配置可以被实际的请求查询参数所覆盖": "Please enter the default API version, for example: 2023-03-15-preview, this configuration can be overridden by the actual request query parameters",
|
||||
"默认": "Default",
|
||||
"图片演示": "Image demo",
|
||||
"参数替换为你的部署名称(模型名称中的点会被剔除)": "Replace the parameter with your deployment name (dots in the model name will be removed)",
|
||||
"模型映射必须是合法的 JSON 格式!": "Model mapping must be in valid JSON format!",
|
||||
"取消无限额度": "Cancel unlimited quota",
|
||||
"取消": "Cancel",
|
||||
"请输入新的剩余额度": "Please enter the new remaining quota",
|
||||
"请输入单个兑换码中包含的额度": "Please enter the quota included in a single redemption code",
|
||||
"请输入用户名": "Please enter username",
|
||||
"请输入显示名称": "Please enter display name",
|
||||
"请输入密码": "Please enter password",
|
||||
"模型部署名称必须和模型名称保持一致": "The model deployment name must be consistent with the model name",
|
||||
",因为 One API 会把请求体中的 model": ", because One API will take the model in the request body",
|
||||
"请输入 AZURE_OPENAI_ENDPOINT": "Please enter AZURE_OPENAI_ENDPOINT",
|
||||
"请输入自定义渠道的 Base URL": "Please enter the Base URL of the custom channel",
|
||||
"Homepage URL 填": "Fill in the Homepage URL",
|
||||
"Authorization callback URL 填": "Fill in the Authorization callback URL",
|
||||
"请为渠道命名": "Please name the channel",
|
||||
"此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,例如:": "This is optional, used to modify the model name in the request body, it's a JSON string, the key is the model name in the request, and the value is the model name to be replaced, for example:",
|
||||
"模型重定向": "Model redirection",
|
||||
"请输入渠道对应的鉴权密钥": "Please enter the authentication key corresponding to the channel",
|
||||
"注意,": "Note that, ",
|
||||
",图片演示。": "related image demo.",
|
||||
"令牌创建成功,请在列表页面点击复制获取令牌!": "Token created successfully, please click copy on the list page to get the token!",
|
||||
"代理": "Proxy",
|
||||
"此项可选,用于通过代理站来进行 API 调用,请输入代理站地址,格式为:https://domain.com": "This is optional, used to make API calls through the proxy site, please enter the proxy site address, the format is: https://domain.com",
|
||||
"取消密码登录将导致所有未绑定其他登录方式的用户(包括管理员)无法通过密码登录,确认取消?": "Canceling password login will cause all users (including administrators) who have not bound other login methods to be unable to log in via password, confirm cancel?",
|
||||
"按照如下格式输入:": "Enter in the following format:",
|
||||
"模型版本": "Model version",
|
||||
"请输入星火大模型版本,注意是接口地址中的版本号,例如:v2.1": "Please enter the version of the Starfire model, note that it is the version number in the interface address, for example: v2.1",
|
||||
"点击查看": "click to view",
|
||||
"请确保已在 Azure 上创建了 gpt-35-turbo 模型,并且 apiVersion 已正确填写!": "Please make sure that the gpt-35-turbo model has been created on Azure, and the apiVersion has been filled in correctly!",
|
||||
"处理中...": "Processing...",
|
||||
"绑定成功!": "Binding successful!",
|
||||
"登录成功!": "Login successful!",
|
||||
"操作失败,重定向至登录界面中...": "Operation failed, redirecting to login screen...",
|
||||
"出现错误,第 ${count} 次重试中...": "An error occurred, retrying ${count}...",
|
||||
"首页": "Home",
|
||||
"渠道": "Channel",
|
||||
"令牌": "API Keys",
|
||||
"兑换": "Redeem",
|
||||
"充值": "Recharge",
|
||||
"用户": "Users",
|
||||
"日志": "Logs",
|
||||
"设置": "Settings",
|
||||
"关于": "About",
|
||||
"聊天": "Chat",
|
||||
"注销成功!": "Logout successful!",
|
||||
"注销": "Log out",
|
||||
"登录": "Log in",
|
||||
"注册": "Sign up",
|
||||
"加载{name}中...": "Loading {name}...",
|
||||
"未登录或登录已过期,请重新登录!": "Not logged in or login has expired, please log in again!",
|
||||
"请立刻修改默认密码!": "Please change the default password immediately!",
|
||||
"欢迎回来": "Welcome back",
|
||||
"没有账户?": "No account?",
|
||||
"立刻注册": "Sign up now",
|
||||
"用户名": "Username",
|
||||
"密码": "Password",
|
||||
"正在登录……": "Logging in...",
|
||||
"忘记密码": "Forgot password",
|
||||
"其他方式": "Other methods",
|
||||
"微信扫码关注公众号,输入「验证码」获取验证码(三分钟内有效)": "Scan the QR code with WeChat, follow the official account and enter 'verification code' to get the verification code (valid within three minutes)",
|
||||
"验证码": "Verification code",
|
||||
"全部用户": "All users",
|
||||
"当前用户": "Current user",
|
||||
"全部": "All",
|
||||
"消费": "Consumption",
|
||||
"管理": "Management",
|
||||
"系统": "System",
|
||||
"未知": "Unknown",
|
||||
"其他模型": "Other models",
|
||||
"复制成功": "Copy successful",
|
||||
"使用明细": "Usages",
|
||||
"刷新": "Refresh",
|
||||
"收起面板": "Collapse panel",
|
||||
"展开面板": "Expand panel",
|
||||
"显示查询选项": "Show search options",
|
||||
"隐藏查询选项": "Hide search options",
|
||||
"用户名称": "User name",
|
||||
"可选值": "Optional values",
|
||||
"渠道 ID": "Channel ID",
|
||||
"令牌名称": "Key name",
|
||||
"模型名称": "Model name",
|
||||
"起始时间": "Start time",
|
||||
"结束时间": "End time",
|
||||
"查询": "Query",
|
||||
"隐藏条形图": "Hide bar chart",
|
||||
"显示条形图": "Show bar chart",
|
||||
"折线条形图只展示最新50条数据": "Line and bar charts only show the latest 50 pieces of data",
|
||||
"总消耗": "Total consumption",
|
||||
"总共调用了 {payload[0].value} 次": "A total of {payload[0].value} calls were made",
|
||||
"{model.name}: {model.value} 次": "{model.name}: {model.value} times",
|
||||
"总共调用了 {payload[0].value} 次 {payload[0].name}": "A total of {payload[0].value} {payload[0].name} calls were made",
|
||||
"总消耗额度": "Total consumption limit",
|
||||
"暂无数据": "No data available",
|
||||
"更多数据统计图形即将到来,敬请期待!": "More data statistics graphics are coming soon, stay tuned!",
|
||||
"复制用户名": "Copy username",
|
||||
"{`共 ${counts} 条数据`}": "{`A total of ${counts} pieces of data`}",
|
||||
"共 0 条数据": "A total of 0 pieces of data",
|
||||
"选择明细分类": "Select detail category",
|
||||
"模型倍率": "model rate",
|
||||
"分组倍率": "group rate",
|
||||
"新密码已复制到剪贴板:": "New password has been copied to the clipboard:",
|
||||
"密码重置确认": "Password reset confirmation",
|
||||
"邮箱地址": "Email address",
|
||||
"新密码": "New password",
|
||||
"密码已复制到剪贴板:": "Password has been copied to the clipboard:",
|
||||
"密码重置完成": "Password reset complete",
|
||||
"提交": "Submit",
|
||||
"返回登录": "Return to login",
|
||||
"请稍后重试,浏览器环境检查未通过": "Please try again later, browser environment check failed",
|
||||
"重置邮件发送成功,请检查邮箱!": "Reset email sent successfully, please check your email!",
|
||||
"密码重置": "Password reset",
|
||||
"重试": "Retry",
|
||||
"组": "Group",
|
||||
"令牌已重置并已复制到剪贴板": "Token has been reset and copied to the clipboard",
|
||||
"邀请链接已复制到剪切板": "Invitation link has been copied to the clipboard",
|
||||
"系统令牌已复制到剪切板": "System token has been copied to the clipboard",
|
||||
"请输入你的账户名以确认删除!": "Please enter your account name to confirm deletion!",
|
||||
"账户已删除!": "Account has been deleted!",
|
||||
"微信账户绑定成功!": "WeChat account binding successful!",
|
||||
"请稍后几秒重试,Turnstile 正在检查用户环境!": "Please try again in a few seconds, Turnstile is checking the user environment!",
|
||||
"验证码发送成功,请检查邮箱!": "Verification code sent successfully, please check your email!",
|
||||
"邮箱账户绑定成功!": "Email account binding successful!",
|
||||
"个人信息": "Personal information",
|
||||
"编辑个人信息": "Edit personal information",
|
||||
"生成系统访问令牌": "Generate system access token",
|
||||
"复制邀请链接": "Copy invitation link",
|
||||
"删除个人帐户": "Delete personal account",
|
||||
"普通用户": "Regular user",
|
||||
"管理员": "Administrator",
|
||||
"超级管理员": "Super administrator",
|
||||
"显示名称": "Display name",
|
||||
"GitHub 账号": "GitHub account",
|
||||
"微信账号": "WeChat account",
|
||||
"修改个人信息只允许在电脑端进行。生成的令牌用于系统管理,而非用于请求 OpenAI 相关的服务,请知悉。": "Modifying personal information is only allowed on a computer. The generated token is for system management, not for requesting OpenAI related services. Please be aware.",
|
||||
"可用模型": "Available models",
|
||||
"账号绑定": "Account binding",
|
||||
"绑定微信": "Bind WeChat",
|
||||
"绑定 GitHub": "Bind GitHub",
|
||||
"绑定邮箱": "Bind Email",
|
||||
"绑定": "Bind",
|
||||
"绑定邮箱地址": "Bind email address",
|
||||
"输入邮箱地址": "Enter email address",
|
||||
"重新发送": "Resend",
|
||||
"获取验证码": "Get verification code",
|
||||
"确认绑定": "Confirm binding",
|
||||
"取消": "Cancel",
|
||||
"危险操作": "Dangerous operation",
|
||||
"您正在删除自己的帐户,将清空所有数据且不可恢复": "You are deleting your own account, all data will be cleared and cannot be recovered",
|
||||
"输入你的账户名": "Enter your account name",
|
||||
"以确认删除": "To confirm deletion",
|
||||
"确认删除": "Confirm deletion",
|
||||
"未使用": "Not used",
|
||||
"已禁用": "Disabled",
|
||||
"已使用": "Used",
|
||||
"未知状态": "Unknown status",
|
||||
"操作成功完成!": "Operation successfully completed!",
|
||||
"搜索兑换码的 ID 和名称 ...": "Search for the ID and name of the redemption code ...",
|
||||
"名称": "Name",
|
||||
"状态": "Status",
|
||||
"额度": "Quota",
|
||||
"创建时间": "Creation time",
|
||||
"兑换时间": "Redemption time",
|
||||
"操作": "Operation",
|
||||
"尚未兑换": "Not yet redeemed",
|
||||
"已复制到剪贴板!": "Copied to clipboard!",
|
||||
"无法复制到剪贴板,请手动复制,已将兑换码填入搜索框。": "Unable to copy to clipboard, please copy manually. The redemption code has been filled in the search box.",
|
||||
"复制": "Copy",
|
||||
"删除": "Delete",
|
||||
"禁用": "Disable",
|
||||
"启用": "Enable",
|
||||
"编辑": "Edit",
|
||||
"添加新的兑换码": "Add new redemption code",
|
||||
"密码长度不得小于 8 位!": "Password length must not be less than 8 characters!",
|
||||
"两次输入的密码不一致": "The two passwords entered do not match",
|
||||
"注册成功!": "Registration successful!",
|
||||
"请填写注册邮箱!": "Please fill in the registration email!",
|
||||
"请在${verificationTimeout}秒后再试": "Please try again after ${verificationTimeout} seconds",
|
||||
"验证码发送成功,请检查你的邮箱!": "Verification code sent successfully, please check your email!",
|
||||
"已有账户?": "Already have an account?",
|
||||
"请输入用户名(最长 12 位)": "Please enter a username (up to 12 characters)",
|
||||
"请输入密码(最短 8 位,最长 20 位)": "Please enter a password (minimum 8 characters, maximum 20 characters)",
|
||||
"请再次输入密码": "Please enter the password again",
|
||||
"请输入邮箱地址": "Please enter an email address",
|
||||
"秒后可重发": "Can be resent after seconds",
|
||||
"请输入邮箱验证码": "Please enter the email verification code",
|
||||
"已过期": "Expired",
|
||||
"已启用": "Enabled",
|
||||
"已耗尽": "Exhausted",
|
||||
"无": "None",
|
||||
"令牌密钥": "API Key",
|
||||
"令牌状态": "Key status",
|
||||
"已用额度": "Used quota",
|
||||
"剩余额度": "Remaining quota",
|
||||
"过期时间": "Expiration time",
|
||||
"你确定要删除这个令牌吗?": "Are you sure you want to delete this key?",
|
||||
"无法复制到剪贴板,请手动复制,已将令牌密钥填入搜索框": "Unable to copy to clipboard, please copy manually. The key key has been filled in the search box.",
|
||||
"无限制": "Unlimited",
|
||||
"永不过期": "Never expires",
|
||||
"使用 API 访问令牌进行服务鉴权和计费。": "Use API Key for service authentication and billing.",
|
||||
"API 访问令牌关系到您的个人利益,请妥善留存,不要与其他人共享,也不要保存在客户端代码中。": "API Key is related to your personal interests. Please keep it properly. Do not share it with others or save it in client code.",
|
||||
"创建令牌": "Create Key",
|
||||
"什么都还没有,快去创建一个令牌开始使用吧!": "Nothing yet, go create a key to start using!",
|
||||
"你确定要删除该令牌吗": "Are you sure you want to delete this key",
|
||||
"导出令牌信息": "Export key information",
|
||||
"错误:未登录或登录已过期,请重新登录!": "Error: Not logged in or login has expired, please log in again!",
|
||||
"错误:请求次数过多,请稍后再试!": "Error: Too many requests, please try again later!",
|
||||
"错误:服务器内部错误,请联系管理员!": "Error: Server internal error, please contact the online customer service!",
|
||||
"本站仅作演示之用,无服务端!": "This site is for demonstration purposes only, no server!",
|
||||
"错误:": "Error:",
|
||||
"加载首页内容失败...": "Failed to load homepage content...",
|
||||
"系统状况": "System status",
|
||||
"系统信息": "System information",
|
||||
"系统信息总览": "System information overview",
|
||||
"名称:": "Name:",
|
||||
"版本:": "Version:",
|
||||
"源码:": "Source code:",
|
||||
"启动时间:": "Startup time:",
|
||||
"系统配置": "System configuration",
|
||||
"系统配置总览": "System configuration overview",
|
||||
"邮箱验证:": "Email verification:",
|
||||
"未启用": "Not enabled",
|
||||
"Turnstile 用户校验:": "Turnstile user verification:",
|
||||
"页面不存在": "Page does not exist",
|
||||
"请检查你的浏览器地址是否正确": "Please check if your browser address is correct",
|
||||
"个人设置": "Personal settings",
|
||||
"运营设置": "Operations settings",
|
||||
"系统设置": "System settings",
|
||||
"其他设置": "Other settings",
|
||||
"默认令牌": "Default key",
|
||||
"过期时间必须在当前时间之后!": "Expiration time must be after the current time!",
|
||||
"额度必须大于等于 0!": "Quota must be greater than or equal to 0!",
|
||||
"过期时间格式错误!": "Expiration time format error!",
|
||||
"创建令牌数量必须大于等于 1!": "The number of keys to create must be greater than or equal to 1!",
|
||||
"令牌修改成功": "API Key modification successful",
|
||||
"令牌创建成功": "API Key creation successful",
|
||||
"更新令牌信息": "Update key information",
|
||||
"创建新的令牌": "Create a new key",
|
||||
"请输入名称": "Please enter a name",
|
||||
"请输入过期时间,格式为 yyyy-MM-dd HH:mm:ss,-1 表示无限制": "Please enter the expiration time, the format is yyyy-MM-dd HH:mm:ss, -1 means unlimited",
|
||||
"无限额度": "Unlimited quota",
|
||||
"注意:启用无限额度后,已用额度将不再进行计算。": "Note: After enabling unlimited quota, the used quota will no longer be calculated.",
|
||||
"等于": "Equals",
|
||||
"请输入额度(单位:token)": "Please enter the quota (unit: token)",
|
||||
"创建令牌数量": "Create key quantity",
|
||||
"请输入令牌数量": "Please enter the number of keys",
|
||||
"注意:令牌的额度仅用于限制令牌本身的最大额度使用量,实际的使用受到账户的剩余额度限制。": "Note: The quota of the key is only used to limit the maximum quota usage of the key itself, and the actual usage is subject to the remaining quota of the account.",
|
||||
"我的令牌": "My keys",
|
||||
"请输入额度兑换码!": "Please enter the redeem code!",
|
||||
"充值成功!": "Recharge successful!",
|
||||
"请求失败": "Request failed",
|
||||
"超级管理员未设置充值链接!": "The super administrator did not set a recharge link!",
|
||||
"充值额度": "Recharge quota",
|
||||
"兑换中...": "Redeeming...",
|
||||
"请点击充值以获取额度兑换码。": "Please click recharge to get the quota redemption code.",
|
||||
"用户信息更新成功!": "User information updated successfully!",
|
||||
"更新用户信息": "Update user information",
|
||||
"请输入新的用户名": "Please enter a new username",
|
||||
"请输入新的密码,最短 8 位": "Please enter a new password, at least 8 characters",
|
||||
"请输入新的显示名称": "Please enter a new display name",
|
||||
"分组": "Group",
|
||||
"请选择分组": "Please select a group",
|
||||
"请在系统设置页面编辑分组倍率以添加新的分组:": "Please edit the group rate on the system settings page to add a new group:",
|
||||
"请输入新的剩余额度": "Please enter a new remaining quota",
|
||||
"已绑定的 GitHub 账户": "Bound GitHub account",
|
||||
"此项只读,需要用户通过个人设置页面的相关绑定按钮进行绑定,不可直接修改": "This item is read-only, users need to bind through the relevant binding button on the personal settings page, cannot be directly modified",
|
||||
"已绑定的微信账户": "Bound WeChat account",
|
||||
"已绑定的邮箱账户": "Bound email account",
|
||||
"新版本可用:${data.version},请使用快捷键 Shift + F5 刷新页面": "New version available: ${data.version}, please refresh the page using the shortcut key Shift + F5",
|
||||
"无法正常连接至服务器!": "Unable to connect to the server normally!",
|
||||
"提示:": "Input:",
|
||||
"补全:": "Output:",
|
||||
"搜索令牌名称": "Search key name",
|
||||
"测试所有渠道": "Test all channels",
|
||||
"更新已启用渠道余额": "Update the balance of enabled channels"
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
|
||||
def list_file_paths(path):
|
||||
file_paths = []
|
||||
for root, dirs, files in os.walk(path):
|
||||
if "node_modules" in dirs:
|
||||
dirs.remove("node_modules")
|
||||
if "build" in dirs:
|
||||
dirs.remove("build")
|
||||
if "i18n" in dirs:
|
||||
dirs.remove("i18n")
|
||||
for file in files:
|
||||
file_path = os.path.join(root, file)
|
||||
if file_path.endswith("png") or file_path.endswith("ico") or file_path.endswith("db") or file_path.endswith("exe"):
|
||||
continue
|
||||
file_paths.append(file_path)
|
||||
|
||||
for dir in dirs:
|
||||
dir_path = os.path.join(root, dir)
|
||||
file_paths += list_file_paths(dir_path)
|
||||
|
||||
return file_paths
|
||||
|
||||
|
||||
def replace_keys_in_repository(repo_path, json_file_path):
|
||||
with open(json_file_path, 'r', encoding="utf-8") as json_file:
|
||||
key_value_pairs = json.load(json_file)
|
||||
|
||||
pairs = []
|
||||
for key, value in key_value_pairs.items():
|
||||
pairs.append((key, value))
|
||||
pairs.sort(key=lambda x: len(x[0]), reverse=True)
|
||||
|
||||
files = list_file_paths(repo_path)
|
||||
print('Total files: {}'.format(len(files)))
|
||||
for file_path in files:
|
||||
replace_keys_in_file(file_path, pairs)
|
||||
|
||||
|
||||
def replace_keys_in_file(file_path, pairs):
|
||||
try:
|
||||
with open(file_path, 'r', encoding="utf-8") as file:
|
||||
content = file.read()
|
||||
|
||||
for key, value in pairs:
|
||||
content = content.replace(key, value)
|
||||
|
||||
with open(file_path, 'w', encoding="utf-8") as file:
|
||||
file.write(content)
|
||||
except UnicodeDecodeError:
|
||||
print('UnicodeDecodeError: {}'.format(file_path))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Replace keys in repository.')
|
||||
parser.add_argument('--repository_path', help='Path to repository')
|
||||
parser.add_argument('--json_file_path', help='Path to JSON file')
|
||||
args = parser.parse_args()
|
||||
replace_keys_in_repository(args.repository_path, args.json_file_path)
|
13
main.go
13
main.go
@ -3,21 +3,24 @@ package main
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-contrib/sessions/cookie"
|
||||
"github.com/gin-gonic/gin"
|
||||
_ "github.com/joho/godotenv/autoload"
|
||||
|
||||
"github.com/songquanpeng/one-api/common"
|
||||
"github.com/songquanpeng/one-api/common/client"
|
||||
"github.com/songquanpeng/one-api/common/config"
|
||||
"github.com/songquanpeng/one-api/common/i18n"
|
||||
"github.com/songquanpeng/one-api/common/logger"
|
||||
"github.com/songquanpeng/one-api/controller"
|
||||
"github.com/songquanpeng/one-api/middleware"
|
||||
"github.com/songquanpeng/one-api/model"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/openai"
|
||||
"github.com/songquanpeng/one-api/router"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
//go:embed web/build/*
|
||||
@ -91,12 +94,18 @@ func main() {
|
||||
openai.InitTokenEncoders()
|
||||
client.Init()
|
||||
|
||||
// Initialize i18n
|
||||
if err := i18n.Init(); err != nil {
|
||||
logger.FatalLog("failed to initialize i18n: " + err.Error())
|
||||
}
|
||||
|
||||
// Initialize HTTP server
|
||||
server := gin.New()
|
||||
server.Use(gin.Recovery())
|
||||
// This will cause SSE not to work!!!
|
||||
//server.Use(gzip.Gzip(gzip.DefaultCompression))
|
||||
server.Use(middleware.RequestId())
|
||||
server.Use(middleware.Language())
|
||||
middleware.SetUpLogger(server)
|
||||
// Initialize session store
|
||||
store := cookie.NewStore([]byte(config.SessionSecret))
|
||||
|
25
middleware/language.go
Normal file
25
middleware/language.go
Normal file
@ -0,0 +1,25 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/songquanpeng/one-api/common/i18n"
|
||||
)
|
||||
|
||||
func Language() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
lang := c.GetHeader("Accept-Language")
|
||||
if lang == "" {
|
||||
lang = "en"
|
||||
}
|
||||
if strings.HasPrefix(strings.ToLower(lang), "zh") {
|
||||
lang = "zh-CN"
|
||||
} else {
|
||||
lang = "en"
|
||||
}
|
||||
c.Set(i18n.ContextKey, lang)
|
||||
c.Next()
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user