feat: i18n
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run

This commit is contained in:
wxg0103 2025-01-20 19:00:58 +08:00
parent fd7383c519
commit 29ddee8d06
14 changed files with 283 additions and 14 deletions

View File

@ -399,7 +399,8 @@ class ApplicationSerializer(serializers.Serializer):
'access_num': application_access_token.access_num,
'white_active': application_access_token.white_active,
'white_list': application_access_token.white_list,
'show_source': application_access_token.show_source
'show_source': application_access_token.show_source,
'language': application_access_token.language
}
class Authentication(serializers.Serializer):

View File

@ -0,0 +1,32 @@
export default {
noHistory: 'No History',
createChat: 'Create New Chat',
history: 'History',
only20history: 'Only showing the last 20 conversations',
question_count: 'Questions',
exportRecords: 'Export Chat Records',
chatId: 'Chat ID',
userInput: 'User Input',
passwordValidator: {
title: 'Enter password to open the link',
errorMessage1: 'Password cannot be empty',
errorMessage2: 'Incorrect password'
},
tip: {
error500Message: 'Sorry, the service is currently under maintenance. Please try again later!',
errorIdentifyMessage: 'Unable to identify user',
errorLimitMessage:
'Sorry, you have reached the maximum number of questions. Please try again tomorrow!'
},
executionDetails: {
title: 'Execution Details',
paramInput: 'Parameter Input',
paramOutput: 'Parameter Output'
},
KnowledgeSource: {
title: 'Knowledge Source',
referenceParagraph: 'Referenced Paragraph',
consume: 'Consumption',
consumeTime: 'Time Consumed'
}
}

View File

@ -0,0 +1,78 @@
export default {
input_type_list: {
TextInput: 'Text Input',
Slider: 'Slider',
SwitchInput: 'Switch',
SingleSelect: 'Single Select',
MultiSelect: 'Multi Select',
DatePicker: 'Date Picker',
JsonInput: 'JSON Text Input',
RadioCard: 'Radio Card',
RadioRow: 'Radio Row'
},
default: {
label: 'Default Value',
placeholder: 'Please enter a default value',
requiredMessage: 'Default Value is a required property',
show: 'Show Default Value'
},
tip: {
requiredMessage: 'Cannot be empty',
jsonMessage: 'Incorrect JSON format'
},
searchBar: {
placeholder: 'Please enter keywords to search'
},
paramForm: {
field: {
label: 'Parameter',
placeholder: 'Please enter a parameter',
requiredMessage: 'Parameter is a required property',
requiredMessage2: 'Only letters, numbers, and underscores are allowed'
},
name: {
label: 'Display Name',
placeholder: 'Please enter a display name',
requiredMessage: 'Display Name is a required property'
},
tooltip: {
label: 'Parameter Tooltip',
placeholder: 'Please enter a parameter tooltip'
},
required: {
label: 'Is Required',
requiredMessage: 'Is Required is a required property'
},
input_type: {
label: 'Component Type',
placeholder: 'Please select a component type',
requiredMessage: 'Component Type is a required property'
}
},
DatePicker: {
placeholder: 'Select Date',
year: 'Year',
month: 'Month',
date: 'Date',
datetime: 'Date Time',
dataType: {
label: 'Date Type',
placeholder: 'Please select a date type'
},
format: {
label: 'Format',
placeholder: 'Please select a format'
}
},
Select: {
label: 'Option Value',
placeholder: 'Please enter an option value'
},
tag: {
label: 'Tag',
placeholder: 'Please enter an option label'
},
Slider: {
showInput: ''
}
}

View File

@ -1,4 +1,7 @@
import dynamicsForm from './dynamics-form'
import chat from './ai-chat'
export default {
};
dynamicsForm,
chat,
noData: 'No Data'
}

View File

