Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions frontend/src/locale/IntlProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
import { createIntl, createIntlCache } from "react-intl";
import langEn from "./lang/en.json";
import langZh from "./lang/zh.json";
import langList from "./lang/lang-list.json";

// first item of each array should be the language code,
// not the country code
// Remember when adding to this list, also update check-locales.js script
const localeOptions = [["en", "en-US"]];

const localeOptions = [["en", "en-US"], ["zh", "zh-CN"]];
const loadMessages = (locale?: string): typeof langList & typeof langEn => {
const thisLocale = locale || "en";
switch (thisLocale.slice(0, 2)) {
case "zh":
return Object.assign({}, langList, langZh);
default:
return Object.assign({}, langList, langEn);
}
};

const getFlagCodeForLocale = (locale?: string) => {
switch (locale) {
case "zh-CN":
case "zh":
return "CN";
default:
return "EN";
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locale/lang/lang-list.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"locale-en-US": "English"
"locale-en-US": "English",
"locale-zh-CN": "中文 (简体)"
}
215 changes: 215 additions & 0 deletions frontend/src/locale/lang/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
{
"access-list": "访问列表",
"access-list.access-count": "{count} {count, plural, one {条规则} other {条规则}}",
"access-list.auth-count": "{count} {count, plural, one {个用户} other {个用户}}",
"access-list.help-rules-last": "当至少存在1条规则时,此拒绝所有规则将最后添加",
"access-list.help.rules-order": "请注意允许和拒绝指令将按照定义的顺序应用。",
"access-list.pass-auth": "向上游传递认证信息",
"access-list.public": "公开访问",
"access-list.public.subtitle": "无需基本认证",
"access-list.satisfy-any": "满足任意条件",
"access-list.subtitle": "{users} {users, plural, one {个用户} other {个用户}}, {rules} {rules, plural, one {条规则} other {条规则}} - 创建于: {date}",
"access-lists": "访问列表",
"action.add": "添加",
"action.add-location": "添加位置",
"action.close": "关闭",
"action.delete": "删除",
"action.disable": "禁用",
"action.download": "下载",
"action.edit": "编辑",
"action.enable": "启用",
"action.permissions": "权限",
"action.renew": "续期",
"action.view-details": "查看详情",
"auditlogs": "审计日志",
"cancel": "取消",
"certificate": "证书",
"certificate.custom-certificate": "证书",
"certificate.custom-certificate-key": "证书密钥",
"certificate.custom-intermediate": "中间证书",
"certificate.in-use": "使用中",
"certificate.none.subtitle": "未分配证书",
"certificate.none.subtitle.for-http": "此主机将不使用HTTPS",
"certificate.none.title": "无",
"certificate.not-in-use": "未使用",
"certificate.renew": "续期证书",
"certificates": "证书",
"certificates.custom": "自定义证书",
"certificates.custom.warning": "不支持使用密码保护的密钥文件。",
"certificates.dns.credentials": "凭据文件内容",
"certificates.dns.credentials-note": "此插件需要一个包含您的提供商API令牌或其他凭据的配置文件",
"certificates.dns.credentials-warning": "此数据将以明文形式存储在数据库和文件中!",
"certificates.dns.propagation-seconds": "传播秒数",
"certificates.dns.propagation-seconds-note": "留空以使用插件的默认值。等待DNS传播的秒数。",
"certificates.dns.provider": "DNS提供商",
"certificates.dns.warning": "此部分需要一些关于Certbot及其DNS插件的知识。请查阅相应插件的文档。",
"certificates.http.reachability-404": "在此域名找到了服务器,但它似乎不是Nginx代理管理器。请确保您的域名指向运行NPM实例的IP。",
"certificates.http.reachability-failed-to-check": "由于与site24x7.com的通信错误,无法检查可达性。",
"certificates.http.reachability-not-resolved": "此域名没有可用的服务器。请确保您的域名存在并指向运行NPM实例的IP,并且如有必要,路由器中已转发80端口。",
"certificates.http.reachability-ok": "您的服务器可访问,应该可以创建证书。",
"certificates.http.reachability-other": "在此域名找到了服务器,但它返回了意外的状态码 {code}。是NPM服务器吗?请确保您的域名指向运行NPM实例的IP。",
"certificates.http.reachability-wrong-data": "在此域名找到了服务器,但它返回了意外的数据。是NPM服务器吗?请确保您的域名指向运行NPM实例的IP。",
"certificates.http.test-results": "测试结果",
"certificates.http.warning": "这些域名必须已经配置为指向此安装。",
"certificates.request.subtitle": "通过 Let's Encrypt",
"certificates.request.title": "申请新证书",
"column.access": "访问",
"column.authorization": "授权",
"column.authorizations": "授权",
"column.custom-locations": "自定义位置",
"column.destination": "目标",
"column.details": "详情",
"column.email": "邮箱",
"column.event": "事件",
"column.expires": "过期时间",
"column.http-code": "访问",
"column.incoming-port": "入站端口",
"column.name": "名称",
"column.protocol": "协议",
"column.provider": "提供商",
"column.roles": "角色",
"column.rules": "规则",
"column.satisfy": "满足条件",
"column.satisfy-all": "所有",
"column.satisfy-any": "任意",
"column.scheme": "方案",
"column.source": "来源",
"column.ssl": "SSL",
"column.status": "状态",
"created-on": "创建于: {date}",
"dashboard": "仪表板",
"dead-host": "404 主机",
"dead-hosts": "404 主机",
"dead-hosts.count": "{count} {count, plural, one {个404主机} other {个404主机}}",
"disabled": "已禁用",
"domain-names": "域名",
"domain-names.max": "最多 {count} 个域名",
"domain-names.placeholder": "开始输入以添加域名...",
"domain-names.wildcards-not-permitted": "此类型不允许通配符",
"domain-names.wildcards-not-supported": "此CA不支持通配符",
"domains.force-ssl": "强制 SSL",
"domains.hsts-enabled": "启用 HSTS",
"domains.hsts-subdomains": "HSTS 包含子域名",
"domains.http2-support": "HTTP/2 支持",
"domains.use-dns": "使用 DNS 质询",
"email-address": "邮箱地址",
"empty-search": "未找到结果",
"empty-subtitle": "为什么不创建一个?",
"enabled": "已启用",
"error.access.at-least-one": "至少需要一个授权或一条访问规则",
"error.access.duplicate-usernames": "授权用户名必须唯一",
"error.invalid-auth": "邮箱或密码无效",
"error.invalid-domain": "无效域名: {domain}",
"error.invalid-email": "无效的邮箱地址",
"error.max-character-length": "最大长度为 {max} 个字符{max, plural, one {} other {}}",
"error.max-domains": "域名过多,最多 {max} 个",
"error.maximum": "最大值为 {max}",
"error.min-character-length": "最小长度为 {min} 个字符{min, plural, one {} other {}}",
"error.minimum": "最小值为 {min}",
"error.passwords-must-match": "密码必须匹配",
"error.required": "此项为必填项",
"expires.on": "过期于: {date}",
"footer.github-fork": "在 Github 上 Fork 我",
"host.flags.block-exploits": "拦截常见攻击",
"host.flags.cache-assets": "缓存资源",
"host.flags.preserve-path": "保留路径",
"host.flags.protocols": "协议",
"host.flags.websockets-upgrade": "Websockets 支持",
"host.forward-port": "转发端口",
"host.forward-scheme": "方案",
"hosts": "主机",
"http-only": "仅 HTTP",
"lets-encrypt": "Let's Encrypt",
"lets-encrypt-via-dns": "通过 DNS 使用 Let's Encrypt",
"lets-encrypt-via-http": "通过 HTTP 使用 Let's Encrypt",
"loading": "加载中…",
"login.title": "登录您的账户",
"nginx-config.label": "自定义 Nginx 配置",
"nginx-config.placeholder": "# 风险自负,在此输入您的自定义 Nginx 配置!",
"no-permission-error": "您无权查看此内容。",
"notfound.action": "带我回家",
"notfound.content": "很抱歉,您查找的页面未找到",
"notfound.title": "糟糕…您刚刚发现了一个错误页面",
"notification.error": "错误",
"notification.object-deleted": "{object} 已被删除",
"notification.object-disabled": "{object} 已被禁用",
"notification.object-enabled": "{object} 已被启用",
"notification.object-renewed": "{object} 已续期",
"notification.object-saved": "{object} 已保存",
"notification.success": "成功",
"object.actions-title": "{object} #{id}",
"object.add": "添加 {object}",
"object.delete": "删除 {object}",
"object.delete.content": "您确定要删除此 {object} 吗?",
"object.edit": "编辑 {object}",
"object.empty": "没有 {objects}",
"object.event.created": "创建了 {object}",
"object.event.deleted": "删除了 {object}",
"object.event.disabled": "禁用了 {object}",
"object.event.enabled": "启用了 {object}",
"object.event.renewed": "续期了 {object}",
"object.event.updated": "更新了 {object}",
"offline": "离线",
"online": "在线",
"options": "选项",
"password": "密码",
"password.generate": "生成随机密码",
"password.hide": "隐藏密码",
"password.show": "显示密码",
"permissions.hidden": "隐藏",
"permissions.manage": "管理",
"permissions.view": "仅查看",
"permissions.visibility.all": "所有项目",
"permissions.visibility.title": "项目可见性",
"permissions.visibility.user": "仅创建的项目",
"proxy-host": "代理主机",
"proxy-host.forward-host": "转发主机名 / IP",
"proxy-hosts": "代理主机",
"proxy-hosts.count": "{count} {count, plural, one {个代理主机} other {个代理主机}}",
"public": "公开",
"redirection-host": "重定向主机",
"redirection-host.forward-domain": "转发域名",
"redirection-hosts": "重定向主机",
"redirection-hosts.count": "{count} {count, plural, one {个重定向主机} other {个重定向主机}}",
"role.admin": "管理员",
"role.standard-user": "标准用户",
"save": "保存",
"setting": "设置",
"settings": "设置",
"settings.default-site": "默认站点",
"settings.default-site.404": "404 页面",
"settings.default-site.444": "无响应 (444)",
"settings.default-site.congratulations": "祝贺页面",
"settings.default-site.description": "当 Nginx 接收到未知主机请求时显示的内容",
"settings.default-site.html": "自定义 HTML",
"settings.default-site.html.placeholder": "<!-- 在此输入您的自定义 HTML 内容 -->",
"settings.default-site.redirect": "重定向",
"setup.preamble": "通过创建您的管理员账户开始使用。",
"setup.title": "欢迎!",
"sign-in": "登录",
"ssl-certificate": "SSL 证书",
"stream": "流",
"stream.forward-host": "转发主机",
"stream.incoming-port": "入站端口",
"streams": "流",
"streams.count": "{count} {count, plural, one {个流} other {个流}}",
"streams.tcp": "TCP",
"streams.udp": "UDP",
"test": "测试",
"user": "用户",
"user.change-password": "修改密码",
"user.confirm-password": "确认密码",
"user.current-password": "当前密码",
"user.edit-profile": "编辑资料",
"user.full-name": "全名",
"user.login-as": "以 {name} 身份登录",
"user.logout": "退出登录",
"user.new-password": "新密码",
"user.nickname": "昵称",
"user.set-password": "设置密码",
"user.set-permissions": "为 {name} 设置权限",
"user.switch-dark": "切换到深色模式",
"user.switch-light": "切换到浅色模式",
"username": "用户名",
"users": "用户"
}
3 changes: 2 additions & 1 deletion frontend/src/locale/src/HelpDoc/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// import * as de from "./de/index";
// import * as fa from "./fa/index";
import * as en from "./en/index";
import * as zh from "./zh/index";

const items: any = { en };
const items: any = { en, zh };

const fallbackLang = "en";

Expand Down
18 changes: 18 additions & 0 deletions frontend/src/locale/src/HelpDoc/zh/AccessLists.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## 什么是访问列表?
访问列表定义授权用户和访问规则,这些可以在代理主机中使用,以限制访问或要求身份验证才能查看内容。

### 授权用户

这些是将能够在提示时输入其用户名和密码的用户。密码以单向 bcrypt 哈希的形式安全存储。

### 访问规则

定义应允许或拒绝访问的IP地址、国家、协议范围。

请注意,允许和拒绝指令将按照定义的顺序应用。

### 提示

- `satisfy any` 意味着用户必须匹配授权用户列表或访问规则中的任何一个才能获得访问权限
- `satisfy all` 意味着用户必须匹配授权用户列表并且匹配访问规则才能获得访问权限
- 当存在至少1条规则时,将在最后添加"拒绝所有"规则
19 changes: 19 additions & 0 deletions frontend/src/locale/src/HelpDoc/zh/Certificates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## 什么是SSL证书?

SSL证书允许您的代理主机通过HTTPS提供服务,这是所有现代网站的标准做法。

### Let's Encrypt

[Let's Encrypt](https://letsencrypt.org) 是一个免费的、自动化的、开放的证书颁发机构。

您可以使用HTTP或DNS验证来创建证书。HTTP验证要求您的代理主机已经设置并且通过互联网可访问。DNS验证要求您有一个支持的DNS提供商。

**重要提示:** 请确保您的代理主机域名指向此NPM实例,否则证书创建将失败。

### 自定义证书

如果您已经有了自己的证书文件,可以上传它们来创建自定义证书。

这对于内部证书颁发机构或您已经通过其他方式获得的证书非常有用。

**重要提示:** 不支持受密码保护的私钥文件。
4 changes: 4 additions & 0 deletions frontend/src/locale/src/HelpDoc/zh/DeadHosts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 什么是404主机?
404主机将返回404错误页面给进入的请求。

这对于您希望某个域返回404错误而不是重定向到其他地方的情况非常有用。
6 changes: 6 additions & 0 deletions frontend/src/locale/src/HelpDoc/zh/ProxyHosts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 什么是代理主机?
代理主机将进入的请求转发到网络上的另一台机器,从本质上讲,您可以托管一个域或子域,并指向任何地方的任何机器。

这非常适合于在其他机器或容器中运行的 Web 服务。

代理主机支持 WebSocket、自定义 Nginx 配置以及各种常见的 SSL 和安全选项。
6 changes: 6 additions & 0 deletions frontend/src/locale/src/HelpDoc/zh/RedirectionHosts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 什么是重定向主机?
重定向主机将一个域重定向到另一个位置。

这对于将旧域重定向到新域非常有用,或者当您只希望在用户访问时重定向到其他地方时使用。

重定向是使用 HTTP 301 状态码完成的,这有利于 SEO。
9 changes: 9 additions & 0 deletions frontend/src/locale/src/HelpDoc/zh/Streams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 什么是数据流?

数据流是一种简单的端口转发或负载均衡器。

这对于希望将端口 1234 上的流量转发到另一台机器的另一个端口的情况非常有用。

这种类型的数据流配置可以使用 TCP 或 UDP 流量。

与代理主机不同,数据流不提供 SSL 选项。
6 changes: 6 additions & 0 deletions frontend/src/locale/src/HelpDoc/zh/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * as AccessLists from "./AccessLists.md";
export * as Certificates from "./Certificates.md";
export * as DeadHosts from "./DeadHosts.md";
export * as ProxyHosts from "./ProxyHosts.md";
export * as RedirectionHosts from "./RedirectionHosts.md";
export * as Streams from "./Streams.md";
5 changes: 4 additions & 1 deletion frontend/src/locale/src/lang-list.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"locale-en-US": {
"defaultMessage": "English"
},
"locale-zh-CN": {
"defaultMessage": "中文 (简体)"
}
}
}
Loading