更新国际化支持

This commit is contained in:
jxxghp
2025-04-28 13:23:51 +08:00
parent 6b49464059
commit 8cf4b612d5
29 changed files with 3175 additions and 17187 deletions

View File

@@ -12,6 +12,10 @@ import { isNullOrEmptyObject } from '@/@core/utils'
import { getPluginTabs } from '@/router/i18n-menu'
import PluginMarketSettingDialog from '@/components/dialog/PluginMarketSettingDialog.vue'
import { useDynamicButton } from '@/composables/useDynamicButton'
import { useI18n } from 'vue-i18n'
// 国际化
const { t } = useI18n()
const route = useRoute()
@@ -37,13 +41,13 @@ const activeSort = ref(null)
const orderConfig = ref<{ id: string }[]>([])
// 排序选项
const sortOptions = [
{ title: '热门', value: 'count' },
{ title: '插件名称', value: 'plugin_name' },
{ title: '作者', value: 'plugin_author' },
{ title: '插件仓库', value: 'repo_url' },
{ title: '最新发布', value: 'add_time' },
]
const sortOptions = computed(() => [
{ title: t('plugin.sort.popular'), value: 'count' },
{ title: t('plugin.sort.name'), value: 'plugin_name' },
{ title: t('plugin.sort.author'), value: 'plugin_author' },
{ title: t('plugin.sort.repository'), value: 'repo_url' },
{ title: t('plugin.sort.latest'), value: 'add_time' },
])
// 加载中
const loading = ref(false)
@@ -105,7 +109,7 @@ const $toast = useToast()
const progressDialog = ref(false)
// 进度框文本
const progressText = ref('正在安装插件...')
const progressText = ref(t('plugin.installingPlugin'))
// 过滤表单
const filterForm = reactive({
@@ -217,7 +221,7 @@ async function installPlugin(item: Plugin) {
try {
// 显示等待提示框
progressDialog.value = true
progressText.value = `正在安装 ${item?.plugin_name} v${item?.plugin_version} ...`
progressText.value = t('plugin.installing', { name: item?.plugin_name, version: item?.plugin_version })
const result: { [key: string]: any } = await api.get(`plugin/install/${item?.id}`, {
params: {
@@ -230,12 +234,12 @@ async function installPlugin(item: Plugin) {
progressDialog.value = false
if (result.success) {
$toast.success(`插件 ${item?.plugin_name} 安装成功!`)
$toast.success(t('plugin.installSuccess', { name: item?.plugin_name }))
// 刷新
refreshData()
} else {
$toast.error(`插件 ${item?.plugin_name} 安装失败:${result.message}`)
$toast.error(t('plugin.installFailed', { name: item?.plugin_name, message: result.message }))
}
} catch (error) {
console.error(error)