Skip to content

Commit b8461de

Browse files
committed
Merge remote-tracking branch 'upstream/master' into young/chore/eslint-i18n-quotes-rules
2 parents 9e8f204 + 2ed9f63 commit b8461de

Some content is hidden

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

56 files changed

+340
-433
lines changed

src/components/Header/LanguageMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const LangMap: Record<keyof Resources, string> = {
2626
};
2727

2828
export const LanguageMenu = () => {
29-
const { i18n } = useTranslation();
29+
const { i18n, t } = useTranslation();
3030
return (
3131
<Menu shadow="md" width={200}>
3232
<Menu.Target>
@@ -46,7 +46,7 @@ export const LanguageMenu = () => {
4646
</Menu.Item>
4747
))}
4848
<Menu.Divider />
49-
<Menu.Label>Help Us Translate!</Menu.Label>
49+
<Menu.Label>{t('help-us-translate')}</Menu.Label>
5050
</Menu.Dropdown>
5151
</Menu>
5252
);

src/components/Header/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import { LanguageMenu } from './LanguageMenu';
2424
import { SettingModalBtn } from './SettingModalBtn';
2525

2626
const Logo = () => {
27-
return <Image src={apisixLogo} alt="APISIX Logo" w={24} h={24} fit="fill" />;
27+
const { t } = useTranslation();
28+
return (
29+
<Image src={apisixLogo} alt={t('apisix.logo')} w={24} h={24} fit="fill" />
30+
);
2831
};
2932

3033
type HeaderProps = {
@@ -40,7 +43,7 @@ export const Header: FC<HeaderProps> = (props) => {
4043
<Group h="100%" gap="sm">
4144
<Burger opened={opened} onClick={toggle} hiddenFrom="sm" size="sm" />
4245
<Logo />
43-
<div>{t('APISIX Dashboard')}</div>
46+
<div>{t('apisix.dashboard')}</div>
4447
</Group>
4548
<Group h="100%" gap="sm">
4649
<SettingModalBtn />

src/components/Navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const Navbar = () => {
5454
<NavbarLink
5555
{...route}
5656
key={route.to}
57-
label={t(`navbar.${route.label}`)}
57+
label={t(`sources.${route.label}`)}
5858
/>
5959
))}
6060
</AppShellNavbar>

src/components/form-slice/FormPartConsumer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ export const FormPartConsumer = () => {
4545
<FormItemTextInput
4646
control={control}
4747
name="username"
48-
label={t('consumers.username')}
48+
label={t('form.consumers.username')}
4949
required
5050
/>
5151
}
5252
/>
5353
<FormItemTextInput
5454
control={control}
5555
name="group_id"
56-
label={t('form.consumer.groupId')}
56+
label={t('form.consumers.groupId')}
5757
/>
5858
<FormSectionPluginsOnly />
5959
</>

src/components/form-slice/FormPartProto.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
type FormItemTextareaWithUploadProps,
2525
} from '../form/TextareaWithUpload';
2626

