forked from github/dataease
fix(i18n): i18n
This commit is contained in:
parent
98478cb45d
commit
9f6e66ad82
@ -1,6 +1,7 @@
|
||||
package io.dataease.controller.panel;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.controller.handler.annotation.I18n;
|
||||
import io.dataease.plugins.common.base.domain.PanelPdfTemplate;
|
||||
import io.dataease.service.panel.PanelPdfTemplateService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -26,6 +27,7 @@ public class PanelPdfTemplateController {
|
||||
private PanelPdfTemplateService panelPdfTemplateService;
|
||||
|
||||
@GetMapping("queryAll")
|
||||
@I18n
|
||||
@ApiOperation("查询所有仪表板模板")
|
||||
public List<PanelPdfTemplate> queryAll() {
|
||||
return panelPdfTemplateService.queryAll();
|
||||
|
@ -2,3 +2,5 @@ UPDATE `my_plugin`
|
||||
SET `version` = '1.18.3'
|
||||
where `plugin_id` > 0
|
||||
and `version` = '1.18.2';
|
||||
UPDATE `panel_pdf_template` SET `name` = 'I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS',`template_content` = '<div style=\"margin-top: 5px\">\n <div contenteditable=\"true\"> \n $t(''panel.panel_name''):$panelName$ </br>\n $t(''panel.export_time''):$yyyy-MM-dd hh:mm:ss$ </br>\n $t(''panel.export_user''):$nickName$ </br>\n $t(''panel.you_can_type_here'')\n </div>\n <div>\n <img width=\"100%\" src=\"$snapshot$\">\n </div>\n </div>' WHERE id='1';
|
||||
UPDATE `panel_pdf_template` SET `name` = 'I18N_PANEL_PDF_TEMPLATE_ONLY_PIC' WHERE id='2';
|
||||
|
@ -62,7 +62,7 @@ i18n_panel_list=Dashboard
|
||||
i18n_processing_data=Processing data now, Refresh later
|
||||
i18n_union_already_exists=Union relation already exists
|
||||
i18n_union_field_exists=The same field can't in two dataset
|
||||
i18n_cron_time_error=Start time can't greater then end time
|
||||
i18n_cron_time_error=Start time can't greater than end time
|
||||
i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled,Please Connect Admin
|
||||
i18n_username_exists=ID is already exists
|
||||
i18n_nickname_exists=NickName is already exists
|
||||
@ -134,7 +134,7 @@ theme_name_empty=name can not be empty
|
||||
i18n_public_chart=\u3010Public Chart\u3011
|
||||
i18n_class_blue=Blue Tone
|
||||
\u63D2\u4EF6\u7BA1\u7406=Plugins
|
||||
i18n_plugin_not_allow_delete=The plugin in in use cannot be deleted
|
||||
i18n_plugin_not_allow_delete=The plugin in use cannot be deleted
|
||||
i18n_wrong_content=Wrong content
|
||||
i18n_wrong_tel=Wrong tel format
|
||||
i18n_wrong_email=Wrong email format
|
||||
@ -146,7 +146,7 @@ OPERATE_TYPE_DELETE=Delete
|
||||
OPERATE_TYPE_SHARE=Share
|
||||
OPERATE_TYPE_UNSHARE=Unshare
|
||||
OPERATE_TYPE_AUTHORIZE=Authorize
|
||||
OPERATE_TYPE_UNAUTHORIZE=Unauthorize
|
||||
OPERATE_TYPE_UNAUTHORIZE=Unauthorized
|
||||
OPERATE_TYPE_CREATELINK=Create Link
|
||||
OPERATE_TYPE_DELETELINK=Delete Link
|
||||
OPERATE_TYPE_MODIFYLINK=Modify Link
|
||||
@ -261,4 +261,16 @@ I18N_LOG_FORMAT_PREFIX=With authority of %s\u3010%s\u3011
|
||||
\u6C34\u5370\u7BA1\u7406=Watermark
|
||||
\u8840\u7F18\u5173\u7CFB=Relationship
|
||||
|
||||
I18N_CRON_ERROR=Cron expression error
|
||||
I18N_CRON_ERROR=Cron expression error
|
||||
I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS=Default template with params
|
||||
I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=Default template only screenshot
|
||||
\u8FB9\u68461=Border 1
|
||||
\u8FB9\u68462=Border 2
|
||||
\u8FB9\u68463=Border 3
|
||||
\u8FB9\u68464=Border 4
|
||||
\u8FB9\u68465=Border 5
|
||||
\u8FB9\u68466=Border 6
|
||||
\u8FB9\u68467=Border 7
|
||||
\u8FB9\u68468=Border 8
|
||||
\u8FB9\u68469=Border 9
|
||||
\u8FB9\u684610=Border 10
|
||||
|
@ -262,4 +262,6 @@ I18N_LOG_FORMAT_PREFIX=\u4EE5%s\u3010%s\u3011\u6743\u9650
|
||||
\u8840\u7F18\u5173\u7CFB=\u8840\u7F18\u5173\u7CFB
|
||||
|
||||
I18N_CRON_ERROR=cron\u8868\u8FBE\u5F0F\u9519\u8BEF
|
||||
I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS=\u9ED8\u8BA4\u6A21\u677F(\u52A0\u53C2\u6570\u6837\u5F0F)
|
||||
I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8BA4\u6A21\u677F(\u53EA\u622A\u56FE)
|
||||
|
||||
|
@ -257,4 +257,16 @@ I18N_LOG_FORMAT_PREFIX=\u4EE5%s\u3010%s\u3011\u6B0A\u9650
|
||||
\u6C34\u5370\u7BA1\u7406=\u6C34\u5370\u7BA1\u7406
|
||||
\u8840\u7F18\u5173\u7CFB=\u8840\u7DE3\u95DC\u7CFB
|
||||
|
||||
I18N_CRON_ERROR=cron\u8868\u9054\u5F0F\u932F\u8AA4
|
||||
I18N_CRON_ERROR=cron\u8868\u9054\u5F0F\u932F\u8AA4
|
||||
I18N_PANEL_PDF_TEMPLATE_WITH_PARAMS=\u9ED8\u8A8D\u6A21\u677F(\u52A0\u53C3\u6578\u6A23\u5F0F)
|
||||
I18N_PANEL_PDF_TEMPLATE_ONLY_PIC=\u9ED8\u8A8D\u6A21\u677F(\u53EA\u622A\u5716)
|
||||
\u8FB9\u68461=\u908A\u6846 1
|
||||
\u8FB9\u68462=\u908A\u6846 2
|
||||
\u8FB9\u68463=\u908A\u6846 3
|
||||
\u8FB9\u68464=\u908A\u6846 4
|
||||
\u8FB9\u68465=\u908A\u6846 5
|
||||
\u8FB9\u68466=\u908A\u6846 6
|
||||
\u8FB9\u68467=\u908A\u6846 7
|
||||
\u8FB9\u68468=\u908A\u6846 8
|
||||
\u8FB9\u68469=\u908A\u6846 9
|
||||
\u8FB9\u684610=\u908A\u6846 10
|
||||
|
@ -2316,7 +2316,13 @@ export default {
|
||||
fold: 'Fold',
|
||||
expand: 'Expand',
|
||||
pdf_export: 'PDF Export',
|
||||
switch_pdf_template: 'Switch PDF Template'
|
||||
switch_pdf_template: 'Switch PDF Template',
|
||||
pdf_template_with_params: 'Default template(with params)',
|
||||
pdf_template_only_pic: 'Default template(only screenshot)',
|
||||
panel_name: 'Panel name',
|
||||
export_user: 'Export User',
|
||||
export_time: 'Export Time',
|
||||
you_can_type_here: 'You can type here'
|
||||
},
|
||||
plugin: {
|
||||
local_install: 'Local installation',
|
||||
|
@ -2310,7 +2310,13 @@ export default {
|
||||
fold: '收起',
|
||||
expand: '展開',
|
||||
pdf_export: 'PDF 導出',
|
||||
switch_pdf_template: '切換 PDF 模板'
|
||||
switch_pdf_template: '切換 PDF 模板',
|
||||
pdf_template_with_params: '默認模板(加參數樣式)',
|
||||
pdf_template_only_pic: '默認模板(只截圖)',
|
||||
panel_name: '儀錶板名稱',
|
||||
export_user: '導出用戶',
|
||||
export_time: '導出時間',
|
||||
you_can_type_here: '可以在這裡輸入其他內容'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安裝',
|
||||
|
@ -2310,7 +2310,13 @@ export default {
|
||||
fold: '收起',
|
||||
expand: '展开',
|
||||
pdf_export: 'PDF 导出',
|
||||
switch_pdf_template: '切换 PDF 模板'
|
||||
switch_pdf_template: '切换 PDF 模板',
|
||||
pdf_template_with_params: '默认模板(加参数样式)',
|
||||
pdf_template_only_pic: '默认模板(只截图)',
|
||||
panel_name: '仪表板名称',
|
||||
export_user: '导出用户',
|
||||
export_time: '导出时间',
|
||||
you_can_type_here: '可以在这里输入其他内容'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安装',
|
||||
|
@ -1,3 +1,5 @@
|
||||
import i18n from '@/lang'
|
||||
|
||||
// 替换所有 标准模板格式 为 $panelName$
|
||||
export function pdfTemplateReplaceAll(content, source, target) {
|
||||
const pattern = '\\$' + source + '\\$'
|
||||
@ -37,3 +39,20 @@ export function includesAny(target, ...sources) {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 替换字符串中的国际化内容, 格式为$t('xxx')
|
||||
export function replaceInlineI18n(rawString) {
|
||||
const res = []
|
||||
const reg = /\$t\('([\w.]+)'\)/gm
|
||||
let tmp
|
||||
if (!rawString) {
|
||||
return res
|
||||
}
|
||||
while ((tmp = reg.exec(rawString)) !== null) {
|
||||
res.push(tmp)
|
||||
}
|
||||
res.forEach((tmp) => {
|
||||
rawString = rawString.replaceAll(tmp[0], i18n.t(tmp[1]))
|
||||
})
|
||||
return rawString
|
||||
}
|
||||
|
@ -179,13 +179,13 @@
|
||||
:span="5"
|
||||
style="padding-left: 10px;padding-top: 8px"
|
||||
>
|
||||
输入框样式(颜色):
|
||||
{{ $t('panel.input_style') }}:
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="2"
|
||||
style="padding-left: 10px;padding-top: 8px"
|
||||
>
|
||||
边框
|
||||
{{ $t('panel.board') }}
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="3"
|
||||
@ -202,7 +202,7 @@
|
||||
:span="2"
|
||||
style="padding-left: 10px;padding-top: 8px"
|
||||
>
|
||||
文字
|
||||
{{ $t('panel.text') }}
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="3"
|
||||
@ -219,7 +219,7 @@
|
||||
:span="2"
|
||||
style="padding-left: 10px;padding-top: 8px"
|
||||
>
|
||||
背景
|
||||
{{ $t('panel.background') }}
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="3"
|
||||
|
@ -39,7 +39,7 @@
|
||||
import JsPDF from 'jspdf'
|
||||
import html2canvas from 'html2canvasde'
|
||||
import { formatTimeToStr } from './date.js'
|
||||
import { pdfTemplateReplaceAll } from '@/utils/StringUtils.js'
|
||||
import { pdfTemplateReplaceAll, replaceInlineI18n } from '@/utils/StringUtils.js'
|
||||
|
||||
export default {
|
||||
name: 'PDFPreExport',
|
||||
@ -121,6 +121,7 @@ export default {
|
||||
for (const [key, value] of Object.entries(this.varsInfo)) {
|
||||
this.templateContentChange = pdfTemplateReplaceAll(this.templateContentChange, key, value || '')
|
||||
}
|
||||
this.templateContentChange = replaceInlineI18n(this.templateContentChange)
|
||||
},
|
||||
|
||||
cancel() {
|
||||
|
Loading…
Reference in New Issue
Block a user