@ -62,6 +62,7 @@ export default {
},
SettingDisplayDialog: {
dialogTitle: 'Display Settings',
languageLabel: 'Language',
showSourceLabel: 'Show Source',
showExecutionDetail: 'Show Execution Detail',
restoreDefault: 'Restore Default',

View File

@ -4,7 +4,7 @@ export default {
history: '历史记录',
only20history: '仅显示最近 20 条对话',
question_count: '条提问',
exportReords: '导出聊天记录',
exportRecords: '导出聊天记录',
chatId: '对话id',
userInput: '用户输入',
passwordValidator: {

View File

@ -62,6 +62,7 @@ export default {
},
SettingDisplayDialog: {
dialogTitle: '显示设置',
languageLabel: '语言',
showSourceLabel: '显示知识来源',
showExecutionDetail: '显示执行详情',
restoreDefault: '恢复默认',

View File

@ -0,0 +1,31 @@
export default {
noHistory: '暫無歷史記錄',
createChat: '新建對話',
history: '歷史記錄',
only20history: '僅顯示最近 20 條對話',
question_count: '條提問',
exportRecords: '導出聊天記錄',
chatId: '對話ID',
userInput: '用戶輸入',
passwordValidator: {
title: '請輸入密碼打開連結',
errorMessage1: '密碼不能為空',
errorMessage2: '密碼錯誤'
},
tip: {
error500Message: '抱歉,當前正在維護,無法提供服務,請稍後再試!',
errorIdentifyMessage: '無法識別用戶身份',
errorLimitMessage: '抱歉,您的提問已達最大限制,請明天再來吧!'
},
executionDetails: {
title: '執行詳細',
paramInput: '參數輸入',
paramOutput: '參數輸出'
},
KnowledgeSource: {
title: '知識來源',
referenceParagraph: '引用分段',
consume: '消耗',
consumeTime: '耗時'
}
}

View File

@ -0,0 +1,78 @@
export default {
input_type_list: {
TextInput: '文字框',
Slider: '滑桿',
SwitchInput: '開關',
SingleSelect: '單選框',
MultiSelect: '多選框',
DatePicker: '日期選擇器',
JsonInput: 'JSON文字框',
RadioCard: '選項卡',
RadioRow: '單行選項卡'
},
default: {
label: '預設值',
placeholder: '請輸入預設值',
requiredMessage: '預設值 為必填屬性',
show: '顯示預設值'
},
tip: {
requiredMessage: '不能為空',
jsonMessage: 'JSON格式不正確'
},
searchBar: {
placeholder: '請輸入關鍵字搜索'
},
paramForm: {
field: {
label: '參數',
placeholder: '請輸入參數',
requiredMessage: '參數 為必填屬性',
requiredMessage2: '只能輸入字母、數字和底線'
},
name: {
label: '顯示名稱',
placeholder: '請輸入顯示名稱',
requiredMessage: '顯示名稱 為必填屬性'
},
tooltip: {
label: '參數提示說明',
placeholder: '請輸入參數提示說明'
},
required: {
label: '是否必填',
requiredMessage: '是否必填 為必填屬性'
},
input_type: {
label: '組件類型',
placeholder: '請選擇組件類型',
requiredMessage: '組件類型 為必填屬性'
}
},
DatePicker: {
placeholder: '選擇日期',
year: '年',
month: '月',
date: '日期',
datetime: '日期時間',
dataType: {
label: '時間類型',
placeholder: '請選擇時間類型'
},
format: {
label: '格式',
placeholder: '請選擇格式'
}
},
Select: {
label: '選項值',
placeholder: '請輸入選項值'
},
tag: {
label: '標籤',
placeholder: '請輸入選項標籤'
},
Slider: {
showInput: ''
}
}

View File

@ -1 +1,7 @@
export default {}
import dynamicsForm from './dynamics-form'
import chat from './ai-chat'
export default {
dynamicsForm,
chat,
noData: '無匹配資料'
}

View File

@ -57,10 +57,11 @@ export default {
dialogTitle: '設定',
allowCrossDomainLabel: '允許跨域位址',
crossDomainPlaceholder:
'請輸入允許的跨域位址,開啟後不輸入跨域位址則不限制。\n跨域位址一行一個\nhttp://127.0.0.1:5678 \nhttps://dataease.io',
'請輸入允許的跨域位址,開啟後不輸入跨域位址則不限制。\n跨域位址一行一個\nhttp://127.0.0.1:5678 \nhttps://dataease.io'
},
SettingDisplayDialog: {
dialogTitle: '顯示設定',
languageLabel: '語言',
showSourceLabel: '顯示知識來源',
showExecutionDetail: '顯示執行細節',
restoreDefault: '恢復預設',

View File

@ -6,6 +6,19 @@
:close-on-press-escape="false"
>
<el-form label-position="top" ref="displayFormRef" :model="form">
<el-form-item>
<span>{{
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
}}</span>
<el-select v-model="form.language">
<el-option
v-for="item in langList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-space direction="vertical" alignment="start">
<el-checkbox
@ -36,7 +49,7 @@ import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
import applicationApi from '@/api/application'
import { isWorkFlow } from '@/utils/application'
import { MsgSuccess, MsgError } from '@/utils/message'
import { t } from '@/locales'
import { langList, t } from '@/locales'
const route = useRoute()
const {
@ -62,10 +75,13 @@ watch(dialogVisible, (bool) => {
}
}
})
const open = (data: any, content: any) => {
detail.value = content
form.value.show_source = data.show_source
form.value.language = data.language
if (!form.value.language) {
form.value.language = 'zh-CN'
}
dialogVisible.value = true
}
@ -75,7 +91,8 @@ const submit = async (formEl: FormInstance | undefined) => {
await formEl.validate((valid, fields) => {
if (valid) {
const obj = {
show_source: form.value.show_source
show_source: form.value.show_source,
language: form.value.language
}
applicationApi.putAccessToken(id as string, obj, loading).then((res) => {
emit('refresh')

View File

@ -79,6 +79,19 @@
</div>
</div>
</div>
<div>
<span>{{
$t('views.applicationOverview.appInfo.SettingDisplayDialog.languageLabel')
}}</span>
<el-select v-model="form.language">
<el-option
v-for="item in langList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div>
<div class="p-16" style="position: relative">
<div class="flex">
@ -378,7 +391,7 @@ import type { FormInstance, FormRules, UploadFiles } from 'element-plus'
import { isAppIcon, isWorkFlow } from '@/utils/application'
import applicationXpackApi from '@/api/application-xpack'
import { MsgSuccess, MsgError } from '@/utils/message'
import { t } from '@/locales'
import { langList, t } from '@/locales'
import useStore from '@/stores'
import { cloneDeep } from 'lodash'
@ -393,6 +406,7 @@ const emit = defineEmits(['refresh'])
const defaultSetting = {
show_source: false,
language: 'zh-CN',
show_history: true,
draggable: true,
show_guide: true,
@ -421,6 +435,7 @@ const form = ref<any>({
const xpackForm = ref<any>({
show_source: false,
language: 'zh-CN',
show_history: false,
draggable: false,
show_guide: false,
@ -488,6 +503,7 @@ const open = (data: any, content: any) => {
detail.value = content
xpackForm.value.show_source = data.show_source
xpackForm.value.show_history = data.show_history
xpackForm.value.language = data.language
xpackForm.value.draggable = data.draggable
xpackForm.value.show_guide = data.show_guide
imgUrl.value.avatar = data.avatar

View File

@ -107,12 +107,16 @@
<AppIcon
iconName="app-export"
class="cursor"
:title="$t('components.chat.exportReords')"
:title="$t('components.chat.exportRecords')"
></AppIcon>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="exportMarkdown">{{ $t('common.exprt') }} Markdown</el-dropdown-item>
<el-dropdown-item @click="exportHTML">{{ $t('common.exprt') }} HTML</el-dropdown-item>
<el-dropdown-item @click="exportMarkdown"
>{{ $t('common.exprt') }} Markdown</el-dropdown-item
>
<el-dropdown-item @click="exportHTML"
>{{ $t('common.exprt') }} HTML</el-dropdown-item
>
</el-dropdown-menu>
</template>
</el-dropdown>