Skip to content

Commit

Permalink
多语言支持
Browse files Browse the repository at this point in the history
  • Loading branch information
shanliu committed Jan 27, 2024
1 parent 9303663 commit a9f4f4b
Show file tree
Hide file tree
Showing 190 changed files with 5,467 additions and 3,288 deletions.
1 change: 1 addition & 0 deletions sdk/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
| request_ip | String || 40 | 客户端IP,存在时加入签名 | 127.0.0.1 |
| method | String || 128 | 接口名称,可以放到URL中,存在时加入签名 | product.detail |
| token | String ||| OAUTH登录后获取TOKEN,存在时需加入签名 | MTQtSldES1RIUVVZT0NGUkVNUEdJQlpBTlhM |
| lang | String ||| 接口返回语言,默认简体中文(zh_CN) | zh_CN |
| payload | String ||| Header的Content-type非 application/json 时的有效,内容为无换行的JSON | {"id":1} |

> POST参数:
Expand Down
21 changes: 21 additions & 0 deletions server/examples/lsys-actix-web/config/app.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#app_host="127.0.0.1"
#app_port=8080
#app_ssl_port=443

#日志配置
#log_level=sqlx_core=info,lsys_sender=debug,axtix_web=debug,actix=info,mio=error,lsys_user=trace,lsys_web=trace,lsys_core=trace,lsys_user=trace,lsys_rbac=trace,lsys_docs=trace,lsys_actix_web=trace,sqlx=trace,redis=debug
#log_dir="logs"
#log_name="std::out"
#log_gelf="127.0.0.1:12201"

#数据库配置
#database_url="mysql://root:[email protected]:3306/test"
#公共表前缀
#database_table_prefix="yaf_"
#redis 配置
#redis_url="redis://127.0.0.1/"

#rbac是否使用缓存
rbac_cache = true
Expand All @@ -10,7 +25,13 @@ ui_dir = "../../../ui/public/"
#超级管理员id
root_user_id = [1]

#语言文件目录
fluent_dir = "locale/"

#页面模板目录
tpl_dir = "src/template/"

