Skip to content

Commit c0a8a52

Browse files
ZabilsyaZabilsya
andauthored
[DOP-20892] add russian language (#80)
* [DOP-20892] add russian language * [DOP-20892] fix after review --------- Co-authored-by: Zabilsya <[email protected]>
1 parent 5b5be89 commit c0a8a52

File tree

80 files changed

+656
-225
lines changed

Some content is hidden

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

80 files changed

+656
-225
lines changed

src/app/config/antd/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Language } from '@shared/config';
2+
3+
export const ANTD_LOCALES = {
4+
[Language.EN]: () => import('antd/es/locale/en_US'),
5+
[Language.RU]: () => import('antd/es/locale/ru_RU'),
6+
};

src/app/config/antd/index.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
import { ConfigProvider } from 'antd';
2-
import React, { PropsWithChildren } from 'react';
2+
import React, { PropsWithChildren, useEffect, useState } from 'react';
33
import { useTranslation } from 'react-i18next';
4+
import { Locale } from 'antd/lib/locale-provider';
5+
import { Language } from '@shared/config';
46

57
import { getValidateMessages } from './utils';
8+
import { ANTD_LOCALES } from './constants';
69

710
export const AntdConfigProvider = ({ children }: PropsWithChildren) => {
8-
const { t } = useTranslation('error');
11+
const { t, i18n } = useTranslation('error');
12+
const [locale, setLocale] = useState<Locale>();
913

10-
return <ConfigProvider form={{ validateMessages: getValidateMessages(t) }}>{children}</ConfigProvider>;
14+
useEffect(() => {
15+
const loadLocale = async () => {
16+
const localeModule = await ANTD_LOCALES[i18n.language as Language]();
17+
setLocale(localeModule.default);
18+
};
19+
loadLocale();
20+
}, [i18n.language]);
21+
22+
return (
23+
<ConfigProvider locale={locale} form={{ validateMessages: getValidateMessages(t) }}>
24+
{children}
25+
</ConfigProvider>
26+
);
1127
};

src/app/styles/antd.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@
5454
margin-left: 8px;
5555
}
5656
}
57+
58+
.ant-picker-ranges {
59+
display: flex;
60+
justify-content: space-between;
61+
}

src/app/styles/variables.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@
2222
@picker-bg: #f1f3f5;
2323
@tooltip-bg: #000000;
2424

25-
// custom constants
26-
@select-transformation-type-width: 180px;
25+
@line-height-base: 1.5;

src/entities/auth/hooks/useLogout/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Language, LANGUAGE_LOCAL_STORAGE_KEY } from '@shared/config';
12
import { useQueryClient } from '@tanstack/react-query';
23
import { useNavigate } from 'react-router-dom';
34

@@ -6,7 +7,9 @@ export const useLogout = () => {
67
const queryClient = useQueryClient();
78

89
const logout = () => {
10+
const language = localStorage.getItem(LANGUAGE_LOCAL_STORAGE_KEY) || Language.EN;
911
localStorage.clear();
12+
localStorage.setItem(LANGUAGE_LOCAL_STORAGE_KEY, language);
1013
queryClient.clear();
1114
navigate('/login');
1215
};

src/entities/connection/api/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ export type CreateConnectionRequest = {
200200

201201
export type UpdateConnectionRequest = {
202202
id: number;
203+
group_id: number;
203204
name: string;
204205
description: string;
205206
} & ConnectionData;

src/entities/group/api/hooks/useDeleteGroupUser/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const useDeleteGroupUser = (data: DeleteGroupUserRequest): UseMutationRes
1717
onSuccess: () => {
1818
queryClient.invalidateQueries({ queryKey: [GroupQueryKey.GET_GROUP_USERS, data.groupId] });
1919
notification.success({
20-
message: t('deleteGroupSuccess', { ns: 'group' }),
20+
message: t('deleteUserFromGroupSuccess', { ns: 'group' }),
2121
});
2222
},
2323
onError: (error) => {
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
.alert {
2-
width: 500px;
2+
width: fit-content;
3+
padding: 20px 32px 20px 24px !important;
4+
5+
:global(.ant-alert-message) {
6+
font-weight: 700;
7+
}
38
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import React, { memo } from 'react';
22
import { Badge } from 'antd';
33
import { RUN_STATUS_DISPLAY } from '@entities/run';
4+
import { useTranslation } from 'react-i18next';
45

56
import { RunStatusBadgeProps } from './types';
67
import { getRunStatusColor } from './utils';
78

89
export const RunStatusBadge = memo(({ status }: RunStatusBadgeProps) => {
9-
const statusText = RUN_STATUS_DISPLAY[status];
10+
const { t } = useTranslation('run');
11+
const statusText = t(RUN_STATUS_DISPLAY[status]);
12+
1013
return <Badge count={statusText} status={getRunStatusColor(status)} />;
1114
});

src/entities/transfer/api/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export interface GetTransferRequest {
8383

8484
export interface CreateTransferRequest extends Omit<Transfer, 'id'> {}
8585

86-
export interface UpdateTransferRequest extends Omit<Transfer, 'group_id'> {}
86+
export interface UpdateTransferRequest extends Transfer {}
8787

8888
export interface DeleteTransferRequest {
8989
id: number;

0 commit comments

Comments
 (0)