diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java b/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java index c499a468c5..01297b83e6 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelPdfTemplateController.java @@ -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 queryAll() { return panelPdfTemplateService.queryAll(); diff --git a/backend/src/main/resources/db/migration/V50__1.18.3.sql b/backend/src/main/resources/db/migration/V50__1.18.3.sql index f9f320fd3f..4974cb230d 100644 --- a/backend/src/main/resources/db/migration/V50__1.18.3.sql +++ b/backend/src/main/resources/db/migration/V50__1.18.3.sql @@ -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` = '
\n
\n $t(''panel.panel_name''):$panelName$
\n $t(''panel.export_time''):$yyyy-MM-dd hh:mm:ss$
\n $t(''panel.export_user''):$nickName$
\n $t(''panel.you_can_type_here'')\n
\n
\n \n
\n
' WHERE id='1'; +UPDATE `panel_pdf_template` SET `name` = 'I18N_PANEL_PDF_TEMPLATE_ONLY_PIC' WHERE id='2'; diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 63c80bb089..3e28818c0a 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -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 \ No newline at end of file +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 diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index a0a278575f..c1afe1cd28 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -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) diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index fe253c3b6f..b5b4f68656 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -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 \ No newline at end of file +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 diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index f97d2eb399..765cc7595a 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -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', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index ee62fb3c3d..8c23dfbe84 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -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: '本地安裝', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 1fb1fe5f52..767c2d7f44 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -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: '本地安装', diff --git a/frontend/src/utils/StringUtils.js b/frontend/src/utils/StringUtils.js index 0707dc2bd4..8fb157234e 100644 --- a/frontend/src/utils/StringUtils.js +++ b/frontend/src/utils/StringUtils.js @@ -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 +} diff --git a/frontend/src/views/background/index.vue b/frontend/src/views/background/index.vue index bcb72f375f..58cd92aa7b 100644 --- a/frontend/src/views/background/index.vue +++ b/frontend/src/views/background/index.vue @@ -179,13 +179,13 @@ :span="5" style="padding-left: 10px;padding-top: 8px" > - 输入框样式(颜色): + {{ $t('panel.input_style') }}: - 边框 + {{ $t('panel.board') }} - 文字 + {{ $t('panel.text') }} - 背景 + {{ $t('panel.background') }}