Merge pull request #12710 from dataease/pr@dev-v2_st

feat: 国际化
This commit is contained in:
dataeaseShu 2024-10-15 14:58:34 +08:00 committed by GitHub
commit 3ea6145039
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 166 additions and 66 deletions

View File

@ -106,17 +106,21 @@ const saveSelfSubject = () => {
<div class="attr-container">
<el-row>
<el-collapse v-model="canvasAttrActiveNames">
<el-collapse-item title="仪表板风格" name="style">
<el-collapse-item :title="t('components.dashboard_style')" name="style">
<de-slider ref="slider" />
<el-button class="button-panel__style" text size="small" @click="saveSelfSubject">
{{ $t('commons.save') }}
</el-button>
</el-collapse-item>
<el-collapse-item title="整体配置" name="overallSetting">
<el-collapse-item :title="t('components.overall_configuration')" name="overallSetting">
<overall-setting @onThemeColorChange="themeColorChange" />
</el-collapse-item>
<el-collapse-item title="仪表板背景" name="background" class="content-no-padding-bottom">
<el-collapse-item
:title="t('components.dashboard_background')"
name="background"
class="content-no-padding-bottom"
>
<canvas-background themes="light"></canvas-background>
</el-collapse-item>
<el-collapse-item
@ -133,7 +137,11 @@ const saveSelfSubject = () => {
:background-border-select-width="197"
/>
</el-collapse-item>
<el-collapse-item :title="'图表配色'" name="graphical" class="no-padding no-border-bottom">
<el-collapse-item
:title="t('components.chart_color')"
name="graphical"
class="no-padding no-border-bottom"
>
<component-color-selector v-if="state.collapseShow" @onColorChange="onColorChange" />
</el-collapse-item>
<el-collapse-item :title="t('visualization.chart_title')" name="viewTitle">
@ -147,7 +155,7 @@ const saveSelfSubject = () => {
<filter-style-simple-selector />
</el-collapse-item>
<el-collapse-item
title="高级样式设置"
:title="t('components.advanced_style_settings')"
name="seniorStyleSetting"
class="no-padding no-border-bottom"
>

View File

@ -106,7 +106,7 @@ const closeEditCanvasName = () => {
return
}
if (inputName.value.trim().length > 64 || inputName.value.trim().length < 1) {
ElMessage.warning('名称字段长度1-64个字符')
ElMessage.warning(t('components.length_1_64_characters'))
editCanvasName()
return
}
@ -134,7 +134,7 @@ const previewInner = () => {
const previewOuter = () => {
if (!dvInfo.value.id) {
ElMessage.warning('请先保存当前页面')
ElMessage.warning(t('components.current_page_first'))
return
}
canvasSave(() => {
@ -174,11 +174,11 @@ const resourceOptFinish = param => {
const saveCanvasWithCheck = () => {
if (userStore.getOid && wsCache.get('user.oid') && userStore.getOid !== wsCache.get('user.oid')) {
ElMessageBox.confirm('已切换至新组织,无权保存其他组织的资源', {
ElMessageBox.confirm(t('components.from_other_organizations'), {
confirmButtonType: 'primary',
type: 'warning',
confirmButtonText: '关闭页面',
cancelButtonText: '取消',
confirmButtonText: t('components.close_the_page'),
cancelButtonText: t('common.cancel'),
autofocus: false,
showClose: false
}).then(() => {
@ -218,7 +218,7 @@ const saveResource = () => {
try {
canvasSave(() => {
snapshotStore.resetStyleChangeTimes()
ElMessage.success('保存成功')
ElMessage.success(t('common.save_success'))
let url = window.location.href
url = url.replace(/\?opt=create/, `?resourceId=${dvInfo.value.id}`)
window.history.replaceState(null, '', url)
@ -251,7 +251,7 @@ const backToMain = () => {
url = url + '?dvId=' + dvInfo.value.id
}
if (styleChangeTimes.value > 0) {
ElMessageBox.confirm('当前的更改尚未保存,确定退出吗?', {
ElMessageBox.confirm(t('components.sure_to_exit'), {
confirmButtonType: 'primary',
type: 'warning',
autofocus: false,
@ -300,7 +300,7 @@ const openDataBoardSetting = () => {
const openMobileSetting = () => {
if (!dvInfo.value.id || dvInfo.value.dataState === 'prepare') {
ElMessage.warning('请先保存当前页面')
ElMessage.warning(t('components.current_page_first'))
return
}
useEmitt().emitter.emit('mobileConfig')
@ -366,11 +366,11 @@ const batchOptStatusChange = value => {
const openOuterParamsSet = () => {
if (componentData.value.length === 0) {
ElMessage.warning('当前仪表板为空,请先添加组件')
ElMessage.warning(t('components.add_components_first'))
return
}
if (!dvInfo.value.id) {
ElMessage.warning('请先保存当前页面')
ElMessage.warning(t('components.current_page_first'))
return
}
//
@ -418,7 +418,7 @@ const saveLinkageSetting = () => {
linkageInfo: targetLinkageInfo.value
}
saveLinkage(request).then(() => {
ElMessage.success('保存成功')
ElMessage.success(t('save_success.common'))
//
getPanelAllLinkageInfo(dvInfo.value.id).then(rsp => {
dvMainStore.setNowPanelTrackInfo(rsp.data)
@ -497,7 +497,7 @@ const initOpenHandler = newWindow => {
</div>
<div class="left-area" v-if="batchOptStatus">
<el-col class="adapt-count">
<span>已选 {{ curBatchOptComponents.length }} </span>
<span>{{ t('user.selection_info', [curBatchOptComponents.length]) }}</span>
</el-col>
</div>
<div class="middle-area" v-if="!batchOptStatus && !linkageSettingStatus">
@ -507,7 +507,7 @@ const initOpenHandler = newWindow => {
is-label
:icon-name="dvView"
themes="light"
title="图表"
:title="t('chart.datalist')"
>
<user-view-group themes="light" :dv-model="dvModel"></user-view-group>
</component-group>
@ -517,7 +517,7 @@ const initOpenHandler = newWindow => {
is-label
themes="light"
:icon-name="dvFilter"
title="查询组件"
:title="t('visualization.filter_component')"
>
<query-group themes="light" :dv-model="dvModel"></query-group>
</component-group>
@ -526,7 +526,7 @@ const initOpenHandler = newWindow => {
themes="light"
:base-width="115"
:icon-name="dvText"
title="富文本"
:title="t('components.rich_text')"
>
<text-group themes="light" :dv-model="dvModel"></text-group>
</component-group>
@ -536,7 +536,7 @@ const initOpenHandler = newWindow => {
placement="bottom"
:base-width="328"
:icon-name="dvMedia"
title="媒体"
:title="t('components.media')"
>
<media-group themes="light" :dv-model="dvModel"></media-group>
</component-group>
@ -549,13 +549,13 @@ const initOpenHandler = newWindow => {
is-label
:base-width="115"
:icon-name="dvMoreCom"
title="更多"
:title="'visualization.more'"
>
<db-more-com-group themes="light" :dv-model="dvModel"></db-more-com-group>
</component-group>
<component-button-label
:icon-name="icon_copy_filled"
title="复用"
:title="t('visualization.multiplexing')"
is-label
@customClick="multiplexingCanvasOpen"
></component-button-label>
@ -564,32 +564,45 @@ const initOpenHandler = newWindow => {
<div class="right-area" v-if="!batchOptStatus && !linkageSettingStatus">
<template v-if="editMode !== 'preview'">
<el-tooltip effect="dark" content="外部参数设置" placement="bottom">
<el-tooltip
effect="dark"
:content="t('visualization.outer_param_set')"
placement="bottom"
>
<component-button
tips="外部参数设置"
:tips="t('visualization.outer_param_set')"
@custom-click="openOuterParamsSet"
:icon-name="icon_params_setting"
/>
</el-tooltip>
<el-tooltip effect="dark" content="批量操作" placement="bottom">
<el-tooltip effect="dark" :content="t('visualization.batch_opt')" placement="bottom">
<component-button
tips="批量操作"
:tips="t('visualization.batch_opt')"
@custom-click="batchOptStatusChange(true)"
:icon-name="dvBatch"
/>
</el-tooltip>
<el-tooltip effect="dark" content="仪表板配置" placement="bottom">
<el-tooltip
effect="dark"
:content="t('components.dashboard_configuration')"
placement="bottom"
>
<component-button
tips="仪表板配置"
:tips="t('components.dashboard_configuration')"
@custom-click="openDataBoardSetting"
:icon-name="dvDashboard"
/>
</el-tooltip>
<div class="divider"></div>
<el-tooltip :offset="14" effect="dark" content="切换至移动端布局" placement="bottom">
<el-tooltip
:offset="14"
effect="dark"
:content="t('components.to_mobile_layout')"
placement="bottom"
>
<component-button
tips="切换至移动端布局"
:tips="t('components.to_mobile_layout')"
@custom-click="openMobileSetting"
:icon-name="icon_phone_outlined"
/>
@ -598,7 +611,7 @@ const initOpenHandler = newWindow => {
<el-dropdown v-if="editMode === 'edit'" trigger="hover">
<el-button class="preview-button" style="float: right; margin-right: 12px">
预览
{{ t('visualization.preview') }}
</el-button>
<template #dropdown>
<el-dropdown-menu class="drop-style">
@ -606,13 +619,13 @@ const initOpenHandler = newWindow => {
<el-icon style="margin-right: 8px; font-size: 16px">
<Icon name="icon_pc_fullscreen"><icon_pc_fullscreen class="svg-icon" /></Icon>
</el-icon>
全屏预览
{{ t('visualization.fullscreen_preview') }}
</el-dropdown-item>
<el-dropdown-item @click="previewOuter()">
<el-icon style="margin-right: 8px; font-size: 16px">
<Icon name="dv-preview-outer"><dvPreviewOuter class="svg-icon" /></Icon>
</el-icon>
新页面预览
{{ t('work_branch.new_page_preview') }}
</el-dropdown-item>
</el-dropdown-menu>
</template>
@ -625,7 +638,7 @@ const initOpenHandler = newWindow => {
@click="edit()"
type="primary"
>
编辑
{{ t('data_set.edit') }}
</el-button>
<el-button
@ -635,7 +648,7 @@ const initOpenHandler = newWindow => {
style="float: right; margin-right: 12px"
type="primary"
>
保存
{{ t('data_set.save') }}
</el-button>
</div>
@ -648,7 +661,7 @@ const initOpenHandler = newWindow => {
:disabled="curBatchOptComponents.length === 0"
style="float: right; margin-right: 12px"
>
复制</el-button
{{ t('data_set.copy') }}</el-button
>
<el-button
@ -659,11 +672,14 @@ const initOpenHandler = newWindow => {
:disabled="curBatchOptComponents.length === 0"
style="float: right; margin-right: 12px"
>
删除</el-button
{{ t('data_set.delete') }}</el-button
>
<el-button @click="saveBatchChange" style="float: right; margin-right: 12px" type="primary"
>完成</el-button
<el-button
@click="saveBatchChange"
style="float: right; margin-right: 12px"
type="primary"
>{{ t('components.complete') }}</el-button
>
</div>
@ -673,13 +689,13 @@ const initOpenHandler = newWindow => {
@click="cancelLinkageSetting()"
style="float: right; margin-right: 12px"
>
取消</el-button
{{ t('userimport.cancel') }}</el-button
>
<el-button
@click="saveLinkageSetting"
style="float: right; margin-right: 12px"
type="primary"
>确定</el-button
>{{ t('userimport.sure') }}</el-button
>
</div>
</div>

View File

@ -159,7 +159,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分页器配色" class="form-item">
<el-form-item :label="t('components.pager_color')" class="form-item">
<el-color-picker
:trigger-width="colorPickerWidth"
v-model="seniorForm.pagerColor"

View File

@ -4,7 +4,7 @@
<div style="width: 100%; padding: 16px 8px 0">
<el-row :gutter="8">
<el-col :span="12">
<el-form-item class="form-item" label="标题水平位置">
<el-form-item class="form-item" :label="t('components.title_horizontal_position')">
<el-tooltip effect="dark" placement="top">
<template #content>
{{ t('chart.text_pos_left') }}
@ -50,7 +50,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="form-item" label="标题显示位置">
<el-form-item class="form-item" :label="t('components.title_display_position')">
<el-tooltip effect="dark" placement="top">
<template #content>
{{ t('chart.text_pos_top') }}
@ -82,7 +82,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="form-item" label="标题颜色">
<el-form-item class="form-item" :label="t('components.title_color')">
<el-color-picker
v-model="filterStyle.titleColor"
:trigger-width="197"
@ -93,7 +93,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="form-item" label="标签颜色">
<el-form-item class="form-item" :label="t('components.label_color')">
<el-color-picker
v-model="filterStyle.labelColor"
:trigger-width="197"
@ -108,7 +108,7 @@
</div>
<el-collapse-item
title="输入框样式"
:title="t('components.input_box_style')"
name="input_style_filter_selector"
class="inner-collapse"
>

View File

@ -79,11 +79,11 @@
v-model="canvasStyleData.refreshBrowserEnable"
@change="themeChange"
>
整体刷新
{{ t('components.overall_refresh') }}
</el-checkbox>
<el-tooltip class="item" :effect="toolTip" placement="bottom">
<template #content>
<div>仅公共链接和新Tab预览生效</div>
<div>{{ t('components.previews_take_effect') }}</div>
</template>
<el-icon
class="hint-icon"
@ -229,7 +229,9 @@ const toolTip = computed(() => {
return props.themes === 'dark' ? 'ndark' : 'dark'
})
const resourceType = computed(() => (dvInfo.value.type === 'dashboard' ? '仪表板' : '数据大屏'))
const resourceType = computed(() =>
dvInfo.value.type === 'dashboard' ? t('dashboard.dashboard') : t('dashboard.big_data_screen')
)
const onRefreshChange = val => {
if (val === '' || parseFloat(val).toString() === 'NaN' || parseFloat(val) < 1) {

View File

@ -7,7 +7,7 @@
:effect="themes"
class="form-item"
:class="'form-item-' + themes"
label="联动、钻取、跳转的图标颜色"
:label="t('components.jump_icon_color')"
>
<el-color-picker
:effect="themes"
@ -24,7 +24,7 @@
:effect="themes"
class="form-item"
:class="'form-item-' + themes"
label="钻取层级展示颜色"
:label="t('components.level_display_color')"
>
<el-color-picker
v-model="seniorStyleSetting.drillLayerColor"

View File

@ -1,6 +1,8 @@
<template>
<el-row class="custom-row">
<el-row><span class="custom-item-text">文本</span> </el-row>
<el-row
><span class="custom-item-text">{{ t('chart.text') }}</span>
</el-row>
<el-row style="margin-top: 8px">
<el-space wrap>
<el-form-item class="form-item no-margin-bottom" :class="'form-item-' + themes">
@ -19,7 +21,7 @@
style="width: 56px"
:title="t('chart.text_fontsize')"
v-model="titleForm.fontSize"
:placeholder="'大小'"
:placeholder="t('chart.size')"
size="small"
@change="changeTitleStyle('fontSize')"
>

View File

@ -206,6 +206,7 @@ const dvMainStore = dvMainStoreWithOut()
const { canvasStyleData } = storeToRefs(dvMainStore)
const emit = defineEmits(['reload'])
import { guid } from '@/views/visualized/data/dataset/form/util.js'
import { useI18n } from '@/hooks/web/useI18n'
import SubjectEditDialog from '@/components/dashboard/subject-setting/pre-subject/SubjectEditDialog.vue'
const subjectEditDialogRef = ref(null)
@ -221,7 +222,7 @@ const props = defineProps({
})
const { initialSpeed } = toRefs(props)
const { t } = useI18n()
const state = reactive({
temp: null,
sliders: [],
@ -264,7 +265,7 @@ const querySubjectWithGroup = () => {
const subjectDelete = id => {
deleteSubject(id).then(() => {
ElMessage.success('删除成功')
ElMessage.success(t('chart.delete_success'))
querySubjectWithGroup()
})
}
@ -274,7 +275,7 @@ const subjectEditFinish = subjectItem => {
saveOrUpdateSubject(subjectItem)
.then(() => {
subjectEditDialogRef.value.resetForm()
ElMessage.success('保存成功')
ElMessage.success(t('dataset.save_success'))
querySubjectWithGroup()
})
.catch(() => {
@ -295,7 +296,7 @@ const saveSelfSubject = () => {
const canvasStyle = deepCopy(canvasStyleData.value)
canvasStyle.themeId = guid()
const subjectItemNew = {
name: '新建主题',
name: t('components.a_new_theme'),
coverUrl: null,
details: JSON.stringify(canvasStyle)
}

View File

@ -22,7 +22,7 @@ const rules = {
coverUrl: [
{
required: true,
message: '请上传封面',
message: t('components.upload_a_cover'),
trigger: 'change'
}
]
@ -36,7 +36,9 @@ const resetForm = () => {
subjectDialogShow.value = false
}
const subjectForm = ref(null)
const title = computed(() => (optType.value === 'new' ? '新建主题' : '编辑主题'))
const title = computed(() =>
optType.value === 'new' ? t('components.a_new_theme') : t('components.edit_theme')
)
const optInit = (subjectItem, opt) => {
optType.value = opt
@ -80,20 +82,20 @@ const onImgChange = imgUrl => {
>
<el-form-item class="form-item" prop="name">
<template #label>
<label class="m-label"> 名称 </label>
<label class="m-label"> {{ t('common.name') }} </label>
</template>
<el-input v-model="subjectForm.name" />
</el-form-item>
<el-form-item class="form-item" prop="coverUrl">
<template #label>
<label class="m-label"> 封面 </label>
<label class="m-label"> {{ t('components.cover') }} </label>
</template>
<de-upload themes="light" :img-url="subjectForm.coverUrl" @onImgChange="onImgChange" />
</el-form-item>
</el-form>
<template #footer>
<el-button secondary @click="resetForm()">取消</el-button>
<el-button type="primary" @click="saveSubject()">确认</el-button>
<el-button secondary @click="resetForm()">{{ t('common.cancel') }}</el-button>
<el-button type="primary" @click="saveSubject()">{{ t('chart.confirm') }}</el-button>
</template>
</el-dialog>
</template>

View File

@ -59,6 +59,7 @@ import { adaptCurThemeCommonStyleAll } from '@/utils/canvasStyle'
import { useEmitt } from '@/hooks/web/useEmitt'
const dvMainStore = dvMainStoreWithOut()
const snapshotStore = snapshotStoreWithOut()
import { useI18n } from '@/hooks/web/useI18n'
const { canvasStyleData } = storeToRefs(dvMainStore)
@ -67,6 +68,7 @@ const state = reactive({
subjectItemDetails: null,
canEdit: false
})
const { t } = useI18n()
const props = defineProps({
subjectItem: {
@ -83,7 +85,7 @@ const themeSelected = computed(() => {
})
const emit = defineEmits(['subjectDelete', 'onSubjectChange', 'subjectEdit'])
const subjectDelete = () => {
ElMessageBox.confirm('确定删除[' + subjectItem.value.name + ']吗?', {
ElMessageBox.confirm(t('components.to_delete_', [subjectItem.value.name]), {
confirmButtonType: 'danger',
type: 'warning',
autofocus: false,

View File

@ -36,6 +36,40 @@ export default {
delete_success: 'Delete success',
no_auth_tips: 'Missing menu permissions, please contact the administrator'
},
components: {
dashboard_style: 'Dashboard style',
overall_configuration: 'Overall configuration',
dashboard_background: 'Dashboard background',
chart_color: 'Chart color',
advanced_style_settings: 'Advanced style settings',
length_1_64_characters: 'Name field length 1-64 characters',
current_page_first: 'Please save the current page first',
from_other_organizations:
'Switch to new organization, no permission to save resources from other organizations',
close_the_page: 'Close the page',
sure_to_exit: 'Current changes have not been saved, are you sure to exit?',
add_components_first: 'The current dashboard is empty, please add components first',
rich_text: 'Rich text',
media: 'Media',
dashboard_configuration: 'Dashboard configuration',
to_mobile_layout: 'Switch to mobile layout',
complete: 'Complete',
pager_color: 'Pager color',
title_horizontal_position: 'Title horizontal position',
title_display_position: 'Title display position',
title_color: 'Title color',
label_color: 'Label color',
input_box_style: 'Input box style',
overall_refresh: 'Overall refresh',
previews_take_effect: 'Only public links and new tab previews take effect',
jump_icon_color: 'Link, drill, jump icon color',
level_display_color: 'Drill level display color',
a_new_theme: 'Create a new theme',
upload_a_cover: 'Please upload a cover',
edit_theme: 'Edit theme',
cover: 'Cover',
to_delete_: 'Are you sure to delete [100]?'
},
work_branch: {
recommended_dashboard: 'Recommended dashboard',
template_market_official:

View File

@ -393,6 +393,39 @@ export default {
role: '角色',
addUser: '@:common.add@:system.user'
},
components: {
dashboard_style: '仪表板风格',
overall_configuration: '整体配置',
dashboard_background: '仪表板背景',
chart_color: '图表配色',
advanced_style_settings: '高级样式设置',
length_1_64_characters: '名称字段长度1-64个字符',
current_page_first: '请先保存当前页面',
from_other_organizations: '已切换至新组织无权保存其他组织的资源',
close_the_page: '关闭页面',
sure_to_exit: '当前的更改尚未保存确定退出吗',
add_components_first: '当前仪表板为空请先添加组件',
rich_text: '富文本',
media: '媒体',
dashboard_configuration: '仪表板配置',
to_mobile_layout: '切换至移动端布局',
complete: '完成',
pager_color: '分页器配色',
title_horizontal_position: '标题水平位置',
title_display_position: '标题显示位置',
title_color: '标题颜色',
label_color: '标签颜色',
input_box_style: '输入框样式',
overall_refresh: '整体刷新',
previews_take_effect: '仅公共链接和新Tab预览生效',
jump_icon_color: '联动钻取跳转的图标颜色',
level_display_color: '钻取层级展示颜色',
a_new_theme: '新建主题',
upload_a_cover: '请上传封面',
edit_theme: '编辑主题',
cover: '封面',
to_delete_: '确定删除[{0}]?'
},
user: {
change_password: '修改密码',
select_users: '请选择用户',