#地址库数据文件压缩包
area_code_db = "data/2023-7-area-code.csv.gz"
#地址库索引文件目录
# area_index_dir = "/tmp/area_index"
Expand Down
3 changes: 3 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/app.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jwt-encode-error = JWT generation error:{$msg}
wechat-parse-state-error= state error:{$msg}
24 changes: 24 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-app.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
time-error = Get system time exception:{$msg}
app-bad-scope = {$scope} not supported
auth-not-login = user not logged in
user-session-get-error = Failed to get login information for [{$client_id}]:{$msg}
user-session-refresh-error = Failed to refresh [{$client_id}] login information:{$msg}
user-session-clear-error = Failed to clear login information:{$msg}
app-not-confirm = Application {$name} is under review.
app-client-id-exits = app-id [{$client_id}] is already in use by another app {$other_name}
auth-alpha-ip-error = IP parsing error:{$msg}
auth-alpha-domain-error = Domain rule resolution error:{$msg}
app-name-wrong = app-name should be between [{$min}-{$max}], currently: {$len}
app-client-id-wrong = app-id should be between [{$min}-{$max}], currently is: {$len}
auth-alpha-rule-error = Error parsing application ID: {$msg}
auth-alpha-check-error = App ID can only be alphanumeric.
app-find-bad-status = app-id[{$client_id}] status exception
app-find-error = app-id[{$client_id}] query exception:{$msg}
user-not-find = user-id[{$user_id}] does not exist
token-not-find = submit-code[{$code}] does not exist for application[{$name}]
token-is-timeout = TOKEN:{$token} has timed out, please log in again.
token-is-delete = The submitted token does not exist or has timed out.
app-add-empty-user = Unable to add empty user to app {$name}.
app-parent-add-self = Application {$name} cannot associate itself.
app-parent-secret-empty = Please provide a secret when applying {$name} to the application.
app-parent-add-bad-user = The current app {$name} can't associate {$parent_name} because the user {$user_id} is not authorized.
5 changes: 5 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-core.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
app-error = Send error, details:{$msg}
utf-error = String is not a valid UTF character, error details:{$msg}
valid-code-tag-len = Checksum KEY[{$tag}] max length:{$max}
valid-code-submit-empty = The code is not empty.
valid-code-not-match = The submitted code [{$code}] does not match.
24 changes: 24 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-docs.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
doc-git-url-error = commit URL exception:{$msg}
doc-git-tmpdir-error = Creating temporary directory exception:{$msg}
doc-task-error = Getting GIT data exception:{$msg}
doc-git-name-empty = Provide the GIT source name.
doc-git-version-not-find = Specified version not found in GIT source:{$tag}[${version}]
doc-git-not-find = The GIT source has been deleted.
doc-git-rule-error = Cleanup rule [{$rule}] error:{$msg}
doc-git-submit-version-error = commit version number [{$version}] exception
doc-git-tag-empty = Please provide a TAG name.
doc-git-status-wrong = The provided TAG [{$tag}] has been deleted.
doc-git-menu-empty = Specify the TAG[{$tag}] unconfigured directory
doc-git-dir-access = path must be [{$prefix}] subdirectory [{$host_name}]
doc-git-dir-error = Read directory [{$host_name}:{$dir}] exception:{$msg}
doc-git-menu-read-not-yet = GIT unfinished clone for specified host [{$host_name}]
doc-git-menu-read-access = path [{$file_path}] in directory [{$menu_file}] is not a safe path, triggering host [{$host_name}].
doc-git-menu-read-notfile = path [{$file_path}] in directory [{$menu_file}] is not a file, trigger host [{$host_name}].
doc-git-menu-name-empty = Please provide a directory name.
doc-git-menu-file-error = Reading directory {$file_path} in {$tag} was an exception:{$msg}
doc-git-menu-file-empty = Reading directory {$file_path} in {$tag} was empty.
doc-git-menu-file-parse-error = Reading contents of directory {$file_path} in {$tag} could not be parsed as JSON:{$msg}
doc-git-menu-path-isfind = directory already exists in {$tag}:{$menu_path}
doc-menu-file-path-access = Unable to access read path:{$path}
doc-notify-channel-close = Exception occurred while sending synchronization task:{$msg}
doc-notify-call-fail = Exception when notifying node of continued deletion:{$msg}
4 changes: 4 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-notify.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
notify-not-support = The callback address only supports HTTP or HTTPS.
notify-reqwest-build-error = Build request exception:{$msg}
notify-reqwest-check-error= Exception sent when trying to request callback address:{$msg}
16 changes: 16 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-rbac.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rbac-access-check-res-empty = Resource [{$res}] operation [{$op}] for user [{$user_id}] not found, accessing user id:{$view_user_id}
rbac-access-check-access = User [{$user_id}]'s resource [{$res}:{$res_id}] operation [{$res_op}] is not authorized for you [{$view_user_id}] access
check-length = field [{$key}]check failed:{$msg}
parse-res-str-fail = Failed to parse permission string:{$token}
rbac-res-exits = resource [{$name}:{$key}] already exists
rbac-priority-range = Role priority needs to be between [{$min}-{$max}].
rbac-role-exist = role [{$name}] already exists
rbac-relation-key-exist = Role KEY {$relation_key} is already used by role [{$name}:{$id}].
rbac-miss-relation-key = Role KEY{$relation_key} cannot be null
rbac-res-op-user-wrong = This role [{$name}:{$role_id}] cannot be associated with user [{$range}].
rbac-res-op-range-wrong = This role [{$name}:{$role_id}] cannot be associated with a resource [{$range}].
rbac-role-miss-res = role [{$name}:{$id}] does not exist
rbac-role-miss-res-op = Undiscovered resource [{$name}:{$id}]
rbac-role-bad-res-user = Non-system roles cannot add user resources that are not part of this role, resource not :{$res}, user is :{$user_id}
rbac-role-wrong-res-op = Found that the {$res_id} of [{$name}:{$id}] in the system does not match the {$p_res_id} passed in.
rbac-user-range-bad = Associated roles should be added using a specialized interface.
28 changes: 28 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-sender.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
tpl-exits = template ID {$tpl_id} already used [{$id}]
check-email-error = Mailbox regular exception:{$msg}
check-email-not-match = = Mailbox [{$mail}] formatting error
smtp-check-error = Smpt server exception:{$msg}
sms-config-url-error = Gateway address error, only support http or https.
sms-config-branch-error = Batch send quantity cannot be exceeded:{$max}
mail-cancel-status-error = Message is not pending: {$status}
mail-config-add-error = mail-config: validation failed for field {$name}:{$msg}
mail-config-add-max-num-error = Please submit a maximum number of messages that can be sent at a time.
mail-send-check-miss-error = Receive mailbox is empty.
mail-send-check-max-send = Maximum number of messages sent per session exceeded:{$max}
mail-send-check-block = Receive mailbox:{$to} has been blocked [{$config_id}].
mail-send-check-block-domain = Receive mailbox domain:{$domain} Blocked [{$config_id}].
mail-send-check-close = Mail sending has been disabled [{$config_id}].
mail-send-check-limit = Incoming mailbox [{$to_mail}] exceeded the maximum send:{$max_send}[{$config_id}]
mail-task-empty = no mail send task configured
mail-send-ok-cancel = mail sent to mailbox:{$to_mail}[{$msg_id}]
sms-cancel-status-error = Message is not pending: {$status}
sms-config-add-error = sms-config-add-error = sms-config:Failed to validate field {$name}:{$msg}
sms-config-add-max-num-error = Please submit the maximum number of messages that can be sent at one time.
sms-send-check-miss-error = Received SMS is empty.
sms-send-check-max-send = Maximum number of SMS sent per session exceeded:{$max}
sms-send-check-block = Received number:{$mobile} has been blocked [{$config_id}].
sms-send-check-close = SMS sending has been disabled [{$config_id}].
sms-send-check-limit = Receive number [{$mobile}] exceeded max send:{$max_send}[{$config_id}
sms-task-empty = no sms send task configured
sms-send-ok-cancel = SMS sent:{$mobile}[{$msg_id}]
sms-status-task-empty = No SMS status checking task configured
51 changes: 51 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-user.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
time-error = Get system time exception:{$msg}
user-address-is-delete = Address duplicate deletion [{$id}].
user-passwrod-wrong = Password must be [{$min}-{$max}] characters, current:{$len}
auth-not-login = User is not logged in or TOKEN has expired.
auth-not-user = User {$name} does not exist.
auth-bad-password = User password is wrong.
auth-not-set-password = User has not set password for login.
user-status-invalid = user-status-invalid [{$user}:{$status}]
user-auth-parse-bad = user TOKEN exception
user-auth-parse-error = Parsing TOKEN exception:{$msg}
check-user-lock = User {$user} is locked and will be restored in {$time} seconds.
auth-user-captcha = Authentication error submitted when user {$user} logged in.
auth-user-disable = User {$user} has been disabled.
user-address-not-empty = Address field: {$name} cannot be null
user-email-exits-other-account = Mailbox [{$email}] is bound to another account [{$id}].
user-external-other-bind = external-exits-other-account [{$name}] is already bound to other account [{$id}]
user-mobile-exits = Mobile phone number [{$mobile}] is already bound to another account [{$id}].
user-username-error = Login account must be [{$min}-{$max}] characters and cannot start with [{$bad_start}].
user-name-exits = Login account [{$name}] is already in use.
user-old-passwrod = old password cannot be used
user-passwrod-delete = Password record lost
user-bad-status = The status of the added user must be current.
user-is-delete = user {$user} cannot be enabled, status is invalid
user-nikename-wrong = Nickname must be non-empty and within {$max} characters
auth-email-error = Email regular exception: {$msg}
auth-email-not-match = Mailbox [{$mail}] format error
auth-mobile-error = Failed to validate cell phone number:{$msg}
auth-mobile-area-error = Cell phone area code {$area} exception
serde-error = Serialization exception:{$msg}
utf-error = String is not a valid UTF character, error details:{$msg}
not-login-empty-token = user not logged in: token does not exist
23 changes: 23 additions & 0 deletions server/examples/lsys-actix-web/locale/en_US/lsys-web.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mail-send-check = Mailbox address error:{$msg}
mail-send-error = Failed to send mail:{$msg}
mail-send-reply-check = Wrong e-mail reply address:{$msg}
sms-send-check = Cell phone number error:{$msg}
user-external-oauth-error = Failed to load external login configuration:{$msg}
user-external-login-url = Failed to load external login url:{$msg}
user-external-call = Failed to request external account information:{$msg}
user-external-other-bind = Account {$name} is bound to another user:{$name}
rbac-edit-role-bad-user = This role cannot add other users resources
rbac-unkown-res = Resource {$res} does not exist
rbac-bad-res-op = Resource operation id [{$op_id}] is not available
mail-use-other-user-app = Illegal app send mailbox operation
sms-use-other-user-app = Illegal to send sms from app
address-miss-city = Please select an address at the county level.
address-bad-area = The submitted area code does not exist.
mail-bind-other-user = Mailbox is bound to another account [{$other_user_id}].
rbac-check-fail = permission check failed
system-not-found = Result does not exist
3 changes: 3 additions & 0 deletions server/examples/lsys-actix-web/locale/zh_CN/app.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jwt-encode-error = JWT生成错误:{$msg}
wechat-parse-state-error= state 错误:{$msg}
24 changes: 24 additions & 0 deletions server/examples/lsys-actix-web/locale/zh_CN/lsys-app.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
time-error = 获取系统时间异常:{$msg}
app-bad-scope = {$scope} 不支持
auth-not-login = 用户未登录
user-session-get-error = 获取[{$client_id}]的登录信息失败:{$msg}
user-session-refresh-error = 更新[{$client_id}]登录信息失败:{$msg}
user-session-clear-error = 清除登录信息失败:{$msg}
app-not-confirm = 应用{$name}在审核中
app-client-id-exits = 应用ID[{$client_id}]已被其他应用 {$other_name} 使用
auth-alpha-ip-error = IP正则解析错误:{$msg}
auth-alpha-domain-error = 域名规则解析错误:{$msg}
app-name-wrong = 应用名应在[{$min}-{$max}]之间,当前为:{$len}
app-client-id-wrong = 应用ID应在[{$min}-{$max}]之间,当前为:{$len}
auth-alpha-rule-error = 应用ID正则解析错误:{$msg}
auth-alpha-check-error = 应用ID仅能是字母或数字
app-find-bad-status = 应用ID[{$client_id}]状态异常
app-find-error = 应用ID[{$client_id}]查询异常:{$msg}
user-not-find = 用户ID[{$user_id}]不存在
token-not-find = 提交的code[{$code}]不存在于应用[{$name}]
token-is-timeout = TOKEN:{$token}已经超时,请重新登录
token-is-delete = 提交的TOKEN不存在或已超时
app-add-empty-user = 无法向应用{$name}添加空用户
app-parent-add-self = 应用{$name}进行不能关联自身
app-parent-secret-empty = 应用{$name}进行关联应用时请提供secret
app-parent-add-bad-user = 当前应用{$name}不能关联{$parent_name},因为用户{$user_id}未被授权
5 changes: 5 additions & 0 deletions server/examples/lsys-actix-web/locale/zh_CN/lsys-core.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
app-error = 发送错误,详细:{$msg}
utf-error = 字符串非有效UTF字符,错误详细:{$msg}
valid-code-tag-len = 校验码KEY[{$tag}]最大长度为:{$max}
valid-code-submit-empty = 验证码不为空
valid-code-not-match = 提交的验证码[{$code}]不匹配
24 changes: 24 additions & 0 deletions server/examples/lsys-actix-web/locale/zh_CN/lsys-docs.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
doc-git-url-error = 提交的URL异常:{$msg}
doc-git-tmpdir-error = 建立临时目录异常:{$msg}
doc-task-error = 获取GIT数据异常:{$msg}
doc-git-name-empty = 提供GIT源名称
doc-git-version-not-find = GIT源中未发现指定版本:{$tag}[${version}]
doc-git-not-find = GIT源已被删除
doc-git-rule-error = 清理规则[{$rule}]错误:{$msg}
doc-git-submit-version-error = 提交的版本号[{$version}]异常
doc-git-tag-empty = 请提供TAG名
doc-git-status-wrong = 提供的TAG[{$tag}]已被删除
doc-git-menu-empty = 指定TAG[{$tag}]未配置目录
doc-git-dir-access = 路径必须为[{$prefix}]子目录[{$host_name}]
doc-git-dir-error = 读取目录[{$host_name}:{$dir}]异常:{$msg}
doc-git-menu-read-not-yet = 指定主机[{$host_name}]的GIT未完成克隆
doc-git-menu-read-access = 目录[{$menu_file}]中路径[{$file_path}]非安全路径,触发主机[{$host_name}]
doc-git-menu-read-notfile = 目录[{$menu_file}]中路径[{$file_path}]非文件,触发主机[{$host_name}]
doc-git-menu-name-empty = 请提供目录名
doc-git-menu-file-error = 在{$tag}中读取目录{$file_path}异常:{$msg}
doc-git-menu-file-empty = 在{$tag}中读取目录{$file_path}内容为空
doc-git-menu-file-parse-error = 在{$tag}中读取目录{$file_path}内容无法解析为JSON:{$msg}
doc-git-menu-path-isfind = 在{$tag}中已存在目录:{$menu_path}
doc-menu-file-path-access = 无法访问读取路径:{$path}
doc-notify-channel-close = 发送同步任务时发生异常:{$msg}
doc-notify-call-fail = 通知节点继续删除时异常:{$msg}
5 changes: 5 additions & 0 deletions server/examples/lsys-actix-web/locale/zh_CN/lsys-notify.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
notify-not-support = 回调地址仅支持HTTP或HTTPS
notify-reqwest-build-error = 构建请求异常:{$msg}
notify-reqwest-check-error= 尝试请求回调地址时发送异常:{$msg}
16 changes: 16 additions & 0 deletions server/examples/lsys-actix-web/locale/zh_CN/lsys-rbac.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
rbac-access-check-res-empty = 未找到用户[{$user_id}]的资源[{$res}]操作[{$op}],访问用户ID:{$view_user_id}
rbac-access-check-access = 用户[{$user_id}]的资源[{$res}:{$res_id}]操作[{$res_op}]未被授权给你[{$view_user_id}]访问
check-length = 字段[{$key}]校验失败:{$msg}
parse-res-str-fail = 解析权限字符串失败:{$token}
rbac-res-exits = 资源[{$name}:{$key}]已经存在
rbac-priority-range = 角色优先级需要在[{$min}-{$max}]之间
rbac-role-exist = 角色[{$name}]已经存在
rbac-relation-key-exist = 角色KEY{$relation_key}已被角色[{$name}:{$id}]使用
rbac-miss-relation-key = 角色KEY{$relation_key}不能为空
rbac-res-op-user-wrong = 此角色[{$name}:{$role_id}]不能关联用户[{$range}]
rbac-res-op-range-wrong = 此角色[{$name}:{$role_id}]不能关联资源[{$range}]
rbac-role-miss-res = 角色[{$name}:{$id}]不存在
rbac-role-miss-res-op = 未发现的资源[{$name}:{$id}]
rbac-role-bad-res-user = 非系统角色不能加非本角色用户资源,资源未:{$res},用户为:{$user_id}
rbac-role-wrong-res-op = 发现系统中的[{$name}:{$id}] 的 {$res_id} 跟传入的 {$p_res_id} 不一致
rbac-user-range-bad = 关联角色请使用专门的接口添加
28 changes: 28 additions & 0 deletions server/examples/lsys-actix-web/locale/zh_CN/lsys-sender.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
tpl-exits = 模板ID {$tpl_id} 已被使用 [{$id}]
check-email-error = 邮箱正则异常:{$msg}
check-email-not-match = = 邮箱[{$mail}]格式错误
smtp-check-error = Smpt服务器异常:{$msg}
sms-config-url-error = 网关地址错误,仅支持http或https.
sms-config-branch-error = 批量发送数量不能超过:{$max}
mail-cancel-status-error = 邮件非待发送状态:{$status}
mail-config-add-error = 邮件配置:字段{$name}校验失败:{$msg}
mail-config-add-max-num-error = 请提交每次最大邮件限制发送数
mail-send-check-miss-error = 接收邮箱为空
mail-send-check-max-send = 超过每次最大邮件发送量:{$max}
mail-send-check-block = 接收邮箱:{$to} 已被屏蔽[{$config_id}]
mail-send-check-block-domain = 接收邮箱域名:{$domain} 已被屏蔽[{$config_id}]
mail-send-check-close = 邮件发送功能已被关闭[{$config_id}]
mail-send-check-limit = 接收邮箱[{$to_mail}]超过最大发送量:{$max_send}[{$config_id}]
mail-task-empty = 未配置邮件发送任务
mail-send-ok-cancel = 邮件已发送到邮箱:{$to_mail}[{$msg_id}]
sms-cancel-status-error = 短信非待发送状态:{$status}
sms-config-add-error = 短信配置:字段{$name}校验失败:{$msg}
sms-config-add-max-num-error = 请提交每次最大短信限制发送数
sms-send-check-miss-error = 接收短信为空
sms-send-check-max-send = 超过每次最大短信发送量:{$max}
sms-send-check-block = 接收号码:{$mobile} 已被屏蔽[{$config_id}]
sms-send-check-close = 短信发送功能已被关闭[{$config_id}]
sms-send-check-limit = 接收号码[{$mobile}]超过最大发送量:{$max_send}[{$config_id}]
sms-task-empty = 未配置短信发送任务
sms-send-ok-cancel = 短信已发送:{$mobile}[{$msg_id}]
sms-status-task-empty = 未配置短信状态检测任务
Loading

0 comments on commit a9f4f4b

Please sign in to comment.