From 5b94f5ae70f211d65b72cacffb96d04e84e68539 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Thu, 16 Feb 2023 17:28:00 +0530 Subject: [PATCH] chore(ui) : Add missing localization (#10205) * chore(ui) : Add missing localization * fix : unit test * chore : add missing locale keys * chore : add missing locale keys * fix: cy failures * fix : cy test * address comments --- .../resources/ui/cypress/common/common.js | 2 +- .../e2e/Pages/DataQualityAndProfiler.spec.js | 4 +- .../AddDataQualityTestV1.tsx | 12 +++--- .../AddDataQualityTest/EditTestCaseModal.tsx | 3 +- .../components/ParameterForm.tsx | 43 ++++++++++++++++--- .../components/SelectTestSuite.tsx | 35 ++++++++++----- .../components/TestCaseForm.tsx | 33 +++++++++----- .../AddGlossaryTerm.component.tsx | 6 +-- .../DashboardDetails.component.tsx | 13 +++--- .../DashboardDetails.test.tsx | 9 ++-- .../DatasetDetails.component.tsx | 2 +- .../EntityInfoDrawer.component.tsx | 10 ++--- .../EntityLineage/EntityLineage.component.tsx | 10 ++--- .../NodeSuggestions.component.tsx | 6 ++- .../GlobalSearchSuggestions.tsx | 2 +- .../Glossary/GlossaryV1.component.tsx | 6 ++- .../GlossaryTerms/SummaryDetail.tsx | 3 +- .../tabs/GlossaryTermReferences.tsx | 10 ++--- .../tabs/GlossaryTermSynonyms.tsx | 4 +- .../GlossaryTerms/tabs/RelatedTerms.tsx | 6 ++- .../JSONSchemaTemplate/ArrayFieldTemplate.tsx | 3 +- .../MlModelDetail/MlModelDetail.component.tsx | 5 ++- .../MyAssetStats/MyAssetStats.component.tsx | 20 +++++---- .../PipelineVersion.component.tsx | 12 +++--- .../SchemaTab/SchemaTab.component.tsx | 3 +- .../TeamsSelectable/TeamsSelectable.tsx | 4 +- .../TestCasesTab/TestCasesTab.component.tsx | 2 +- .../TopicDetails/TopicDetails.component.tsx | 5 +-- .../ui/src/components/UserList/UserListV1.tsx | 11 ++--- .../src/components/Users/Users.component.tsx | 11 ++--- .../ui/src/components/Users/Users.util.tsx | 6 +-- .../common/description/Description.tsx | 6 +-- .../common/description/DescriptionV1.tsx | 12 ++++-- .../common/rich-text-editor/EditorToolBar.ts | 5 ++- .../recently-viewed/RecentlyViewed.tsx | 4 +- .../ui/src/constants/explore.constants.ts | 2 +- .../ui/src/locale/languages/en-us.json | 20 +++++++++ .../GlossaryLeftPanel.component.tsx | 4 +- 38 files changed, 224 insertions(+), 130 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index b1605a90529..92edcc2a540 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -622,7 +622,7 @@ export const restoreUser = (username) => { .should('be.visible') .click(); verifyResponseStatusCode('@restoreUser', 200); - toastNotification('User restored successfully!'); + toastNotification('User restored successfully'); // Verifying the restored user cy.get('.ant-switch').should('exist').should('be.visible').click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js index 5241db29a50..1d68b6c6e0e 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/DataQualityAndProfiler.spec.js @@ -241,7 +241,7 @@ describe('Data Quality and Profiler should work properly', () => { cy.get('.ant-modal-footer').contains('Submit').click(); verifyResponseStatusCode('@updateTest', 200); cy.get('.Toastify__toast-body') - .contains('Test case updated successfully!') + .contains('Test case updated successfully.') .should('be.visible') .wait(200); cy.get(`[data-testid="${testName}"]`).should('be.visible').click(); @@ -407,7 +407,7 @@ describe('Data Quality and Profiler should work properly', () => { cy.get('.ant-modal-footer').contains('Submit').click(); verifyResponseStatusCode('@updateTest', 200); cy.get('.Toastify__toast-body') - .contains('Test case updated successfully!') + .contains('Test case updated successfully.') .should('be.visible') .wait(200); cy.get(`[data-testid="${columnTestName}"]`).should('be.visible').click(); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTestV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTestV1.tsx index 9fa9bf990ca..4c1881fd1b7 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTestV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/AddDataQualityTestV1.tsx @@ -119,7 +119,7 @@ const AddDataQualityTestV1: React.FC = ({ url: getTableTabPath(entityTypeFQN, 'profiler'), }, { - name: 'Add Column Test', + name: t('message.add-entity-test', { entity: t('label.column') }), url: '', activeTitle: true, }, @@ -127,7 +127,7 @@ const AddDataQualityTestV1: React.FC = ({ data.push(...colVal); } else { data.push({ - name: 'Add Table Test', + name: t('message.add-entity-test', { entity: t('label.table') }), url: '', activeTitle: true, }); @@ -216,7 +216,7 @@ const AddDataQualityTestV1: React.FC = ({ } else if (activeServiceStep > 2) { const successName = selectedTestSuite?.isNewTestSuite ? `${testSuiteData?.name} & ${testCaseRes?.name}` - : testCaseRes?.name || 'Test case'; + : testCaseRes?.name || t('label.test-case') || ''; const successMessage = selectedTestSuite?.isNewTestSuite ? undefined : ( @@ -237,7 +237,7 @@ const AddDataQualityTestV1: React.FC = ({ showIngestionButton={selectedTestSuite?.isNewTestSuite || false} state={FormSubmitType.ADD} successMessage={successMessage} - viewServiceText="View Test Suite" + viewServiceText={t('message.view-test-suite')} /> ); } @@ -286,7 +286,9 @@ const AddDataQualityTestV1: React.FC = ({ - {`Add ${isColumnFqn ? 'Column' : 'Table'} Test`} + {t('message.add-entity-test', { + entity: isColumnFqn ? t('label.column') : t('label.table'), + })} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx index 2f348d49762..22490a8aa91 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/EditTestCaseModal.tsx @@ -30,7 +30,6 @@ import { TestDataType, TestDefinition, } from '../../generated/tests/testDefinition'; -import jsonData from '../../jsons/en'; import { getNameFromFQN } from '../../utils/CommonUtils'; import { getEntityFqnFromEntityLink } from '../../utils/TableUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; @@ -149,7 +148,7 @@ const EditTestCaseModal: React.FC = ({ await updateTestCaseById(testCase.id || '', jsonPatch); onUpdate && onUpdate(); showSuccessToast( - jsonData['api-success-messages']['update-test-case-success'] + t('server.update-entity-success', { entity: t('label.test-case') }) ); onCancel(); form.resetFields(); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx index fb079334e9a..11b4bd84d9d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/AddDataQualityTest/components/ParameterForm.tsx @@ -15,6 +15,7 @@ import { PlusOutlined } from '@ant-design/icons'; import { Button, Form, Input, InputNumber, Switch } from 'antd'; import 'codemirror/addon/fold/foldgutter.css'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { TestCaseParameterDefinition, TestDataType, @@ -24,11 +25,25 @@ import '../../TableProfiler/tableProfiler.less'; import { ParameterFormProps } from '../AddDataQualityTest.interface'; const ParameterForm: React.FC = ({ definition }) => { + const { t } = useTranslation(); + const prepareForm = (data: TestCaseParameterDefinition) => { - let Field = ; + let Field = ( + + ); switch (data.dataType) { case TestDataType.String: - Field = ; + Field = ( + + ); break; case TestDataType.Number: @@ -39,7 +54,9 @@ const ParameterForm: React.FC = ({ definition }) => { Field = ( ); @@ -51,7 +68,11 @@ const ParameterForm: React.FC = ({ definition }) => { case TestDataType.Array: case TestDataType.Set: Field = ( - + ); return ( @@ -84,10 +105,16 @@ const ParameterForm: React.FC = ({ definition }) => { rules={[ { required: data.required, - message: `${data.displayName} is required!`, + message: `${t('message.field-text-is-required', { + fieldText: data.displayName, + })}`, }, ]}> - + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelDetail.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelDetail.component.tsx index 888af6acfd1..3252ec86f86 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelDetail.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MlModelDetail/MlModelDetail.component.tsx @@ -48,7 +48,6 @@ import { EntityReference } from '../../generated/type/entityReference'; import { Paging } from '../../generated/type/paging'; import { LabelType, State, TagLabel } from '../../generated/type/tagLabel'; import { useInfiniteScroll } from '../../hooks/useInfiniteScroll'; -import jsonData from '../../jsons/en'; import { getEmptyPlaceholder, getEntityName, @@ -131,7 +130,9 @@ const MlModelDetail: FC = ({ setPipelinePermissions(entityPermission); } catch (error) { showErrorToast( - jsonData['api-error-messages']['fetch-entity-permissions-error'] + t('server.fetch-entity-permissions-error', { + entity: t('label.ml-model'), + }) ); } }, [mlModelDetail.id, getEntityPermission, setPipelinePermissions]); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyAssetStats/MyAssetStats.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyAssetStats/MyAssetStats.component.tsx index 6dd772e6d4a..7b1aad09586 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyAssetStats/MyAssetStats.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyAssetStats/MyAssetStats.component.tsx @@ -14,6 +14,7 @@ import { Button, Card } from 'antd'; import { isNil } from 'lodash'; import React, { FunctionComponent, useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import { getExplorePathWithSearch, ROUTES } from '../../constants/constants'; import { @@ -31,55 +32,56 @@ import { MyAssetStatsProps } from './MyAssetStats.interface'; const MyAssetStats: FunctionComponent = ({ entityState, }: MyAssetStatsProps) => { + const { t } = useTranslation(); const { entityCounts, entityCountLoading } = entityState; const dataSummary = useMemo( () => ({ tables: { icon: Icons.TABLE_GREY, - data: 'Tables', + data: t('label.table-plural'), count: entityCounts.tableCount, link: getExplorePathWithSearch(undefined, 'tables'), dataTestId: 'tables', }, topics: { icon: Icons.TOPIC_GREY, - data: 'Topics', + data: t('label.topic-plural'), count: entityCounts.topicCount, link: getExplorePathWithSearch(undefined, 'topics'), dataTestId: 'topics', }, dashboards: { icon: Icons.DASHBOARD_GREY, - data: 'Dashboards', + data: t('label.dashboard-plural'), count: entityCounts.dashboardCount, link: getExplorePathWithSearch(undefined, 'dashboards'), dataTestId: 'dashboards', }, pipelines: { icon: Icons.PIPELINE_GREY, - data: 'Pipelines', + data: t('label.pipeline-plural'), count: entityCounts.pipelineCount, link: getExplorePathWithSearch(undefined, 'pipelines'), dataTestId: 'pipelines', }, mlModal: { icon: Icons.MLMODAL, - data: 'ML Models', + data: t('label.ml-model-plural'), count: entityCounts.mlmodelCount, link: getExplorePathWithSearch(undefined, 'mlmodels'), dataTestId: 'mlmodels', }, testSuite: { icon: Icons.TEST_SUITE, - data: 'Test Suites', + data: t('label.test-suite-plural'), count: entityCounts.testSuiteCount, link: ROUTES.TEST_SUITES, dataTestId: 'test-suite', }, service: { icon: Icons.SERVICE, - data: 'Services', + data: t('label.service-plural'), count: entityCounts.servicesCount, link: getSettingPath( GlobalSettingsMenuCategory.SERVICES, @@ -89,7 +91,7 @@ const MyAssetStats: FunctionComponent = ({ }, user: { icon: Icons.USERS, - data: 'Users', + data: t('label.user-plural'), count: entityCounts.userCount, link: getSettingPath( GlobalSettingsMenuCategory.MEMBERS, @@ -100,7 +102,7 @@ const MyAssetStats: FunctionComponent = ({ }, teams: { icon: Icons.TEAMS_GREY, - data: 'Teams', + data: t('label.team-plural'), count: entityCounts.teamCount, link: getTeamsWithFqnPath(TeamType.Organization), dataTestId: 'terms', diff --git a/openmetadata-ui/src/main/resources/ui/src/components/PipelineVersion/PipelineVersion.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/PipelineVersion/PipelineVersion.component.tsx index bccb9259e0c..3456cb01ef5 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/PipelineVersion/PipelineVersion.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/PipelineVersion/PipelineVersion.component.tsx @@ -62,7 +62,7 @@ const PipelineVersion: FC = ({ ); const tabs = [ { - name: 'Details', + name: t('label.detail-plural'), icon: { alt: 'schema', name: 'icon-schema', @@ -133,7 +133,7 @@ const PipelineVersion: FC = ({ const extraInfo: Array = [ { - key: 'Owner', + key: t('label.owner'), value: !isUndefined(ownerDiff.added) || !isUndefined(ownerDiff.deleted) || @@ -149,7 +149,7 @@ const PipelineVersion: FC = ({ newOwner?.type === OwnerType.USER ? newOwner?.name : undefined, }, { - key: 'Tier', + key: t('label.tier'), value: !isUndefined(newTier) || !isUndefined(oldTier) ? getDiffValue( @@ -218,7 +218,7 @@ const PipelineVersion: FC = ({ const tableColumn: ColumnsType = useMemo( () => [ { - title: 'Task Name', + title: t('label.task-name'), dataIndex: 'displayName', key: 'displayName', render: (text, record) => ( @@ -236,7 +236,7 @@ const PipelineVersion: FC = ({ ), }, { - title: 'Description', + title: t('label.description'), dataIndex: 'description', key: 'description', render: (text) => @@ -249,7 +249,7 @@ const PipelineVersion: FC = ({ ), }, { - title: 'Task Type', + title: t('label.task-type'), dataIndex: 'taskType', key: 'taskType', }, diff --git a/openmetadata-ui/src/main/resources/ui/src/components/SchemaTab/SchemaTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/SchemaTab/SchemaTab.component.tsx index c5dcb8a4773..75db2787d07 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/SchemaTab/SchemaTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/SchemaTab/SchemaTab.component.tsx @@ -11,6 +11,7 @@ * limitations under the License. */ +import { t } from 'i18next'; import { lowerCase } from 'lodash'; import React, { Fragment, FunctionComponent, useState } from 'react'; import Searchbar from '../common/searchbar/Searchbar'; @@ -43,7 +44,7 @@ const SchemaTab: FunctionComponent = ({
{ const [value, setValue] = useState>(); const [noTeam, setNoTeam] = useState(false); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TestCasesTab/TestCasesTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TestCasesTab/TestCasesTab.component.tsx index 30cff490721..78992a5f5c6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/TestCasesTab/TestCasesTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/TestCasesTab/TestCasesTab.component.tsx @@ -65,7 +65,7 @@ const TestCasesTab = ({ return ( = ({ setTopicPermissions(permissions); } catch (error) { showErrorToast( - jsonData['api-error-messages']['fetch-entity-permissions-error'] + t('server.fetch-entity-permissions-error', { entity: t('label.topic') }) ); } }, [topicDetails.id, getEntityPermission, setTopicPermissions]); @@ -562,7 +561,7 @@ const TopicDetails: React.FC = ({ {getInfoBadge([ { - key: 'Schema', + key: t('label.schema'), value: topicDetails.messageSchema?.schemaType ?? '', }, ])} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx index 53a3ff061ac..27e55fb62ce 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx @@ -26,7 +26,6 @@ import { CreateUser } from '../../generated/api/teams/createUser'; import { User } from '../../generated/entity/teams/user'; import { Paging } from '../../generated/type/paging'; import { useAuth } from '../../hooks/authHooks'; -import jsonData from '../../jsons/en'; import { getEntityName } from '../../utils/CommonUtils'; import SVGIcons, { Icons } from '../../utils/SvgUtils'; import { showErrorToast, showSuccessToast } from '../../utils/ToastUtils'; @@ -100,16 +99,16 @@ const UserListV1: FC = ({ if (data) { afterDeleteAction(); showSuccessToast( - jsonData['api-success-messages']['user-restored-success'] + t('message.entity-restored-success', { entity: t('label.user') }) ); setShowReactiveModal(false); } else { - throw jsonData['api-error-messages']['update-user-error']; + throw t('server.entity-updating-error', { entity: t('label.user') }); } } catch (error) { showErrorToast( error as AxiosError, - jsonData['api-error-messages']['update-user-error'] + t('server.entity-updating-error', { entity: t('label.user') }) ); } finally { setIsLoading(false); @@ -254,7 +253,9 @@ const UserListV1: FC = ({ - {userData.displayName || 'Add display name'} + {userData.displayName || + t('label.add-entity', { entity: t('label.display-name') })}