mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 16:16:42 +08:00
更新国际化支持:为插件配置对话框及相关组件添加多语言文本,提升用户体验
This commit is contained in:
@@ -6,6 +6,10 @@ import api from '@/api'
|
|||||||
import { useToast } from 'vue-toast-notification'
|
import { useToast } from 'vue-toast-notification'
|
||||||
import FormRender from '../render/FormRender.vue'
|
import FormRender from '../render/FormRender.vue'
|
||||||
import ProgressDialog from '../dialog/ProgressDialog.vue'
|
import ProgressDialog from '../dialog/ProgressDialog.vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
// 国际化
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -67,17 +71,17 @@ async function loadPluginConf() {
|
|||||||
async function savePluginConf() {
|
async function savePluginConf() {
|
||||||
// 显示等待提示框
|
// 显示等待提示框
|
||||||
progressDialog.value = true
|
progressDialog.value = true
|
||||||
progressText.value = `正在保存 ${props.plugin?.plugin_name} 配置...`
|
progressText.value = t('dialog.pluginConfig.saving', { name: props.plugin?.plugin_name })
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.put(`plugin/${props.plugin?.id}`, pluginConfigForm.value)
|
const result: { [key: string]: any } = await api.put(`plugin/${props.plugin?.id}`, pluginConfigForm.value)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
progressDialog.value = false
|
progressDialog.value = false
|
||||||
$toast.success(`插件 ${props.plugin?.plugin_name} 配置已保存`)
|
$toast.success(t('dialog.pluginConfig.saveSuccess', { name: props.plugin?.plugin_name }))
|
||||||
// 通知父组件刷新
|
// 通知父组件刷新
|
||||||
emit('save')
|
emit('save')
|
||||||
} else {
|
} else {
|
||||||
progressDialog.value = false
|
progressDialog.value = false
|
||||||
$toast.error(`插件 ${props.plugin?.plugin_name} 配置保存失败:${result.message}}`)
|
$toast.error(t('dialog.pluginConfig.saveFailed', { name: props.plugin?.plugin_name, message: result.message }))
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -91,16 +95,20 @@ onBeforeMount(async () => {
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VDialog scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
|
<VDialog scrollable max-width="60rem" :fullscreen="!display.mdAndUp.value">
|
||||||
<VCard :title="`${props.plugin?.plugin_name} - 配置`" class="rounded-t">
|
<VCard :title="`${props.plugin?.plugin_name} - ${t('dialog.pluginConfig.title')}`" class="rounded-t">
|
||||||
<VDialogCloseBtn @click="emit('close')" />
|
<VDialogCloseBtn @click="emit('close')" />
|
||||||
<VDivider />
|
<VDivider />
|
||||||
<VCardText v-if="isRefreshed">
|
<VCardText v-if="isRefreshed">
|
||||||
<FormRender v-for="(item, index) in pluginFormItems" :key="index" :config="item" :model="pluginConfigForm" />
|
<FormRender v-for="(item, index) in pluginFormItems" :key="index" :config="item" :model="pluginConfigForm" />
|
||||||
</VCardText>
|
</VCardText>
|
||||||
<VCardActions class="pt-3">
|
<VCardActions class="pt-3">
|
||||||
<VBtn v-if="props.plugin?.has_page" @click="emit('switch')" variant="outlined" color="info"> 查看数据 </VBtn>
|
<VBtn v-if="props.plugin?.has_page" @click="emit('switch')" variant="outlined" color="info">
|
||||||
|
{{ t('dialog.pluginConfig.viewData') }}
|
||||||
|
</VBtn>
|
||||||
<VSpacer />
|
<VSpacer />
|
||||||
<VBtn @click="savePluginConf" variant="elevated" prepend-icon="mdi-content-save" class="px-5"> 保存 </VBtn>
|
<VBtn @click="savePluginConf" variant="elevated" prepend-icon="mdi-content-save" class="px-5">
|
||||||
|
{{ t('dialog.pluginConfig.save') }}
|
||||||
|
</VBtn>
|
||||||
</VCardActions>
|
</VCardActions>
|
||||||
</VCard>
|
</VCard>
|
||||||
<!-- 进度框 -->
|
<!-- 进度框 -->
|
||||||
|
|||||||
@@ -1336,6 +1336,10 @@ export default {
|
|||||||
title: 'Plugin Configuration',
|
title: 'Plugin Configuration',
|
||||||
save: 'Save',
|
save: 'Save',
|
||||||
close: 'Close',
|
close: 'Close',
|
||||||
|
viewData: 'View Data',
|
||||||
|
saving: 'Saving {name} configuration...',
|
||||||
|
saveSuccess: 'Plugin {name} configuration saved',
|
||||||
|
saveFailed: 'Failed to save plugin {name} configuration: {message}',
|
||||||
},
|
},
|
||||||
pluginData: {
|
pluginData: {
|
||||||
title: 'Plugin Data',
|
title: 'Plugin Data',
|
||||||
|
|||||||
@@ -1313,6 +1313,10 @@ export default {
|
|||||||
title: '插件配置',
|
title: '插件配置',
|
||||||
save: '保存',
|
save: '保存',
|
||||||
close: '关闭',
|
close: '关闭',
|
||||||
|
viewData: '查看数据',
|
||||||
|
saving: '正在保存 {name} 配置...',
|
||||||
|
saveSuccess: '插件 {name} 配置已保存',
|
||||||
|
saveFailed: '插件 {name} 配置保存失败:{message}',
|
||||||
},
|
},
|
||||||
pluginData: {
|
pluginData: {
|
||||||
title: '插件数据',
|
title: '插件数据',
|
||||||
|
|||||||
@@ -1310,6 +1310,10 @@ export default {
|
|||||||
title: '插件配置',
|
title: '插件配置',
|
||||||
save: '儲存',
|
save: '儲存',
|
||||||
close: '關閉',
|
close: '關閉',
|
||||||
|
viewData: '查看數據',
|
||||||
|
saving: '正在儲存 {name} 配置...',
|
||||||
|
saveSuccess: '插件 {name} 配置已儲存',
|
||||||
|
saveFailed: '插件 {name} 配置儲存失敗:{message}',
|
||||||
},
|
},
|
||||||
pluginData: {
|
pluginData: {
|
||||||
title: '插件數據',
|
title: '插件數據',
|
||||||
|
|||||||
Reference in New Issue
Block a user