Improve user page i18n.

This commit is contained in:
Yang Luo 2021-04-27 18:08:21 +08:00
parent 5326cafbed
commit f0ffacb6a5
5 changed files with 29 additions and 16 deletions

View File

@ -46,9 +46,12 @@ g = _, _
e = some(where (p.eft == allow))
[matchers]
m = (r.subOwner == p.subOwner || p.subOwner == "*") && (r.subName == p.subName || p.subName == "*") && \
(r.method == p.method || p.method == "*") && (r.urlPath == p.urlPath || p.urlPath == "*") && \
(r.objOwner == p.objOwner || p.objOwner == "*") && (r.objName == p.objName || p.objName == "*") || \
m = (r.subOwner == p.subOwner || p.subOwner == "*") && \
(r.subName == p.subName || p.subName == "*" || r.subName != "anonymous" && p.subName == "!anonymous") && \
(r.method == p.method || p.method == "*") && \
(r.urlPath == p.urlPath || p.urlPath == "*") && \
(r.objOwner == p.objOwner || p.objOwner == "*") && \
(r.objName == p.objName || p.objName == "*") || \
(r.urlPath == "/api/update-user" && r.subOwner == r.objOwner && r.subName == r.objName)
`
@ -78,6 +81,7 @@ p, *, *, GET, /api/get-user, *, *
p, *, *, GET, /api/get-organizations, *, *
p, *, *, GET, /api/get-default-application, *, *
p, *, *, GET, /api/get-default-providers, *, *
p, *, !anonymous, POST, /api/upload-avatar, *, *
`
sa := stringadapter.NewAdapter(ruleText)

View File

@ -17,6 +17,7 @@ import Cropper from "react-cropper";
import "cropperjs/dist/cropper.css";
import * as Setting from "./Setting";
import {Button, Row, Col, Modal} from 'antd';
import i18next from "i18next";
export const CropperDiv = (props) => {
const [image, setImage] = useState("");
@ -84,12 +85,12 @@ export const CropperDiv = (props) => {
<Modal
title={title}
visible={visible}
okText={"Crop and Upload Avatar"}
okText={i18next.t("user:Upload a photo")}
confirmLoading={confirmLoading}
onCancel={handleCancel}
width={600}
footer={
[<Button block type="primary" onClick={handleOk}>Set new profile picture</Button>]
[<Button block type="primary" onClick={handleOk}>{i18next.t("user:Set new profile picture")}</Button>]
}
>
<Col>
@ -97,7 +98,7 @@ export const CropperDiv = (props) => {
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
<Row style={{width: "100%", marginBottom: "20px"}}>
<input style={{display: "none"}} name="fileupload" type="file" onChange={onChange}/>
<Button block onClick={selectFile}>Select a phone...</Button>
<Button block onClick={selectFile}>{i18next.t("user:Select a photo...")}</Button>
</Row>
<Cropper
style={{height: "100%"}}

View File

@ -244,7 +244,7 @@ class UserEditPage extends React.Component {
</Col>
</Row>
<Row style={{marginTop: '20px'}}>
<CropperDiv buttonText={"Upload a phone..."} title={"Crop your new profile picture"} targetFunction={UserBackend.uploadAvatar} />
<CropperDiv buttonText={i18next.t("user:Upload a photo...")} title={i18next.t("user:Upload a photo")} targetFunction={UserBackend.uploadAvatar} />
</Row>
</Col>
</Row>

View File

@ -52,6 +52,10 @@
"user":
{
"Edit User": "Edit User",
"Upload a photo...": "Upload a photo...",
"Upload a photo": "Upload a photo",
"Select a photo...": "Select a photo...",
"Set new profile picture": "Set new profile picture",
"Affiliation": "Affiliation",
"Tag": "Tag",
"Third-party Logins": "Third-party Logins",

View File

@ -13,16 +13,16 @@
"Delete": "删除",
"Organization": "组织",
"Created Time": "创建时间",
"Name": "",
"Display Name": "展示的名字",
"Name": "用户名",
"Display Name": "姓名",
"Avatar": "头像",
"Preview": "预览",
"User Type": "用户类型",
"Password Type": "密码类型",
"Password": "密码",
"Email": "电子邮",
"Phone": "手机",
"Logo": "Logo",
"Email": "电子邮",
"Phone": "手机",
"Logo": "图标",
"User containers": "用户容器",
"Users under all organizations": "所有组织里的用户",
"OAuth providers": "OAuth提供方",
@ -43,8 +43,8 @@
},
"provider":
{
"Name": "",
"Display Name": "展示的名字",
"Name": "用户名",
"Display Name": "姓名",
"Type": "类型",
"Client ID": "Client ID",
"Client Secret": "Client Secret",
@ -54,7 +54,11 @@
"user":
{
"Edit User": "修改用户",
"Affiliation": "联盟",
"Upload a photo...": "上传头像...",
"Upload a photo": "上传头像",
"Select a photo...": "选择图片...",
"Set new profile picture": "设置新头像",
"Affiliation": "单位",
"Tag": "标签",
"Third-party Logins": "第三方登录",
"Is Admin": "是管理员",