Skip to content

Commit 14b1c2d

Browse files
Vonngclaude
andcommitted
feat(i18n): localize bucket and object browser screens
Bucket list/details (lifecycle, replication, retention, events, access rules) and the full object browser: listing, uploads, previews, sharing, versioning, and rewind. Verbose timestamps switch to yyyy-MM-dd HH:mm in Chinese; HelpBox doc deep links gain the /zh prefix. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 6a03719 commit 14b1c2d

72 files changed

Lines changed: 2067 additions & 1298 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

web-app/src/screens/Console/Buckets/BucketDetails/AccessDetailsPanel.tsx

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,14 @@ import { setErrorSnackMessage, setHelpName } from "../../../../systemSlice";
3333
import { selBucketDetailsLoading } from "./bucketDetailsSlice";
3434
import { useAppDispatch } from "../../../../store";
3535
import { Policy } from "../../../../api/consoleApi";
36+
import { interpolate, useLocalizedLink, useT } from "i18n";
3637

3738
const AccessDetails = () => {
3839
const dispatch = useAppDispatch();
3940
const navigate = useNavigate();
4041
const params = useParams();
42+
const t = useT();
43+
const localize = useLocalizedLink();
4144

4245
const loadingBucket = useSelector(selBucketDetailsLoading);
4346

@@ -148,26 +151,38 @@ const AccessDetails = () => {
148151
<HelpTip
149152
content={
150153
<Fragment>
151-
Understand which{" "}
152-
<a
153-
target="blank"
154-
href="https://silo.pgsty.com/administration/identity-access-management/policy-based-access-control/"
155-
>
156-
Policies
157-
</a>{" "}
158-
and{" "}
159-
<a
160-
target="blank"
161-
href="https://silo.pgsty.com/administration/identity-access-management/minio-user-management/"
162-
>
163-
Users
164-
</a>{" "}
165-
are authorized to access this Bucket.
154+
{interpolate(
155+
t(
156+
"Understand which {policies} and {users} are authorized to access this Bucket.",
157+
),
158+
{
159+
policies: (
160+
<a
161+
target="blank"
162+
href={localize(
163+
"https://silo.pgsty.com/administration/identity-access-management/policy-based-access-control/",
164+
)}
165+
>
166+
{t("Policies")}
167+
</a>
168+
),
169+
users: (
170+
<a
171+
target="blank"
172+
href={localize(
173+
"https://silo.pgsty.com/administration/identity-access-management/minio-user-management/",
174+
)}
175+
>
176+
{t("Users")}
177+
</a>
178+
),
179+
},
180+
)}
166181
</Fragment>
167182
}
168183
placement="right"
169184
>
170-
Access Audit
185+
{t("Access Audit")}
171186
</HelpTip>
172187
</SectionTitle>
173188
<Tabs
@@ -178,7 +193,7 @@ const AccessDetails = () => {
178193
horizontal
179194
options={[
180195
{
181-
tabConfig: { label: "Policies", id: "simple-tab-0" },
196+
tabConfig: { label: t("Policies"), id: "simple-tab-0" },
182197
content: (
183198
<SecureComponent
184199
scopes={[IAM_SCOPES.ADMIN_LIST_USER_POLICIES]}
@@ -189,18 +204,19 @@ const AccessDetails = () => {
189204
<DataTable
190205
noBackground={true}
191206
itemActions={PolicyActions}
192-
columns={[{ label: "Name", elementKey: "name" }]}
207+
columns={[{ label: t("Name"), elementKey: "name" }]}
193208
isLoading={loadingPolicies}
194209
records={bucketPolicy}
195-
entityName="Policies"
210+
entityName={t("Policies")}
211+
customEmptyMessage={t("There are no Policies yet.")}
196212
idField="name"
197213
/>
198214
)}
199215
</SecureComponent>
200216
),
201217
},
202218
{
203-
tabConfig: { label: "Users", id: "simple-tab-1" },
219+
tabConfig: { label: t("Users"), id: "simple-tab-1" },
204220
content: (
205221
<SecureComponent
206222
scopes={[
@@ -215,10 +231,11 @@ const AccessDetails = () => {
215231
<DataTable
216232
noBackground={true}
217233
itemActions={userTableActions}
218-
columns={[{ label: "User", elementKey: "accessKey" }]}
234+
columns={[{ label: t("User"), elementKey: "accessKey" }]}
219235
isLoading={loadingUsers}
220236
records={bucketUsers}
221-
entityName="Users"
237+
entityName={t("Users")}
238+
customEmptyMessage={t("There are no Users yet.")}
222239
idField="accessKey"
223240
/>
224241
</SecureComponent>

web-app/src/screens/Console/Buckets/BucketDetails/AccessRulePanel.tsx

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { selBucketDetailsLoading } from "./bucketDetailsSlice";
3131
import { useAppDispatch } from "../../../../store";
3232
import withSuspense from "../../Common/Components/withSuspense";
3333
import TooltipWrapper from "../../Common/TooltipWrapper/TooltipWrapper";
34+
import { interpolate, useLocalizedLink, useT } from "i18n";
3435

3536
const AddAccessRuleModal = withSuspense(
3637
React.lazy(() => import("./AddAccessRule")),
@@ -45,6 +46,8 @@ const EditAccessRuleModal = withSuspense(
4546
const AccessRule = () => {
4647
const dispatch = useAppDispatch();
4748
const params = useParams();
49+
const t = useT();
50+
const localize = useLocalizedLink();
4851

4952
const loadingBucket = useSelector(selBucketDetailsLoading);
5053

@@ -180,13 +183,13 @@ const AccessRule = () => {
180183
matchAll
181184
errorProps={{ disabled: true }}
182185
>
183-
<TooltipWrapper tooltip={"Add Access Rule"}>
186+
<TooltipWrapper tooltip={t("Add Access Rule")}>
184187
<Button
185188
id={"add-bucket-access-rule"}
186189
onClick={() => {
187190
setAddAccessRuleOpen(true);
188191
}}
189-
label={"Add Access Rule"}
192+
label={t("Add Access Rule")}
190193
icon={<AddIcon />}
191194
variant={"callAction"}
192195
/>
@@ -197,21 +200,28 @@ const AccessRule = () => {
197200
<HelpTip
198201
content={
199202
<Fragment>
200-
Setting an{" "}
201-
<a
202-
href="https://silo.pgsty.com/reference/minio-mc/mc-anonymous-set/"
203-
target="blank"
204-
>
205-
Anonymous
206-
</a>{" "}
207-
policy allows clients to access the Bucket or prefix contents and
208-
perform actions consistent with the specified policy without
209-
authentication.
203+
{interpolate(
204+
t(
205+
"Setting an {anonymous} policy allows clients to access the Bucket or prefix contents and perform actions consistent with the specified policy without authentication.",
206+
),
207+
{
208+
anonymous: (
209+
<a
210+
href={localize(
211+
"https://silo.pgsty.com/reference/minio-mc/mc-anonymous-set/",
212+
)}
213+
target="blank"
214+
>
215+
{t("Anonymous")}
216+
</a>
217+
),
218+
},
219+
)}
210220
</Fragment>
211221
}
212222
placement="right"
213223
>
214-
Anonymous Access
224+
{t("Anonymous Access")}
215225
</HelpTip>
216226
</SectionTitle>
217227
<SecureComponent
@@ -223,17 +233,18 @@ const AccessRule = () => {
223233
itemActions={AccessRuleActions}
224234
columns={[
225235
{
226-
label: "Prefix",
236+
label: t("Prefix"),
227237
elementKey: "prefix",
228238
renderFunction: (prefix: string) => {
229239
return prefix || "/";
230240
},
231241
},
232-
{ label: "Access", elementKey: "access" },
242+
{ label: t("Access"), elementKey: "access" },
233243
]}
234244
isLoading={loadingAccessRules}
235245
records={accessRules || []}
236-
entityName="Access Rules"
246+
entityName={t("Access Rules")}
247+
customEmptyMessage={t("There are no Access Rules yet.")}
237248
idField="prefix"
238249
/>
239250
</SecureComponent>

web-app/src/screens/Console/Buckets/BucketDetails/AddAccessRule.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
setSnackBarMessage,
3333
} from "../../../../systemSlice";
3434
import { useAppDispatch } from "../../../../store";
35+
import { useT } from "i18n";
3536

3637
interface IAddAccessRule {
3738
modalOpen: boolean;
@@ -47,6 +48,7 @@ const AddAccessRule = ({
4748
prefilledRoute,
4849
}: IAddAccessRule) => {
4950
const dispatch = useAppDispatch();
51+
const t = useT();
5052

5153
const [prefix, setPrefix] = useState("");
5254
const [selectedAccess, setSelectedAccess] = useState<any>("readonly");
@@ -58,9 +60,9 @@ const AddAccessRule = ({
5860
}, [prefilledRoute]);
5961

6062
const accessOptions = [
61-
{ label: "readonly", value: "readonly" },
62-
{ label: "writeonly", value: "writeonly" },
63-
{ label: "readwrite", value: "readwrite" },
63+
{ label: t("readonly"), value: "readonly" },
64+
{ label: t("writeonly"), value: "writeonly" },
65+
{ label: t("readwrite"), value: "readwrite" },
6466
];
6567

6668
const resetForm = () => {
@@ -75,7 +77,7 @@ const AddAccessRule = ({
7577
access: selectedAccess,
7678
})
7779
.then((res: any) => {
78-
dispatch(setSnackBarMessage("Access Rule added successfully"));
80+
dispatch(setSnackBarMessage(t("Access Rule added successfully")));
7981
onClose();
8082
})
8183
.catch((res) => {
@@ -87,38 +89,39 @@ const AddAccessRule = ({
8789
return (
8890
<ModalWrapper
8991
modalOpen={modalOpen}
90-
title="Add Anonymous Access Rule"
92+
title={t("Add Anonymous Access Rule")}
9193
onClose={onClose}
9294
titleIcon={<AddAccessRuleIcon />}
9395
>
9496
<FormLayout withBorders={false} containerPadding={false}>
9597
<InputBox
9698
value={prefix}
97-
label={"Prefix"}
99+
label={t("Prefix")}
98100
id={"prefix"}
99101
name={"prefix"}
100-
placeholder={"Enter Prefix"}
102+
placeholder={t("Enter Prefix")}
101103
onChange={(e) => {
102104
setPrefix(e.target.value);
103105
}}
104-
tooltip={
105-
"Enter '/' to apply the rule to all prefixes and objects at the bucket root. Do not include the wildcard asterisk '*' as part of the prefix *unless* it is an explicit part of the prefix name. The Console automatically appends an asterisk to the appropriate sections of the resulting IAM policy."
106-
}
106+
tooltip={t(
107+
"Enter '/' to apply the rule to all prefixes and objects at the bucket root. Do not include the wildcard asterisk '*' as part of the prefix *unless* it is an explicit part of the prefix name. The Console automatically appends an asterisk to the appropriate sections of the resulting IAM policy.",
108+
)}
107109
/>
108110
<Select
109111
id="access"
110112
name="Access"
111113
onChange={(value) => {
112114
setSelectedAccess(value);
113115
}}
114-
label="Access"
116+
label={t("Access")}
115117
value={selectedAccess}
116118
options={accessOptions}
117119
disabled={false}
118120
helpTip={
119121
<Fragment>
120-
Select the desired level of access available to unauthenticated
121-
Users
122+
{t(
123+
"Select the desired level of access available to unauthenticated Users",
124+
)}
122125
</Fragment>
123126
}
124127
helpTipPlacement="right"
@@ -129,7 +132,7 @@ const AddAccessRule = ({
129132
type="button"
130133
variant="regular"
131134
onClick={resetForm}
132-
label={"Clear"}
135+
label={t("Clear")}
133136
/>
134137

135138
<Button
@@ -138,7 +141,7 @@ const AddAccessRule = ({
138141
variant="callAction"
139142
disabled={prefix.trim() === ""}
140143
onClick={createProcess}
141-
label={"Save"}
144+
label={t("Save")}
142145
/>
143146
</Grid>
144147
</FormLayout>

0 commit comments

Comments
 (0)