You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2025/11/07 06:41:10 UTC
(echarts-theme-builder) 27/28: feat: update i18n and add source code link
This is an automated email from the ASF dual-hosted git repository.
ovilia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-theme-builder.git
commit fca10b2fa09135e649d82afb54a29391b85a3804
Author: Ovilia <zw...@gmail.com>
AuthorDate: Fri Oct 10 14:22:07 2025 +0800
feat: update i18n and add source code link
---
src/components/ThemePanel.vue | 31 +++++++++++++++++++++----------
src/locales/en.json | 1 +
src/locales/zh.json | 1 +
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/components/ThemePanel.vue b/src/components/ThemePanel.vue
index da1d285..3d93823 100644
--- a/src/components/ThemePanel.vue
+++ b/src/components/ThemePanel.vue
@@ -30,10 +30,17 @@
<van-icon name="revoke" />
{{ $t('common.reset') }}
</van-button>
+ </div>
+
+ <div class="action-buttons">
<van-button @click="showHelp">
<van-icon name="info-o" />
{{ $t('common.help') }}
</van-button>
+ <van-button @click="openSourceCode">
+ <van-icon name="link-o" />
+ {{ $t('panel.sourceCode') }}
+ </van-button>
</div>
<!-- Theme Name and Series Count -->
@@ -716,7 +723,7 @@ const showUsageInstructions = (format: 'js' | 'json', filename: string) => {
<p style="margin: 0; color: #666; font-size: 14px; line-height: 1; background: #f8f9fa; padding: 10px; border-radius: 4px; border-left: 3px solid #1989fa;">${t('modals.jsUsageTip')}</p>
</div>`,
allowHtml: true,
- confirmButtonText: '好的'
+ confirmButtonText: t('common.ok')
})
} else {
showDialog({
@@ -805,6 +812,10 @@ const showHelp = () => {
})
}
+const openSourceCode = () => {
+ window.open('https://github.com/apache/echarts-theme-builder', '_blank', 'noopener,noreferrer')
+}
+
const selectPreDefinedTheme = async (index: number) => {
try {
await themeStore.loadPreDefinedTheme(index)
@@ -832,7 +843,7 @@ const handleFileImport = async (event: Event) => {
const extension = file.name.slice(file.name.lastIndexOf('.'))
if (extension !== '.json') {
showToast({
- message: '请选择 JSON 格式的配置文件!',
+ message: t('modals.selectJsonFile'),
type: 'fail'
})
target.value = ''
@@ -849,7 +860,7 @@ const handleFileImport = async (event: Event) => {
// Validate imported data
if (!data.themeName && !data.version && !data.theme) {
showToast({
- message: '请使用从本网站导出的 JSON 配置文件!',
+ message: t('modals.useExportedFile'),
type: 'fail'
})
return
@@ -859,8 +870,8 @@ const handleFileImport = async (event: Event) => {
if (data.version && data.version < 1) {
try {
await showDialog({
- title: '版本兼容性警告',
- message: '导入的主题版本较低,某些属性可能无法正确设置。是否继续导入?',
+ title: t('modals.importThemeTitle'),
+ message: t('modals.oldVersionPrompt'),
})
} catch {
return // User cancelled
@@ -875,13 +886,13 @@ const handleFileImport = async (event: Event) => {
}
showToast({
- message: '主题导入成功!',
+ message: t('modals.importSuccess'),
type: 'success'
})
} catch (error) {
console.error('Import error:', error)
showToast({
- message: '配置文件格式错误,请使用从本网站导出的 JSON 文件!',
+ message: t('modals.invalidFormat'),
type: 'fail'
})
}
@@ -889,7 +900,7 @@ const handleFileImport = async (event: Event) => {
reader.onerror = () => {
showToast({
- message: '文件读取失败,请重试',
+ message: t('modals.fileReadFailed'),
type: 'fail'
})
}
@@ -898,7 +909,7 @@ const handleFileImport = async (event: Event) => {
} catch (error) {
console.error('File import failed:', error)
showToast({
- message: '文件导入失败',
+ message: t('modals.fileReadFailed'),
type: 'fail'
})
}
@@ -921,7 +932,7 @@ const handleFileImport = async (event: Event) => {
.action-buttons {
display: flex;
gap: 8px;
- margin-bottom: 16px;
+ margin-bottom: 8px;
flex-wrap: wrap;
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 6e8d0ca..47412de 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -32,6 +32,7 @@
"export": "Export",
"themeName": "Name",
"themePlaceholder": "Please enter theme name",
+ "sourceCode": "Source Code",
"seriesCount": "Series",
"seriesPlaceholder": "Please enter series count",
"preDefinedThemes": "Predefined Themes",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 88f0bb0..b165897 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -32,6 +32,7 @@
"export": "导出配置",
"themeName": "主题名称",
"themePlaceholder": "请输入主题名称",
+ "sourceCode": "项目源码",
"seriesCount": "系列数量",
"seriesPlaceholder": "请输入系列数量",
"preDefinedThemes": "默认方案",
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org