From 2ec03a4bb9b3e7093d534d41ef24fadd04ce329c Mon Sep 17 00:00:00 2001 From: iso9000t <119494473+iso9000t@users.noreply.github.com> Date: Fri, 31 Jan 2025 17:35:14 +0400 Subject: [PATCH] feat: add translations --- app/localization/translated/be.json | 4 ++ app/localization/translated/ru.json | 4 ++ app/localization/translated/uk.json | 4 ++ .../dashboardTable/dashboardTable.jsx | 29 +---------- .../dashboardTable/dashboardTableColumns.jsx | 10 ++-- .../dashboardList/dashboardTable/messages.js | 48 +++++++++++++++++++ 6 files changed, 68 insertions(+), 31 deletions(-) create mode 100644 app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/messages.js diff --git a/app/localization/translated/be.json b/app/localization/translated/be.json index 2728555916..91072f64d4 100644 --- a/app/localization/translated/be.json +++ b/app/localization/translated/be.json @@ -495,6 +495,10 @@ "DashboardTable.deleteDashboard": "Выдаліць", "DashboardTable.description": "Апісанне", "DashboardTable.edit": "Рэдагаваць", + "DashboardTable.duplicate": "Дубляваць", + "DashboardForm.duplicateModalTitle": "Дубляваць дашборд", + "DashboardForm.duplicateModalSubmitButtonText": "Дубляваць", + "DashboardTable.copyConfig": "Скапіраваць канфігурацыю дашборда ў буфер абмену", "DashboardTable.owner": "Уласнік", "DefaultProjectSettings.from": "з", "DefaultProjectSettings.keepAttachments": "Захоўваць скрыншоты", diff --git a/app/localization/translated/ru.json b/app/localization/translated/ru.json index 2aeb73127b..13bb7c25d0 100644 --- a/app/localization/translated/ru.json +++ b/app/localization/translated/ru.json @@ -495,6 +495,10 @@ "DashboardTable.deleteDashboard": "Удалить", "DashboardTable.description": "Описание", "DashboardTable.edit": "Редактировать", + "DashboardForm.duplicateModalTitle": "Дублировать дашборд", + "DashboardForm.duplicateModalSubmitButtonText": "Дублировать", + "DashboardTable.duplicate": "Дублировать", + "DashboardTable.copyConfig": "Копировать конфигурацию дашборда в буфер обмена", "DashboardTable.owner": "Владелец", "DefaultProjectSettings.from": "с", "DefaultProjectSettings.keepAttachments": "Сохранять скриншоты", diff --git a/app/localization/translated/uk.json b/app/localization/translated/uk.json index e14bce910f..6bf5bd62f7 100644 --- a/app/localization/translated/uk.json +++ b/app/localization/translated/uk.json @@ -495,6 +495,10 @@ "DashboardTable.deleteDashboard": "Видалити", "DashboardTable.description": "Опис", "DashboardTable.edit": "Редагувати", + "DashboardTable.duplicate": "Дублювати", + "DashboardForm.duplicateModalTitle": "Дублювати дашборд", + "DashboardForm.duplicateModalSubmitButtonText": "Дублювати", + "DashboardTable.copyConfig": "Копіювати конфігурацію дашборду в буфер обміну", "DashboardTable.owner": "Власник", "DefaultProjectSettings.from": "з", "DefaultProjectSettings.keepAttachments": "Зберігати скріншоти", diff --git a/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTable.jsx b/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTable.jsx index 3042c52a69..2fad558cc1 100644 --- a/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTable.jsx +++ b/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTable.jsx @@ -19,9 +19,10 @@ import classNames from 'classnames/bind'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { activeProjectSelector } from 'controllers/user'; -import { injectIntl, defineMessages } from 'react-intl'; +import { injectIntl } from 'react-intl'; import { Grid, ALIGN_CENTER } from 'components/main/grid'; import { EmptyDashboards } from 'pages/inside/dashboardPage/dashboardList/EmptyDashboards'; +import { messages } from './messages'; import { NameColumn, DescriptionColumn, @@ -33,32 +34,6 @@ import { import styles from './dashboardTable.scss'; const cx = classNames.bind(styles); -const messages = defineMessages({ - dashboardName: { - id: 'DashboardTable.dashboardName', - defaultMessage: 'Dashboard Name', - }, - description: { - id: 'DashboardTable.description', - defaultMessage: 'Description', - }, - owner: { - id: 'DashboardTable.owner', - defaultMessage: 'Owner', - }, - duplicate: { - id: 'DashboardTable.duplicate', - defaultMessage: 'Duplicate', - }, - edit: { - id: 'DashboardTable.edit', - defaultMessage: 'Edit', - }, - deleteDashboard: { - id: 'DashboardTable.deleteDashboard', - defaultMessage: 'Delete', - }, -}); @injectIntl @connect((state) => ({ diff --git a/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTableColumns.jsx b/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTableColumns.jsx index 12aa94b670..4e1cd3daa6 100644 --- a/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTableColumns.jsx +++ b/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/dashboardTableColumns.jsx @@ -24,7 +24,9 @@ import { NavLink } from 'components/main/navLink'; import { DASHBOARD_EVENTS } from 'analyticsEvents/dashboardsPageEvents'; import Parser from 'html-react-parser'; import IconDuplicate from 'common/img/duplicate-inline.svg'; +import { injectIntl } from 'react-intl'; import styles from './dashboardTable.scss'; +import { messages } from './messages'; const cx = classNames.bind(styles); @@ -80,7 +82,7 @@ OwnerColumn.defaultProps = { }; export const DuplicateColumn = track()( - ({ value, customProps, className, tracking: { trackEvent } }) => { + injectIntl(({ value, customProps, className, tracking: { trackEvent }, intl }) => { const [opened, setOpened] = useState(false); useEffect(() => { @@ -117,10 +119,10 @@ export const DuplicateColumn = track()( {opened && ( <div className={cx('hamburger-menu', 'shown')}> <div className={cx('dropdown-item')} onClick={handleDuplicate}> - Duplicate + {intl.formatMessage(messages.duplicate)} </div> <div className={cx('dropdown-item')} onClick={handleCopyConfig}> - Copy dashboard configuration to clipboard + {intl.formatMessage(messages.copyConfig)} </div> </div> )} @@ -128,7 +130,7 @@ export const DuplicateColumn = track()( </div> </div> ); - }, + }), ); DuplicateColumn.propTypes = { diff --git a/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/messages.js b/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/messages.js new file mode 100644 index 0000000000..279e778320 --- /dev/null +++ b/app/src/pages/inside/dashboardPage/dashboardList/dashboardTable/messages.js @@ -0,0 +1,48 @@ +/* + * Copyright 2025 EPAM Systems + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { defineMessages } from 'react-intl'; + +export const messages = defineMessages({ + dashboardName: { + id: 'DashboardTable.dashboardName', + defaultMessage: 'Dashboard Name', + }, + description: { + id: 'DashboardTable.description', + defaultMessage: 'Description', + }, + owner: { + id: 'DashboardTable.owner', + defaultMessage: 'Owner', + }, + duplicate: { + id: 'DashboardTable.duplicate', + defaultMessage: 'Duplicate', + }, + edit: { + id: 'DashboardTable.edit', + defaultMessage: 'Edit', + }, + deleteDashboard: { + id: 'DashboardTable.deleteDashboard', + defaultMessage: 'Delete', + }, + copyConfig: { + id: 'DashboardTable.copyConfig', + defaultMessage: 'Copy dashboard configuration to clipboard', + }, +});