From 91d005256317c7509144c06acb693b762b92f540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BD=A6=E6=B0=91?= Date: Mon, 3 Dec 2018 16:17:14 +0800 Subject: [PATCH] fix: NewConfig internationalization --- .../static/console-fe/src/locales/en-US.js | 64 +++++ .../static/console-fe/src/locales/zh-CN.js | 62 ++++ .../ConfigurationManagement.js | 267 ++++-------------- .../ConfigurationManagement/DashboardCard.js | 99 +++++++ .../NewConfig/NewConfig.js | 81 ++---- 5 files changed, 309 insertions(+), 264 deletions(-) create mode 100644 console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/DashboardCard.js diff --git a/console/src/main/resources/static/console-fe/src/locales/en-US.js b/console/src/main/resources/static/console-fe/src/locales/en-US.js index 48674eabc..e9103b45b 100644 --- a/console/src/main/resources/static/console-fe/src/locales/en-US.js +++ b/console/src/main/resources/static/console-fe/src/locales/en-US.js @@ -170,5 +170,69 @@ const I18N_CONF = { configureContent: 'Configuration Content:', back: 'Back', }, + DashboardCard: { + importantReminder0: 'Important reminder', + viewDetails1: 'view details', + }, + ConfigurationManagement: { + questionnaire2: 'questionnaire', + ad: + 'a ACM front-end monitoring questionnaire, the time limit to receive Ali cloud voucher details shoved stamp: the', + noLongerDisplay4: 'no longer display:', + removeConfiguration: 'Delete Configuration', + sureDelete: 'Are you sure you want to delete the following configuration?', + environment: 'Region:', + configurationManagement: 'Configurations', + details: 'Details', + sampleCode: 'Code Example', + edit: 'Edit', + deleteAction: 'Delete', + more: 'More', + version: 'Historical Versions', + listenerQuery: 'Configuration Listening Query', + failedEntry: 'Failed Entry:', + successfulEntry: 'Successful Entry:', + unprocessedEntry: 'Unprocessed Entry:', + pubNoData: 'No results found.', + configurationManagement8: 'configuration management', + queryResults: 'Search Results: Found', + articleMeetRequirements: 'configuration items', + fuzzyd: 'Enter Data ID', + fuzzyg: 'Enter Group', + query: 'Search', + advancedQuery9: 'Advanced Query', + application0: 'Application:', + app1: 'Enter App Name\n', + tags: 'Tags:', + pleaseEnterTag: 'Enter Tag', + application: 'Application', + operation: 'Operation', + }, + NewConfig: { + newListingMain: 'Create Configuration', + newListing: 'Create Configuration', + publishFailed: 'Publish failed. Make sure parameters are entered correctly.', + doNotEnte: 'Illegal characters not allowed', + newConfig: 'Data ID cannot be empty.', + dataIdIsNotEmpty: 'Data ID cannot exceed 255 characters in length', + groupPlaceholder: 'Enter your group name', + moreAdvanced: 'Group cannot be empty', + groupNotEmpty: 'Group ID cannot exceed 127 characters in length', + annotation: + 'Notice: You are going to add configuration to a new group, please make sure that the version of Pandora which clients are using is higher than 3.4.0, otherwise this configuration may be unreadable to clients.', + dataIdLength: 'Collapse', + collapse: 'Advanced Options', + tags: 'Tags:', + pleaseEnterTag: 'Enter Tag', + groupIdCannotBeLonger: 'Application:', + description: 'Description:', + targetEnvironment: 'Format:', + configurationFormat: 'Configuration Content', + configureContentsOf: 'Press F1 to view in full screen', + fullScreen: 'Press Esc to exit', + escExit: 'Publish', + release: 'Back', + }, }; + export default I18N_CONF; diff --git a/console/src/main/resources/static/console-fe/src/locales/zh-CN.js b/console/src/main/resources/static/console-fe/src/locales/zh-CN.js index 2e9306a1f..a60a48bbc 100644 --- a/console/src/main/resources/static/console-fe/src/locales/zh-CN.js +++ b/console/src/main/resources/static/console-fe/src/locales/zh-CN.js @@ -170,5 +170,67 @@ const I18N_CONF = { configureContent: '配置内容:', back: '返回', }, + DashboardCard: { + importantReminder0: '重要提醒', + viewDetails1: '查看详情', + }, + ConfigurationManagement: { + questionnaire2: '问卷调查', + ad: '答 ACM 前端监控调查问卷,限时领取阿里云代金券\t 详情猛戳:', + noLongerDisplay4: '不再显示:', + removeConfiguration: '删除配置', + sureDelete: '确定要删除以下配置吗?', + environment: '地域:', + configurationManagement: '配置列表', + details: '详情', + sampleCode: '示例代码', + edit: '编辑', + deleteAction: '删除', + more: '更多', + version: '历史版本', + listenerQuery: '监听查询', + failedEntry: '失败的条目:', + successfulEntry: '成功的条目:', + unprocessedEntry: '未处理的条目:', + pubNoData: '没有数据', + configurationManagement8: '配置管理', + queryResults: '查询结果:共查询到', + articleMeetRequirements: '条满足要求的配置。', + fuzzyd: '模糊查询请输入Data ID', + fuzzyg: '模糊查询请输入Group', + query: '查询', + advancedQuery9: '高级查询', + application0: '归属应用:', + app1: '请输入应用名', + tags: '标签:', + pleaseEnterTag: '请输入标签', + application: '归属应用:', + operation: '操作', + }, + NewConfig: { + newListingMain: '新建配置', + newListing: '新建配置', + publishFailed: '发布失败。请检查参数是否正确。', + doNotEnte: 'Illegal characters not allowed', + newConfig: 'Data ID 不能为空', + dataIdIsNotEmpty: 'Data ID 长度不能超过255字符', + groupPlaceholder: '请输入Group名称', + moreAdvanced: 'Group不能为空', + groupNotEmpty: 'Group ID长度不能超过127字符', + annotation: + '注:您正在往一个自定义分组新增配置,请确保客户端使用的Pandora版本高于3.4.0,否则可能读取不到该配置。', + dataIdLength: '收起', + collapse: '更多高级选项', + tags: '标签:', + pleaseEnterTag: '请输入标签', + groupIdCannotBeLonger: '归属应用:', + description: '描述:', + targetEnvironment: '配置格式:', + configurationFormat: '配置内容:', + configureContentsOf: '按F1显示全屏', + fullScreen: '按Esc退出全屏', + escExit: '发布', + release: '返回', + }, }; export default I18N_CONF; diff --git a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js index 38ce04322..200790fa8 100644 --- a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js +++ b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/ConfigurationManagement/ConfigurationManagement.js @@ -13,18 +13,11 @@ import React from 'react'; import PropTypes from 'prop-types'; -import BatchHandle from 'components/BatchHandle'; -import RegionGroup from 'components/RegionGroup'; -import ShowCodeing from 'components/ShowCodeing'; -import DeleteDialog from 'components/DeleteDialog'; -import CloneDialog from 'components/CloneDialog'; -import ImportDialog from 'components/ImportDialog'; -import ExportDialog from 'components/ExportDialog'; -import { getParams, setParams, request, aliwareIntl } from '../../../globalLib'; import { Button, Checkbox, Collapse, + ConfigProvider, Dialog, Dropdown, Field, @@ -35,97 +28,26 @@ import { Menu, Pagination, Select, - Slider, Table, } from '@alifd/next'; +import BatchHandle from 'components/BatchHandle'; +import RegionGroup from 'components/RegionGroup'; +import ShowCodeing from 'components/ShowCodeing'; +import DeleteDialog from 'components/DeleteDialog'; +import CloneDialog from 'components/CloneDialog'; +import ImportDialog from 'components/ImportDialog'; +import ExportDialog from 'components/ExportDialog'; +import DashboardCard from './DashboardCard'; +import { getParams, setParams, request, aliwareIntl } from '@/globalLib'; import './index.scss'; const { Panel } = Collapse; -const DashboardCard = ({ data = {}, height }) => ( -
- {data.modeType === 'notice' ? ( -
- 1 ? 20 : 10 }} arrows={false}> - {data.modeList.map((item, index) => ( -
-
-
- {aliwareIntl.get( - 'nacos.page.configurationManagement.Important_reminder0' - ) /* 重要提醒 */} -
- - {item.title} - - - - - {aliwareIntl.get( - 'nacos.page.configurationManagement.view_details1' - ) /* 查看详情 */} - - - -
-
- ))} -
{' '} -
- ) : ( -
-

{data.modeName}

-
- {data.modeList - ? data.modeList.map(item => ( -
- - {item.title} - - {item.tag === 'new' ? ( - - ) : ( - '' - )} - {item.tag === 'hot' ? ( - - ) : ( - '' - )} -
- )) - : ''} -
-
- )}{' '} -
-); -DashboardCard.propTypes = { - data: PropTypes.object, - height: PropTypes.number, -}; - +@ConfigProvider.config class ConfigurationManagement extends React.Component { + static displayName = 'ConfigurationManagement'; + static propTypes = { history: PropTypes.object, }; @@ -184,6 +106,7 @@ class ConfigurationManagement extends React.Component { } componentDidMount() { + const { locale = {} } = this.props; // this.getGroup(); if (aliwareIntl.currentLanguageCode === 'zh-cn') { // this.getContentList(); //在中文站获取概览页 @@ -199,33 +122,24 @@ class ConfigurationManagement extends React.Component { if (!this.checkQuestionnaire()) { if (window.location.host === 'acm.console.aliyun.com') { Dialog.alert({ - title: aliwareIntl.get( - 'nacos.page.configurationManagement.questionnaire2' - ) /* 问卷调查 */, + title: locale.questionnaire2, style: { width: '60%', }, content: (
- {aliwareIntl.get( - 'nacos.page.configurationManagement.a_ACM_front-end_monitoring_questionnaire,_the_time_limit_to_receive_Ali_cloud_voucher_details_shoved_stamp_the3' - ) /* 答ACM前端监控调查问卷,限时领取阿里云代金券详情猛戳: */} + {locale.ad} - {aliwareIntl.get( - 'nacos.page.configurationManagement.questionnaire2' - ) /* 问卷调查 */} + {locale.questionnaire2}
- {aliwareIntl.get( - 'nacos.page.configurationManagement.no_longer_display4' - ) /* 不再显示: */} + {locale.noLongerDisplay4}
), - language: aliwareIntl.currentLanguageCode, }); } } @@ -407,13 +321,13 @@ class ConfigurationManagement extends React.Component { } removeConfig(record) { + const { locale = {} } = this.props; const self = this; Dialog.confirm({ - language: aliwareIntl.currentLanguageCode || 'zh-cn', - title: aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.Remove_configuration'), + title: locale.removeConfiguration, content: (
-

{aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.suredelete')}

+

{locale.sureDelete}

Data ID: {record.dataId} @@ -423,9 +337,7 @@ class ConfigurationManagement extends React.Component { {record.group}

- - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.environment')} - + {locale.environment} {self.serverId || ''}

@@ -438,9 +350,7 @@ class ConfigurationManagement extends React.Component { success(res) { const _payload = {}; - _payload.title = aliwareIntl.get( - 'com.alibaba.nacos.page.configurationManagement.configuration_management' - ); + _payload.title = locale.configurationManagement; _payload.content = ''; _payload.dataId = record.dataId; _payload.group = record.group; @@ -467,41 +377,38 @@ class ConfigurationManagement extends React.Component { } renderCol(value, index, record) { + const { locale = {} } = this.props; return (
- {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.details')} + {locale.details} | - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.the_sample_code')} + {locale.sampleCode} | - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.edit')} + {locale.edit} | - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.delete')} + {locale.deleteAction} | - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.more')} + {locale.more} } triggerType={'click'} > - - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.version')} - - - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.listener_query')} - + {locale.version} + {locale.listenerQuery}
@@ -696,24 +603,15 @@ class ConfigurationManagement extends React.Component { onPageSelectAll(selected, records) {} getBatchFailedContent(res) { + const { locale = {} } = this.props; return (
{res.message}
{'data' in res && res.data != null && ( {'failedItems' in res.data && res.data.failedItems.length > 0 ? ( - - + +
@@ -722,18 +620,8 @@ class ConfigurationManagement extends React.Component { )} {'succeededItems' in res.data && res.data.succeededItems.length > 0 ? ( - - + +
@@ -742,18 +630,8 @@ class ConfigurationManagement extends React.Component { )} {'unprocessedItems' in res.data && res.data.unprocessedItems.length > 0 ? ( - - + +
@@ -794,10 +672,7 @@ class ConfigurationManagement extends React.Component { } render() { - const pubnodedata = aliwareIntl.get('pubnodata'); - const locale = { - empty: pubnodedata, - }; + const { locale = {} } = this.props; return (
(this.batchHandle = ref)} /> @@ -842,9 +717,7 @@ class ConfigurationManagement extends React.Component { }} > - {aliwareIntl.get( - 'nacos.page.configurationManagement.configuration_management8' - ) /* 配置管理 */} + {locale.configurationManagement8} | @@ -853,11 +726,9 @@ class ConfigurationManagement extends React.Component { {this.state.nownamespace_id} - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.query_results')} + {locale.queryResults}  {this.state.total}  - {aliwareIntl.get( - 'com.alibaba.nacos.page.configurationManagement.article_meet_the_requirements' - )} + {locale.articleMeetRequirements}
@@ -905,7 +771,7 @@ class ConfigurationManagement extends React.Component { onClick={this.selectAll.bind(this)} data-spm-click={'gostr=/aliyun;locaid=dashsearch'} > - {aliwareIntl.get('com.alibaba.nacos.page.configurationManagement.query')} + {locale.query} - {aliwareIntl.get( - 'nacos.page.configurationManagement.advanced_query9' - ) /* 高级查询 */} + {locale.advancedQuery9} - + - {aliwareIntl.get( - 'nacos.page.newconfig.Note_You_are_to_be_a_custom_packet_the_new_configuration,_make_sure_that_the_client_use_the_Pandora_version_higher_than_3._4._0,_otherwise_it_may_read_less_than_the_configuration.0' - )} + {locale.annotation}
- +
- + - + - {aliwareIntl.get('com.alibaba.nacos.page.newconfig.configuration_format')} + {locale.configurationFormat} -

- {aliwareIntl.get('com.alibaba.nacos.page.newconfig.configure_contents_of')} -

-

{aliwareIntl.get('com.alibaba.nacos.page.newconfig.full_screen')}

+

{locale.configureContentsOf}

+

{locale.fullScreen}

: @@ -533,11 +512,11 @@ class NewConfig extends React.Component { style={{ marginRight: 10 }} onClick={this.publishConfig.bind(this)} > - {aliwareIntl.get('com.alibaba.nacos.page.newconfig.esc_exit')} + {locale.escExit}