27+
const fileTypes = '.proto,.pb';
2728
export const FormPartProto = <T extends FieldValues>(
2829
props: Pick<FormItemTextareaWithUploadProps<T>, 'allowUpload'>
2930
) => {
@@ -32,11 +33,11 @@ export const FormPartProto = <T extends FieldValues>(
3233
return (
3334
<FormItemTextareaWithUpload
3435
name="content"
35-
label={t('protos.form.content')}
36-
placeholder={t('protos.form.contentPlaceholder')}
36+
label={t('form.protos.content')}
37+
placeholder={t('form.protos.contentPlaceholder', { fileTypes })}
3738
control={form.control}
3839
minRows={10}
39-
acceptFileTypes=".proto,.pb"
40+
acceptFileTypes={fileTypes}
4041
{...props}
4142
/>
4243
);

src/components/form-slice/FormPartRoute/index.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const FormPartBasicWithPriority = () => {
4141
<FormItemNumberInput
4242
control={control}
4343
name="priority"
44-
label={t('form.route.priority')}
44+
label={t('form.routes.priority')}
4545
defaultValue={zGetDefault(APISIX.Route).priority!}
4646
/>
4747
</FormPartBasic>
@@ -52,56 +52,56 @@ const FormSectionMatchRules = () => {
5252
const { t } = useTranslation();
5353
const { control } = useFormContext<RoutePostType>();
5454
return (
55-
<FormSection legend={t('form.route.matchRules')}>
55+
<FormSection legend={t('form.routes.matchRules')}>
5656
<FormItemTagsInput
5757
control={control}
5858
name="methods"
59-
label={t('form.route.methods')}
59+
label={t('form.routes.methods')}
6060
data={APISIX.HttpMethod.options.map((v) => v.value)}
6161
searchValue=""
6262
/>
63-
<InputWrapper label={t('form.route.enableWebsocket')}>
63+
<InputWrapper label={t('form.routes.enableWebsocket')}>
6464
<FormItemSwitch control={control} name="enable_websocket" />
6565
</InputWrapper>
6666
<FormItemTextInput
6767
control={control}
6868
name="uri"
69-
label={t('form.route.uri')}
69+
label={t('form.routes.uri')}
7070
/>
7171
<FormItemTagsInput
7272
control={control}
7373
name="uris"
74-
label={t('form.route.uris')}
74+
label={t('form.routes.uris')}
7575
/>
7676
<FormItemTextInput
7777
control={control}
7878
name="host"
79-
label={t('form.route.host')}
79+
label={t('form.routes.host')}
8080
/>
8181
<FormItemTagsInput
8282
control={control}
8383
name="hosts"
84-
label={t('form.route.hosts')}
84+
label={t('form.routes.hosts')}
8585
/>
8686
<FormItemTextInput
8787
control={control}
8888
name="remote_addr"
89-
label={t('form.route.remoteAddr')}
89+
label={t('form.routes.remoteAddr')}
9090
/>
9191
<FormItemTagsInput
9292
control={control}
9393
name="remote_addrs"
94-
label={t('form.route.remoteAddrs')}
94+
label={t('form.routes.remoteAddrs')}
9595
/>
9696
<FormItemTagsInput
9797
control={control}
9898
name="vars"
99-
label={t('form.route.vars')}
99+
label={t('form.routes.vars')}
100100
/>
101101
<FormItemTextarea
102102
control={control}
103103
name="filter_func"
104-
label={t('form.route.filterFunc')}
104+
label={t('form.routes.filterFunc')}
105105
/>
106106
</FormSection>
107107
);
@@ -111,8 +111,8 @@ export const FormSectionUpstream = () => {
111111
const { t } = useTranslation();
112112
const { control } = useFormContext<RoutePostType>();
113113
return (
114-
<FormSection legend={t('form.upstream.title')}>
115-
<FormSection legend={t('form.upstream.upstreamId')}>
114+
<FormSection legend={t('form.upstreams.title')}>
115+
<FormSection legend={t('form.upstreams.upstreamId')}>
116116
<FormItemTextInput control={control} name="upstream_id" />
117117
</FormSection>
118118
<Divider my="xs" label={t('or')} />
@@ -143,11 +143,11 @@ export const FormSectionService = () => {
143143
const { t } = useTranslation();
144144
const { control } = useFormContext<RoutePostType>();
145145
return (
146-
<FormSection legend={t('form.route.service')}>
146+
<FormSection legend={t('form.routes.service')}>
147147
<FormItemTextInput
148148
control={control}
149149
name="service_id"
150-
label={t('form.upstream.serviceId')}
150+
label={t('form.upstreams.serviceId')}
151151
/>
152152
</FormSection>
153153
);

src/components/form-slice/FormPartStreamRoute/index.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ const FormSectionStreamRouteBasic = () => {
3535
const { control } = useFormContext<StreamRoutePostType>();
3636

3737
return (
38-
<FormSection legend={t('form.streamRoute.server')}>
38+
<FormSection legend={t('form.streamRoutes.server')}>
3939
<FormItemTextInput
4040
control={control}
4141
name="server_addr"
42-
label={t('form.streamRoute.serverAddr')}
42+
label={t('form.streamRoutes.serverAddr')}
4343
/>
4444
<FormItemNumberInput
4545
control={control}
4646
name="server_port"
47-
label={t('form.streamRoute.serverPort')}
47+
label={t('form.streamRoutes.serverPort')}
4848
allowDecimal={false}
4949
/>
5050
<FormItemTextInput
5151
control={control}
5252
name="remote_addr"
53-
label={t('form.streamRoute.remoteAddr')}
53+
label={t('form.streamRoutes.remoteAddr')}
5454
/>
5555
<FormItemTextInput
5656
control={control}
5757
name="sni"
58-
label={t('form.streamRoute.sni')}
58+
label={t('form.streamRoutes.sni')}
5959
/>
6060
</FormSection>
6161
);
@@ -66,26 +66,26 @@ const FormSectionStreamRouteProtocol = () => {
6666
const { control } = useFormContext<StreamRoutePostType>();
6767

6868
return (
69-
<FormSection legend={t('form.streamRoute.protocol.title')}>
69+
<FormSection legend={t('form.streamRoutes.protocol.title')}>
7070
<FormItemTextInput
7171
control={control}
7272
name="protocol.name"
73-
label={t('form.streamRoute.protocol.name')}
73+
label={t('form.streamRoutes.protocol.name')}
7474
/>
7575
<FormItemTextInput
7676
control={control}
7777
name="protocol.superior_id"
78-
label={t('form.streamRoute.protocol.superiorId')}
78+
label={t('form.streamRoutes.protocol.superiorId')}
7979
/>
8080
<FormItemJsonInput
8181
control={control}
8282
name="protocol.conf"
83-
label={t('form.streamRoute.protocol.conf')}
83+
label={t('form.streamRoutes.protocol.conf')}
8484
/>
8585
<FormItemJsonInput
8686
control={control}
8787
name="protocol.logger"
88-
label={t('form.streamRoute.protocol.logger')}
88+
label={t('form.streamRoutes.protocol.logger')}
8989
toObject
9090
/>
9191
</FormSection>

src/components/form-slice/FormPartUpstream/FormItemNodes.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,32 +136,32 @@ export const FormItemNodes = <T extends FieldValues>(
136136
hidden: true,
137137
},
138138
{
139-
title: t('form.upstream.nodes.host.title'),
139+
title: t('form.upstreams.nodes.host.title'),
140140
dataIndex: 'host',
141141
valueType: 'text',
142142
formItemProps: genProps('host'),
143143
},
144144
{
145-
title: t('form.upstream.nodes.port.title'),
145+
title: t('form.upstreams.nodes.port.title'),
146146
dataIndex: 'port',
147147
valueType: 'digit',
148148
valueEnum: portValueEnum,
149149
formItemProps: genProps('port'),
150150
},
151151
{
152-
title: t('form.upstream.nodes.weight.title'),
152+
title: t('form.upstreams.nodes.weight.title'),
153153
dataIndex: 'weight',
154154
valueType: 'digit',
155155
formItemProps: genProps('weight'),
156156
},
157157
{
158-
title: t('form.upstream.nodes.priority.title'),
158+
title: t('form.upstreams.nodes.priority.title'),
159159
dataIndex: 'priority',
160160
valueType: 'digit',
161161
formItemProps: genProps('priority'),
162162
},
163163
{
164-
title: t('form.upstream.nodes.action.title'),
164+
title: t('form.upstreams.nodes.action.title'),
165165
valueType: 'option',
166166
width: 100,
167167
hidden: disabled,
@@ -256,7 +256,7 @@ export const FormItemNodes = <T extends FieldValues>(
256256
onClick={() => ob.append(genRecord())}
257257
{...(disabled && { display: 'none' })}
258258
>
259-
{t('form.upstream.nodes.add')}
259+
{t('form.upstreams.nodes.add')}
260260
</Button>
261261
</InputWrapper>
262262
);

0 commit comments

Comments
 (0)