Forráskód Böngészése

locale(device): product translate

1175160654 4 éve
szülő
commit
82eeb846ec

+ 17 - 0
src/locales/en-US/pages.ts

@@ -41,6 +41,7 @@ export default {
   'pages.table.provider': 'Provider',
   'pages.table.type': 'Type',
   'pages.table.deviceId': 'Device ID',
+  'pages.table.createTime': 'Create Time',
 
   // 统计分析
   'pages.analysis.volume': 'Device Message Volume Today',
@@ -147,6 +148,8 @@ export default {
 
   // 设备管理-产品
   'pages.device.product': 'Product Manage',
+  'pages.device.product.deviceNumber': 'Number of Devices',
+  'pages.device.product.deviceClass': 'Device Class',
   'pages.device.product.status.published': 'Published',
   'pages.device.product.status.unpublished': 'Unpublished',
   'pages.device.product.status.all': 'All',
@@ -157,8 +160,22 @@ export default {
   'pages.device.productDetail.transportProtocol': 'Link Protocol',
   'pages.device.productDetail.createTime': 'Create Time',
   'pages.device.productDetail.base': 'Configuration Information',
+  'pages.device.productDetail.base.save': 'Save',
   'pages.device.productDetail.metadata': 'Metadata',
+  'pages.device.productDetail.metadata.quickImport': 'Quick Import',
+  'pages.device.productDetail.metadata.attributeDefinition': 'Attribute Definition',
+  'pages.device.productDetail.metadata.functionDefinition': 'Function Definition',
+  'pages.device.productDetail.metadata.eventDefinition': 'Event Definition',
+  'pages.device.productDetail.metadata.labelDefinition': 'Label Definition',
+  'pages.device.productDetail.metadata.lidentification': 'Lidentification',
+  'pages.device.productDetail.metadata.eventLevel': 'Event Level',
+  'pages.device.productDetail.metadata.whetherAsync': 'Whether Async',
+  'pages.device.productDetail.metadata.whetherReadOnly': 'Whether ReadOnly',
+  'pages.device.productDetail.metadata.dataType': 'Data Type',
   'pages.device.productDetail.alarm': 'Alarm Set',
+  'pages.device.productDetail.alarmLog': 'Alarm Log',
+  'pages.device.productDetail.alarmLog.deviceId': 'Device Id',
+  'pages.device.productDetail.alarmLog.deviceName': 'Device Name',
   'pages.device.productDetail.setting': 'Application Settings',
   'pages.device.productDetail.disable': 'Disable',
   // 设备管理-产品分类

+ 17 - 0
src/locales/zh-CN/pages.ts

@@ -41,6 +41,7 @@ export default {
   'pages.table.provider': '服务商',
   'pages.table.type': '类型',
   'pages.table.deviceId': '设备ID',
+  'pages.table.createTime': '创建时间',
 
   // 统计分析
   'pages.analysis.volume': '今日设备消息量',
@@ -152,6 +153,8 @@ export default {
   'pages.device.metadata.tag': '标签',
   // 设备管理-产品
   'pages.device.product': '产品',
+  'pages.device.product.deviceNumber': '设备数量',
+  'pages.device.product.deviceClass': '设备分类',
   'pages.device.product.status.published': '已发布',
   'pages.device.product.status.unpublished': '未发布',
   'pages.device.product.status.all': '全部',
@@ -162,8 +165,22 @@ export default {
   'pages.device.productDetail.transportProtocol': '链接协议',
   'pages.device.productDetail.createTime': '创建时间',
   'pages.device.productDetail.base': '配置信息',
+  'pages.device.productDetail.base.save': '保存',
   'pages.device.productDetail.metadata': '物模型',
+  'pages.device.productDetail.metadata.quickImport': '快速导入',
+  'pages.device.productDetail.metadata.attributeDefinition': '属性定义',
+  'pages.device.productDetail.metadata.functionDefinition': '功能定义',
+  'pages.device.productDetail.metadata.eventDefinition': '事件定义',
+  'pages.device.productDetail.metadata.labelDefinition': '标签定义',
+  'pages.device.productDetail.metadata.lidentification': '标识',
+  'pages.device.productDetail.metadata.eventLevel': '事件级别',
+  'pages.device.productDetail.metadata.whetherAsync': '是否异步',
+  'pages.device.productDetail.metadata.whetherReadOnly': '是否只读',
+  'pages.device.productDetail.metadata.dataType': '数据类型',
   'pages.device.productDetail.alarm': '告警设置',
+  'pages.device.productDetail.alarmLog': '告警记录',
+  'pages.device.productDetail.alarmLog.deviceId': '设备ID',
+  'pages.device.productDetail.alarmLog.deviceName': '设备名称',
   'pages.device.productDetail.setting': '应用设置',
   'pages.device.productDetail.disable': '停用',
   // 设备管理-产品分类

+ 18 - 4
src/pages/device/Product/Detail/Alarm/Record/index.tsx

@@ -1,8 +1,10 @@
 import type { AlarmRecord } from '@/pages/device/Product/typings';
 import type { ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
+import { useIntl } from '@@/plugin-locale/localeExports';
 
 const Record = () => {
+  const intl = useIntl();
   const columns: ProColumns<AlarmRecord>[] = [
     {
       dataIndex: 'index',
@@ -10,21 +12,33 @@ const Record = () => {
       width: 48,
     },
     {
-      title: '设备ID',
+      title: intl.formatMessage({
+        id: 'pages.device.productDetail.alarmLog.deviceId',
+        defaultMessage: '设备ID',
+      }),
       dataIndex: 'deviceId',
     },
     {
-      title: '设备名称',
+      title: intl.formatMessage({
+        id: 'pages.device.productDetail.alarmLog.deviceName',
+        defaultMessage: '设备ID',
+      }),
       dataIndex: 'deviceName',
     },
     {
-      title: '告警时间',
+      title: intl.formatMessage({
+        id: 'pages.device.alarm.time',
+        defaultMessage: '告警时间',
+      }),
       dataIndex: 'alarmTime',
       defaultSortOrder: 'descend',
       sorter: true,
     },
     {
-      title: '处理状态',
+      title: intl.formatMessage({
+        id: 'pages.device.alarm.status',
+        defaultMessage: '处理状态',
+      }),
       dataIndex: 'state',
     },
   ];

+ 18 - 4
src/pages/device/Product/Detail/Alarm/Setting/index.tsx

@@ -2,8 +2,10 @@ import type { ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
 import type { AlarmSetting } from '@/pages/device/Product/typings';
 import { Button, Space } from 'antd';
+import { useIntl } from '@@/plugin-locale/localeExports';
 
 const Setting = () => {
+  const intl = useIntl();
   const columns: ProColumns<AlarmSetting>[] = [
     {
       dataIndex: 'index',
@@ -11,19 +13,31 @@ const Setting = () => {
       width: 48,
     },
     {
-      title: '标识',
+      title: intl.formatMessage({
+        id: 'pages.device.category.key',
+        defaultMessage: '标识',
+      }),
       dataIndex: 'id',
     },
     {
-      title: '名称',
+      title: intl.formatMessage({
+        id: 'pages.table.name',
+        defaultMessage: '名称',
+      }),
       dataIndex: 'name',
     },
     {
-      title: '创建时间',
+      title: intl.formatMessage({
+        id: 'pages.table.createTime',
+        defaultMessage: '创建时间',
+      }),
       dataIndex: 'createTime',
     },
     {
-      title: '状态',
+      title: intl.formatMessage({
+        id: 'pages.searchTable.titleStatus',
+        defaultMessage: '状态',
+      }),
       dataIndex: 'state.text',
     },
   ];

+ 16 - 2
src/pages/device/Product/Detail/Alarm/index.tsx

@@ -1,14 +1,28 @@
 import { Tabs } from 'antd';
 import Setting from '@/pages/device/Product/Detail/Alarm/Setting';
 import Record from '@/pages/device/Product/Detail/Alarm/Record';
+import { useIntl } from '@@/plugin-locale/localeExports';
 
 const Alarm = () => {
+  const intl = useIntl();
   return (
     <Tabs>
-      <Tabs.TabPane key="setting" tab="告警设置">
+      <Tabs.TabPane
+        key="setting"
+        tab={intl.formatMessage({
+          id: 'pages.device.productDetail.alarm',
+          defaultMessage: '告警设置',
+        })}
+      >
         <Setting />
       </Tabs.TabPane>
-      <Tabs.TabPane key="record" tab="告警记录">
+      <Tabs.TabPane
+        key="record"
+        tab={intl.formatMessage({
+          id: 'pages.device.productDetail.alarmLog',
+          defaultMessage: '告警记录',
+        })}
+      >
         <Record />
       </Tabs.TabPane>
     </Tabs>

+ 21 - 1
src/pages/device/Product/Detail/BaseInfo/index.tsx

@@ -8,12 +8,14 @@ import type { SetStateAction } from 'react';
 import { useEffect, useState } from 'react';
 import type { ConfigMetadata, ConfigProperty } from '@/pages/device/Product/typings';
 import { useParams } from 'umi';
+import { useIntl } from '@@/plugin-locale/localeExports';
 
 const componentMap = {
   string: 'Input',
   password: 'Password',
 };
 const BaseInfo = () => {
+  const intl = useIntl();
   const param = useParams<{ id: string }>();
   const [metadata, setMetadata] = useState<ConfigMetadata[]>([]);
   const [state, setState] = useState<boolean>(false);
@@ -82,7 +84,25 @@ const BaseInfo = () => {
           <Card
             key={item.name}
             title={item.name}
-            extra={<a onClick={() => setState(!state)}>{state ? '编辑' : '保存'}</a>}
+            extra={
+              <a onClick={() => setState(!state)}>
+                {state ? (
+                  <>
+                    {intl.formatMessage({
+                      id: 'pages.data.option.edit',
+                      defaultMessage: '编辑',
+                    })}
+                  </>
+                ) : (
+                  <>
+                    {intl.formatMessage({
+                      id: 'pages.device.productDetail.base.save',
+                      defaultMessage: '保存',
+                    })}
+                  </>
+                )}
+              </a>
+            }
           >
             <PreviewText.Placeholder value="-">
               <Form form={form}>

+ 6 - 1
src/pages/device/Product/Detail/Metadata/Base/index.tsx

@@ -10,6 +10,7 @@ import { EditOutlined, MinusOutlined, PlusOutlined } from '@ant-design/icons';
 import Edit from '@/pages/device/Product/Detail/Metadata/Base/Edit';
 import { observer } from '@formily/react';
 import MetadataModel from '@/pages/device/Product/Detail/Metadata/Base/model';
+import { useIntl } from '@@/plugin-locale/localeExports';
 
 interface Props {
   type: 'events' | 'function' | 'property' | 'tag';
@@ -17,6 +18,7 @@ interface Props {
 
 const BaseMetadata = observer((props: Props) => {
   const { type } = props;
+  const intl = useIntl();
   const param = useParams<{ id: string }>();
 
   const [loading, setLoading] = useState<boolean>(true);
@@ -83,7 +85,10 @@ const BaseMetadata = observer((props: Props) => {
             icon={<PlusOutlined />}
             type="primary"
           >
-            新建
+            {intl.formatMessage({
+              id: 'pages.searchTable.new',
+              defaultMessage: '新建',
+            })}
           </Button>,
         ]}
       />

+ 43 - 6
src/pages/device/Product/Detail/Metadata/index.tsx

@@ -1,28 +1,65 @@
 import { observer } from '@formily/react';
 import { Button, Space, Tabs } from 'antd';
 import BaseMetadata from '@/pages/device/Product/Detail/Metadata/Base';
+import { useIntl } from '@@/plugin-locale/localeExports';
 
 const Metadata = observer(() => {
+  const intl = useIntl();
   return (
     <Tabs
       tabBarExtraContent={
         <Space>
-          <Button>快速导入</Button>
-          <Button>物模型TSL</Button>
+          <Button>
+            {intl.formatMessage({
+              id: 'pages.device.productDetail.metadata.quickImport',
+              defaultMessage: '快速导入',
+            })}
+          </Button>
+          <Button>
+            {intl.formatMessage({
+              id: 'pages.device.productDetail.metadata',
+              defaultMessage: '物模型',
+            })}{' '}
+            TSL
+          </Button>
         </Space>
       }
       destroyInactiveTabPane
     >
-      <Tabs.TabPane tab="属性定义" key="property">
+      <Tabs.TabPane
+        tab={intl.formatMessage({
+          id: 'pages.device.productDetail.metadata.attributeDefinition',
+          defaultMessage: '属性定义',
+        })}
+        key="property"
+      >
         <BaseMetadata type={'property'} />
       </Tabs.TabPane>
-      <Tabs.TabPane tab="功能定义" key="functions">
+      <Tabs.TabPane
+        tab={intl.formatMessage({
+          id: 'pages.device.productDetail.metadata.functionDefinition',
+          defaultMessage: '功能定义',
+        })}
+        key="functions"
+      >
         <BaseMetadata type={'function'} />
       </Tabs.TabPane>
-      <Tabs.TabPane tab="事件定义" key="events">
+      <Tabs.TabPane
+        tab={intl.formatMessage({
+          id: 'pages.device.productDetail.metadata.eventDefinition',
+          defaultMessage: '事件定义',
+        })}
+        key="events"
+      >
         <BaseMetadata type={'events'} />
       </Tabs.TabPane>
-      <Tabs.TabPane tab="标签定义" key="tag">
+      <Tabs.TabPane
+        tab={intl.formatMessage({
+          id: 'pages.device.productDetail.metadata.labelDefinition',
+          defaultMessage: '标签定义',
+        })}
+        key="tag"
+      >
         <BaseMetadata type={'tag'} />
       </Tabs.TabPane>
     </Tabs>

+ 22 - 2
src/pages/device/Product/Detail/index.tsx

@@ -1,9 +1,9 @@
 import { PageContainer } from '@ant-design/pro-layout';
 import { history, useParams } from 'umi';
-import { Button, Card, Descriptions, Space, Tabs } from 'antd';
+import { Button, Card, Descriptions, Space, Tabs, Badge } from 'antd';
 import BaseInfo from '@/pages/device/Product/Detail/BaseInfo';
 import { observer } from '@formily/react';
-import { productModel, service, statusMap } from '@/pages/device/Product';
+import { productModel, service } from '@/pages/device/Product';
 import { useEffect } from 'react';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import Metadata from '@/pages/device/Product/Detail/Metadata';
@@ -13,6 +13,26 @@ import DB from '@/db';
 
 const ProductDetail = observer(() => {
   const intl = useIntl();
+  const statusMap = {
+    1: (
+      <Badge
+        status="processing"
+        text={intl.formatMessage({
+          id: 'pages.system.tenant.assetInformation.published',
+          defaultMessage: '已发布',
+        })}
+      />
+    ),
+    0: (
+      <Badge
+        status="error"
+        text={intl.formatMessage({
+          id: 'pages.system.tenant.assetInformation.unpublished',
+          defaultMessage: '未发布',
+        })}
+      />
+    ),
+  };
   const param = useParams<{ id: string }>();
 
   useEffect(() => {

+ 33 - 3
src/pages/device/Product/index.tsx

@@ -31,6 +31,26 @@ export const productModel = model<{
 });
 const Product = observer(() => {
   const intl = useIntl();
+  const status = {
+    1: (
+      <Badge
+        status="processing"
+        text={intl.formatMessage({
+          id: 'pages.system.tenant.assetInformation.published',
+          defaultMessage: '已发布',
+        })}
+      />
+    ),
+    0: (
+      <Badge
+        status="error"
+        text={intl.formatMessage({
+          id: 'pages.system.tenant.assetInformation.unpublished',
+          defaultMessage: '未发布',
+        })}
+      />
+    ),
+  };
   return (
     <PageContainer>
       <Card>
@@ -84,7 +104,7 @@ const Product = observer(() => {
             },
             subTitle: {
               dataIndex: 'state',
-              render: (_, row) => <Space size={0}>{statusMap[row.state]}</Space>,
+              render: (_, row) => <Space size={0}>{status[row.state]}</Space>,
               search: false,
             },
             content: {
@@ -113,7 +133,12 @@ const Product = observer(() => {
                       width: 200,
                     }}
                   >
-                    <div>设备数量</div>
+                    <div>
+                      {intl.formatMessage({
+                        id: 'pages.device.product.deviceNumber',
+                        defaultMessage: '设备数量',
+                      })}
+                    </div>
                     <Badge
                       showZero={true}
                       className="site-badge-count-109"
@@ -126,7 +151,12 @@ const Product = observer(() => {
                       width: 200,
                     }}
                   >
-                    <div>设备分类</div>
+                    <div>
+                      {intl.formatMessage({
+                        id: 'pages.device.product.deviceClass',
+                        defaultMessage: '设备分类',
+                      })}
+                    </div>
                     <Tag icon={<GoldOutlined />} color="#55acee">
                       {' '}
                       {row.deviceType.text}