Feature(custom): split i18n in main and renderer, use vue-i18n

This commit is contained in:
Kuingsmile
2025-08-01 13:10:05 +08:00
parent ff95e0f6fe
commit 236b7c6e7d
76 changed files with 4310 additions and 5986 deletions
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -1,7 +1,6 @@
<template>
<el-empty :description="$T('MANAGE_NO_DATA')" />
<el-empty :description="$t('MANAGE_NO_DATA')" />
</template>
<script lang="ts" setup>
import { T as $T } from '@/i18n'
</script>
+28 -27
View File
@@ -11,7 +11,7 @@
>
<el-tab-pane
name="login"
:label="$T('MANAGE_LOGIN_PAGE_PANE_NAME')"
:label="$t('MANAGE_LOGIN_PAGE_PANE_NAME')"
style="width: 100%; overflow-y: scroll; height: calc(100vh - 50px)"
lazy
>
@@ -46,12 +46,12 @@
>
<el-table-column
prop="key"
:label="$T('MANAGE_LOGIN_PAGE_PANE_KEY_NAME')"
:label="$t('MANAGE_LOGIN_PAGE_PANE_KEY_NAME')"
width="100"
/>
<el-table-column
prop="value"
:label="$T('MANAGE_LOGIN_PAGE_PANE_KEY_VALUE')"
:label="$t('MANAGE_LOGIN_PAGE_PANE_KEY_VALUE')"
/>
</el-table>
<template #reference>
@@ -92,7 +92,7 @@
plain
@click="handleConfigClick(item)"
>
{{ $T('MANAGE_LOGIN_PAGE_PANE_ENTER') }}
{{ $t('MANAGE_LOGIN_PAGE_PANE_ENTER') }}
</el-button>
<el-button
type="warning"
@@ -100,7 +100,7 @@
plain
@click="handleConfigRemove(item.alias)"
>
{{ $T('MANAGE_LOGIN_PAGE_PANE_DELETE') }}
{{ $t('MANAGE_LOGIN_PAGE_PANE_DELETE') }}
</el-button>
</el-button-group>
</el-card>
@@ -182,7 +182,7 @@
<el-select
v-else-if="supportedPicBedList[item.icon].configOptions[option].type === 'select'"
v-model="configResult[item.icon + '.' + option]"
:placeholder="$T('MANAGE_LOGIN_PAGE_PANE_SELECT_PLACEHOLDER')"
:placeholder="$t('MANAGE_LOGIN_PAGE_PANE_SELECT_PLACEHOLDER')"
:persistent="false"
teleported
>
@@ -204,7 +204,7 @@
:disabled="currentAliasList.length === 0"
teleported
>
{{ $T('MANAGE_LOGIN_PAGE_PANE_IMPORT') }}
{{ $t('MANAGE_LOGIN_PAGE_PANE_IMPORT') }}
<template #dropdown>
<el-dropdown-item
v-for="i in currentAliasList"
@@ -222,7 +222,7 @@
plain
@click="handleConfigChange(item.icon)"
>
{{ $T('MANAGE_LOGIN_PAGE_PANE_SAVE') }}
{{ $t('MANAGE_LOGIN_PAGE_PANE_SAVE') }}
</el-button>
<el-button
type="danger"
@@ -231,12 +231,12 @@
plain
@click="handleConfigReset(item.icon)"
>
{{ $T('MANAGE_LOGIN_PAGE_PANE_RESET') }}
{{ $t('MANAGE_LOGIN_PAGE_PANE_RESET') }}
</el-button>
</div>
<br>
<el-alert
:title="$T('MANAGE_LOGIN_PAGE_PANE_TABLE_TITLE')"
:title="$t('MANAGE_LOGIN_PAGE_PANE_TABLE_TITLE')"
type="success"
center
:closable="false"
@@ -266,9 +266,9 @@
import { Delete, Edit, InfoFilled, Pointer } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
import { computed, onMounted, reactive, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { T as $T } from '@/i18n'
import { useManageStore } from '@/manage/store/manageStore'
import { formObjToTableData } from '@/manage/utils/common'
import { supportedPicBedList } from '@/manage/utils/constants'
@@ -278,6 +278,7 @@ import { IRPCActionType } from '#/types/enum'
import { IStringKeyMap, IUploaderConfigListItem } from '#/types/types'
import { formatEndpoint, isNeedToShorten, safeSliceF } from '#/utils/common'
const { t } = useI18n()
const manageStore = useManageStore()
const router = useRouter()
@@ -362,13 +363,13 @@ async function handleConfigChange (name: string) {
if (supportedPicBedList[name].configOptions[key].required) {
if (supportedPicBedList[name].configOptions[key].type !== 'boolean' && !configResult[resultKey]) {
ElMessage.error(
`${$T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_MESSAGE_A')} ${supportedPicBedList[name].configOptions[key].description}`
`${t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_MESSAGE_A')} ${supportedPicBedList[name].configOptions[key].description}`
)
return
}
}
if (key === 'alias' && configResult[resultKey] !== undefined && !reg.test(configResult[resultKey])) {
ElMessage.error($T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_ALIAS_MESSAGE'))
ElMessage.error(t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_ALIAS_MESSAGE'))
return
}
if (
@@ -376,13 +377,13 @@ async function handleConfigChange (name: string) {
configResult[resultKey] !== undefined &&
(configResult[resultKey] < 20 || configResult[resultKey] > 1000)
) {
ElMessage.error($T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_ITEMS_PER_PAGE_MESSAGE'))
ElMessage.error(t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_ITEMS_PER_PAGE_MESSAGE'))
return
}
if (key === 'customUrl' && configResult[resultKey] !== undefined && configResult[resultKey] !== '') {
if (name !== 'upyun') {
if (!/^https?:\/\//.test(configResult[resultKey])) {
ElMessage.error($T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_CUSTOM_URL_MESSAGE'))
ElMessage.error(t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_CUSTOM_URL_MESSAGE'))
return
}
}
@@ -438,8 +439,8 @@ async function handleConfigChange (name: string) {
getDataForTable()
if (aliasList.includes(resultMap.alias)) {
ElNotification({
title: $T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME'),
message: `${$T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE')}${resultMap.alias}`,
title: t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME'),
message: `${t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE')}${resultMap.alias}`,
type: 'warning',
duration: 500,
customClass: 'notification',
@@ -447,8 +448,8 @@ async function handleConfigChange (name: string) {
})
} else {
ElNotification({
title: $T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME'),
message: `${$T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_B')}${resultMap.alias}`,
title: t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME'),
message: `${t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_B')}${resultMap.alias}`,
type: 'success',
duration: 2000,
customClass: 'notification',
@@ -471,16 +472,16 @@ const handleConfigReset = (name: string) => {
const handleConfigRemove = (name: string) => {
ElMessageBox.confirm(
$T('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_TITLE'),
$T('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_TIP'),
t('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_TITLE'),
t('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_TIP'),
{
confirmButtonText: $T('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_CONFIRM'),
cancelButtonText: $T('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_CANCEL'),
confirmButtonText: t('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_CONFIRM'),
cancelButtonText: t('MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_CANCEL'),
type: 'warning'
}
).then(async () => {
const commonNoticeConfig = {
title: $T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME'),
title: t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME'),
duration: 2000,
customClass: 'notification',
offset: 100
@@ -489,7 +490,7 @@ const handleConfigRemove = (name: string) => {
removeConfig('picBed', name)
ElNotification({
...commonNoticeConfig,
message: `${$T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_C')}${name}`,
message: `${t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_C')}${name}`,
type: 'success',
position: 'bottom-right'
})
@@ -498,7 +499,7 @@ const handleConfigRemove = (name: string) => {
} catch (error) {
ElNotification({
...commonNoticeConfig,
message: `${$T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_D')}${name}${$T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_E')}`,
message: `${t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_D')}${name}${t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_E')}`,
type: 'error',
position: 'bottom-right'
})
@@ -523,7 +524,7 @@ const getAllConfigAliasArray = async () => {
const handleCellClick = (row: any, column: any) => {
navigator.clipboard.writeText(row[column.property])
ElMessage.success(`${$T('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_COPY_SUCCESS')}${row[column.property]}`)
ElMessage.success(`${t('MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_COPY_SUCCESS')}${row[column.property]}`)
}
const handleReferenceClick = (url: string) => window.electron.sendRPC(IRPCActionType.OPEN_URL, url)
+15 -14
View File
@@ -23,7 +23,7 @@
<el-tooltip
v-if="showNewIconList.includes(currentPicBedName)"
effect="dark"
:content="$T('MANAGE_MAIN_PAGE_NEW_BUCKET')"
:content="$t('MANAGE_MAIN_PAGE_NEW_BUCKET')"
placement="right"
:persistent="false"
teleported
@@ -101,7 +101,7 @@
<el-icon class="layout__menu__setting__item__icon">
<HomeFilled />
</el-icon>
{{ $T('MANAGE_MAIN_PAGE_BACK_TO_HOME') }}
{{ $t('MANAGE_MAIN_PAGE_BACK_TO_HOME') }}
</span>
</el-menu-item>
<el-menu-item
@@ -113,7 +113,7 @@
<el-icon class="layout__menu__setting__item__icon">
<Switch />
</el-icon>
{{ $T('MANAGE_MAIN_PAGE_SWITCH_PICBED') }}
{{ $t('MANAGE_MAIN_PAGE_SWITCH_PICBED') }}
</span>
</el-menu-item>
<el-menu-item
@@ -125,7 +125,7 @@
<el-icon class="layout__menu__setting__item__icon">
<Tools />
</el-icon>
{{ $T('MANAGE_MAIN_PAGE_SETTING') }}
{{ $t('MANAGE_MAIN_PAGE_SETTING') }}
</span>
</el-menu-item>
</el-menu>
@@ -158,7 +158,7 @@
<ChromeFilled />
</el-icon>
<span style="font-size: 13px; margin-top: 5px; color: red">
{{ $T('MANAGE_MAIN_PAGE_BACK_TO_HOME') }}
{{ $t('MANAGE_MAIN_PAGE_BACK_TO_HOME') }}
</span>
</div>
</el-card>
@@ -258,7 +258,7 @@
style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%)"
@click="createNewBucket(currentPicBedName)"
>
{{ $T('MANAGE_MAIN_PAGE_SUBMIT') }}
{{ $t('MANAGE_MAIN_PAGE_SUBMIT') }}
</el-button>
</div>
</el-form>
@@ -281,14 +281,15 @@ import {
import { ElNotification } from 'element-plus'
import { IRPCActionType } from 'root/src/universal/types/enum'
import { computed, onBeforeMount, reactive, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import { T as $T } from '@/i18n'
import { useManageStore } from '@/manage/store/manageStore'
import { supportedPicBedList } from '@/manage/utils/constants'
import { newBucketConfig } from '@/manage/utils/newBucketConfig'
import { IStringKeyMap } from '#/types/types'
const { t } = useI18n()
const manageStore = useManageStore() as any
const route = useRoute()
const router = useRouter()
@@ -336,9 +337,9 @@ const urlMap: IStringKeyMap = {
const showNewIconList = ['aliyun', 'qiniu', 'tcyun', 's3plist']
const bucketT = $T('MANAGE_MAIN_PAGE_BUCKET')
const galleryT = $T('MANAGE_MAIN_PAGE_GALLERY')
const repositoryT = $T('MANAGE_MAIN_PAGE_REPOSITORY')
const bucketT = t('MANAGE_MAIN_PAGE_BUCKET')
const galleryT = t('MANAGE_MAIN_PAGE_GALLERY')
const repositoryT = t('MANAGE_MAIN_PAGE_REPOSITORY')
const menuTitleMap: IStringKeyMap = {
aliyun: bucketT,
@@ -401,8 +402,8 @@ function createNewBucket (picBedName: string) {
window.electron.triggerRPC(IRPCActionType.MANAGE_CREATE_BUCKET, currentAlias, resultMap).then((result: any) => {
if (result) {
ElNotification({
title: $T('MANAGE_MAIN_PAGE_TIPS'),
message: $T('MANAGE_MAIN_PAGE_TIPS_SUCCESS'),
title: t('MANAGE_MAIN_PAGE_TIPS'),
message: t('MANAGE_MAIN_PAGE_TIPS_SUCCESS'),
type: 'success'
})
nweBucketDrawerVisible.value = false
@@ -411,8 +412,8 @@ function createNewBucket (picBedName: string) {
}, 2000)
} else {
ElNotification({
title: $T('MANAGE_MAIN_PAGE_TIPS'),
message: $T('MANAGE_MAIN_PAGE_TIPS_FAILED'),
title: t('MANAGE_MAIN_PAGE_TIPS'),
message: t('MANAGE_MAIN_PAGE_TIPS_FAILED'),
type: 'error'
})
}
+41 -40
View File
@@ -6,7 +6,7 @@
justify="center"
style="font-size: 20px; color: black"
>
{{ $T('MANAGE_SETTING_TITLE') }}
{{ $t('MANAGE_SETTING_TITLE') }}
</el-row>
<el-row class="setting-list">
<el-col
@@ -23,13 +23,13 @@
<el-form-item>
<template #label>
<span style="position: absolute; left: 0">
<span>{{ $T('MANAGE_SETTING_CLEAR_CACHE_TITLE') }} </span>
<span>{{ $t('MANAGE_SETTING_CLEAR_CACHE_TITLE') }} </span>
<span style="color: #ff4949">{{ formatFileSize(dbSize) === '' ? 0 : formatFileSize(dbSize) }} </span>
<span> &nbsp;{{ $T('MANAGE_SETTING_CLEAR_CACHE_FREE_TITLE') }} </span>
<span> &nbsp;{{ $t('MANAGE_SETTING_CLEAR_CACHE_FREE_TITLE') }} </span>
<span style="color: #ff4949">{{ dbSizeAvailableRate }} %</span>
<el-tooltip
effect="dark"
:content="$T('MANAGE_SETTING_CLEAR_CACHE_TIPS')"
:content="$t('MANAGE_SETTING_CLEAR_CACHE_TIPS')"
placement="right"
:persistent="false"
teleported
@@ -41,9 +41,9 @@
</span>
</template>
<el-popconfirm
:title="$T('MANAGE_SETTING_CLEAR_CACHE_PROMPT')"
:confirm-button-text="$T('CONFIRM')"
:cancel-button-text="$T('CANCEL')"
:title="$t('MANAGE_SETTING_CLEAR_CACHE_PROMPT')"
:confirm-button-text="$t('CONFIRM')"
:cancel-button-text="$t('CANCEL')"
hide-icon
:persistent="false"
teleported
@@ -55,7 +55,7 @@
plain
style="position: absolute; right: 0"
>
{{ $T('MANAGE_SETTING_CLEAR_CACHE_BUTTON') }}
{{ $t('MANAGE_SETTING_CLEAR_CACHE_BUTTON') }}
</el-button>
</template>
</el-popconfirm>
@@ -75,12 +75,12 @@
style="margin-top: 10px; margin-bottom: 10px; color: #409eff"
:underline="false"
>
{{ $T('MANAGE_SETTING_CUSTOM_PATTERN_TITLE') }}
{{ $t('MANAGE_SETTING_CUSTOM_PATTERN_TITLE') }}
</el-link>
<el-input
v-if="form.customRename"
v-model="form.customRenameFormat"
:placeholder="$T('MANAGE_SETTING_CUSTOM_PATTERN_TIPS')"
:placeholder="$t('MANAGE_SETTING_CUSTOM_PATTERN_TIPS')"
style="width: 100%"
/>
<el-table
@@ -95,7 +95,7 @@
v-for="prop in ['placeholder', 'description', 'placeholderB', 'descriptionB']"
:key="prop"
:prop="prop"
:label="$T('MANAGE_SETTING_CUSTOM_PATTERN_TABLE_TITLE' as any)"
:label="$t('MANAGE_SETTING_CUSTOM_PATTERN_TABLE_TITLE' as any)"
width="150"
/>
</el-table>
@@ -111,10 +111,10 @@
<el-form-item>
<template #label>
<span style="position: absolute; left: 0">
{{ $T('MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_TITLE') }}
{{ $t('MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_TITLE') }}
<el-tooltip
effect="dark"
:content="$T('MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_TIPS')"
:content="$t('MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_TIPS')"
placement="right"
:persistent="false"
teleported
@@ -128,7 +128,7 @@
<el-input-number
v-model="form.maxDownloadFileCount"
style="position: absolute; right: 0"
:placeholder="$T('MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_INPUT_TIPS')"
:placeholder="$t('MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_INPUT_TIPS')"
:min="1"
:max="9999"
:step="1"
@@ -137,10 +137,10 @@
<el-form-item>
<template #label>
<span style="position: absolute; left: 0">
{{ $T('MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TITLE') }}
{{ $t('MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TITLE') }}
<el-tooltip
effect="dark"
:content="$T('MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TIPS')"
:content="$t('MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TIPS')"
placement="right"
:persistent="false"
teleported
@@ -154,7 +154,7 @@
<el-input-number
v-model="form.PreSignedExpire"
style="position: absolute; right: 0"
:placeholder="$T('MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TIPS')"
:placeholder="$t('MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TIPS')"
:min="1"
:step="1"
/>
@@ -163,7 +163,7 @@
style="margin-top: 10px; margin-bottom: 10px; color: #409eff"
:underline="false"
>
{{ $T('MANAGE_SETTING_CHOOSE_COPY_FORMAT_TITLE') }}
{{ $t('MANAGE_SETTING_CHOOSE_COPY_FORMAT_TITLE') }}
</el-link>
<br>
<el-radio-group v-model="form.pasteFormat">
@@ -172,7 +172,7 @@
:key="item"
:value="item"
>
{{ $T(`MANAGE_SETTING_CHOOSE_COPY_FORMAT_${item.toUpperCase().replace(/-/g, '_')}` as any) }}
{{ $t(`MANAGE_SETTING_CHOOSE_COPY_FORMAT_${item.toUpperCase().replace(/-/g, '_')}` as any) }}
</el-radio>
</el-radio-group>
<el-link
@@ -180,12 +180,12 @@
style="margin-top: 10px; margin-bottom: 10px; color: #409eff"
:underline="false"
>
{{ $T('MANAGE_SETTING_CUSTOM_COPY_FORMAT_TITLE') }}
{{ $t('MANAGE_SETTING_CUSTOM_COPY_FORMAT_TITLE') }}
</el-link>
<el-input
v-if="form.pasteFormat === 'custom'"
v-model="form.customPasteFormat"
:placeholder="$T('MANAGE_SETTING_CUSTOM_COPY_FORMAT_TIPS')"
:placeholder="$t('MANAGE_SETTING_CUSTOM_COPY_FORMAT_TIPS')"
style="width: 100%"
/>
<div>
@@ -193,13 +193,13 @@
style="margin-top: 10px; margin-bottom: 10px; color: #409eff"
:underline="false"
>
{{ $T('MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_TITLE') }}
{{ $t('MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_TITLE') }}
</el-link>
</div>
<el-input
v-model="form.downloadDir"
disabled
:placeholder="$T('MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_TIPS')"
:placeholder="$t('MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_TIPS')"
style="width: 100%; margin-top: 10px"
>
<template #append>
@@ -210,7 +210,7 @@
<el-icon>
<Folder />
</el-icon>
{{ $T('MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_BUTTON') }}
{{ $t('MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_BUTTON') }}
</el-button>
</template>
</el-input>
@@ -227,14 +227,15 @@ import { Folder, InfoFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { IRPCActionType } from 'root/src/universal/types/enum'
import { onBeforeMount, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { T as $T } from '@/i18n'
import DynamicSwitch from '@/manage/components/DynamicSwitch.vue'
import { fileCacheDbInstance } from '@/manage/store/bucketFileDb'
import { customRenameFormatTable, formatFileSize } from '@/manage/utils/common'
import { getConfig, saveConfig } from '@/manage/utils/dataSender'
import { IStringKeyMap } from '#/types/types'
const { t } = useI18n()
const form = ref<IStringKeyMap>({
timestampRename: false,
randomStringRename: false,
@@ -291,16 +292,16 @@ const switchFieldsConfigList = switchFieldsList.map(item => ({
configName: item,
segments: [
{
text: $T(`MANAGE_SETTING_${item.toUpperCase()}_TITLE` as any),
text: t(`MANAGE_SETTING_${item.toUpperCase()}_TITLE` as any),
style: 'color: black;'
}
],
tooltip: switchFieldsNoTipsList.includes(item) ? undefined : $T(`MANAGE_SETTING_${item.toUpperCase()}_TIPS` as any),
tooltip: switchFieldsNoTipsList.includes(item) ? undefined : t(`MANAGE_SETTING_${item.toUpperCase()}_TIPS` as any),
activeText: switchFieldsHasActiveTextList.includes(item)
? $T(`MANAGE_SETTING_${item.toUpperCase()}_ON` as any)
? t(`MANAGE_SETTING_${item.toUpperCase()}_ON` as any)
: undefined,
inactiveText: switchFieldsHasActiveTextList.includes(item)
? $T(`MANAGE_SETTING_${item.toUpperCase()}_OFF` as any)
? t(`MANAGE_SETTING_${item.toUpperCase()}_OFF` as any)
: undefined
}))
@@ -309,37 +310,37 @@ const switchFieldsSpecialList = [
configName: 'isDownloadFileKeepDirStructure',
segments: [
{
text: $T('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_A'),
text: t('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_A'),
style: 'color: black;'
},
{
text: $T('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_B'),
text: t('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_B'),
style: 'color: orange;'
},
{
text: $T('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_C'),
text: t('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_C'),
style: 'color: black;'
}
],
tooltip: $T('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TIPS')
tooltip: t('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TIPS')
},
{
configName: 'isDownloadFolderKeepDirStructure',
segments: [
{
text: $T('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_A'),
text: t('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_A'),
style: 'color: black;'
},
{
text: $T('MANAGE_SETTING_ISDOWNLOADFOLDERKEEPDIRSTRUCTURE_TITLE_D'),
text: t('MANAGE_SETTING_ISDOWNLOADFOLDERKEEPDIRSTRUCTURE_TITLE_D'),
style: 'color: coral;'
},
{
text: $T('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_C'),
text: t('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_C'),
style: 'color: black;'
}
],
tooltip: $T('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TIPS')
tooltip: t('MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TIPS')
}
]
@@ -359,7 +360,7 @@ async function handleDownloadDirClick () {
const handleCellClick = (row: any, column: any) => {
navigator.clipboard.writeText(row[column.property])
ElMessage.success(`${$T('MANAGE_SETTING_COPY_MESSAGE')}${row[column.property]}`)
ElMessage.success(`${t('MANAGE_SETTING_COPY_MESSAGE')}${row[column.property]}`)
}
function handleClearDb () {
@@ -367,10 +368,10 @@ function handleClearDb () {
.delete()
.then(() => {
getIndexDbSize()
ElMessage.success($T('MANAGE_SETTING_CLEAR_CACHE_SUCCESS'))
ElMessage.success(t('MANAGE_SETTING_CLEAR_CACHE_SUCCESS'))
})
.catch(() => {
ElMessage.error($T('MANAGE_SETTING_CLEAR_CACHE_FAILED'))
ElMessage.error(t('MANAGE_SETTING_CLEAR_CACHE_FAILED'))
})
}
@@ -0,0 +1,72 @@
import { IStringKeyMap } from '#/types/types'
const AliyunAreaCodeName: IStringKeyMap = {
'oss-cn-hangzhou': '华东1(杭州)',
'oss-cn-shanghai': '华东2(上海)',
'oss-cn-nanjing': '华东5(南京)',
'oss-cn-fuzhou': '华东6(福州)',
'oss-cn-wuhan': '华中1(武汉)',
'oss-cn-qingdao': '华北1(青岛)',
'oss-cn-beijing': '华北2(北京)',
'oss-cn-zhangjiakou': '华北3(张家口)',
'oss-cn-huhehaote': '华北5(呼和浩特)',
'oss-cn-wulanchabu': '华北6(乌兰察布)',
'oss-cn-shenzhen': '华南1(深圳)',
'oss-cn-heyuan': '华南2(河源)',
'oss-cn-guangzhou': '华南3(广州)',
'oss-cn-chengdu': '西南1(成都)',
'oss-cn-hongkong': '中国香港',
'oss-us-west-1': '美国(硅谷)',
'oss-us-east-1': '美国(弗吉尼亚)',
'oss-ap-northeast-1': '日本(东京)',
'oss-ap-northeast-2': '韩国(首尔)',
'oss-ap-southeast-1': '新加坡',
'oss-ap-southeast-2': '澳大利亚(悉尼)',
'oss-ap-southeast-3': '马来西亚(吉隆坡)',
'oss-ap-southeast-5': '印度尼西亚(雅加达)',
'oss-ap-southeast-6': '菲律宾(马尼拉)',
'oss-ap-southeast-7': '泰国(曼谷)',
'oss-ap-south-1': '印度(孟买)',
'oss-eu-central-1': '德国(法兰克福)',
'oss-eu-west-1': '英国(伦敦)',
'oss-me-east-1': '阿联酋(迪拜)',
'oss-rg-china-mainland': '无地域属性'
}
const QiniuAreaCodeName: IStringKeyMap = {
z0: '华东-浙江',
'cn-east-2': '华东 浙江2',
z1: '华北-河北',
z2: '华南-广东',
na0: '北美-洛杉矶',
as0: '亚太-新加坡',
'ap-northeast-1': '亚太-首尔',
'ap-southeast-2': '亚太-河内'
}
const TencentAreaCodeName: IStringKeyMap = {
'ap-beijing-1': '北京一区',
'ap-beijing': '北京',
'ap-nanjing': '南京',
'ap-shanghai': '上海',
'ap-guangzhou': '广州',
'ap-chengdu': '成都',
'ap-chongqing': '重庆',
'ap-shenzhen-fsi': '深圳金融',
'ap-shagnhai-fsi': '上海金融',
'ap-beijing-fsi': '北京金融',
'ap-hongkong': '香港',
'ap-singapore': '新加坡',
'ap-mumbai': '孟买',
'ap-jakarta': '雅加达',
'ap-seoul': '首尔',
'ap-bangkok': '曼谷',
'ap-tokyo': '东京',
'na-siliconvalley': '硅谷(美西)',
'na-ashburn': '弗吉尼亚(美东)',
'na-toronto': '多伦多',
'sa-saopaulo': '圣保罗',
'eu-frankfurt': '法兰克福'
}
export { AliyunAreaCodeName, QiniuAreaCodeName, TencentAreaCodeName }
File diff suppressed because it is too large Load Diff
+46 -42
View File
@@ -1,32 +1,36 @@
import { T as $T } from '@/i18n'
import { useI18n } from 'vue-i18n'
import { IStringKeyMap } from '#/types/types'
import { AliyunAreaCodeName, QiniuAreaCodeName, TencentAreaCodeName } from '~/manage/utils/constants'
import { AliyunAreaCodeName, QiniuAreaCodeName, TencentAreaCodeName } from './bucketConfigCons'
const { t } = useI18n()
export const newBucketConfig: IStringKeyMap = {
tcyun: {
name: $T('MANAGE_NEW_BUCKET_TCYUN_NAME'),
name: t('MANAGE_NEW_BUCKET_TCYUN_NAME'),
icon: 'tcyun',
configOptions: {
BucketName: {
required: true,
description: $T('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_DESC'),
placeholder: $T('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_PLACEHOLDER'),
description: t('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_DESC'),
placeholder: t('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_PLACEHOLDER'),
paraType: 'string',
component: 'input',
default: 'piclist',
rule: [
{
required: true,
message: $T('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_A'),
message: t('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_A'),
trigger: 'blur'
},
{
validator: (rule: any, value: any, callback: any) => {
const reg = /^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$/
if (value.length > 23) {
callback(new Error($T('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_B')))
callback(new Error(t('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_B')))
} else if (!reg.test(value)) {
callback(new Error($T('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_C')))
callback(new Error(t('MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_C')))
} else {
callback()
}
@@ -37,7 +41,7 @@ export const newBucketConfig: IStringKeyMap = {
},
region: {
required: true,
description: $T('MANAGE_NEW_BUCKET_TCYUN_REGION'),
description: t('MANAGE_NEW_BUCKET_TCYUN_REGION'),
paraType: 'string',
component: 'select',
default: 'ap-nanjing',
@@ -45,43 +49,43 @@ export const newBucketConfig: IStringKeyMap = {
},
acl: {
required: true,
description: $T('MANAGE_NEW_BUCKET_TCYUN_ACL_DESC'),
description: t('MANAGE_NEW_BUCKET_TCYUN_ACL_DESC'),
paraType: 'string',
component: 'select',
default: 'private',
options: {
private: $T('MANAGE_NEW_BUCKET_TCYUN_ACL_PRIVATE'),
'public-read': $T('MANAGE_NEW_BUCKET_TCYUN_ACL_PUBLIC_R'),
'public-read-write': $T('MANAGE_NEW_BUCKET_TCYUN_ACL_PUBLIC_RW')
private: t('MANAGE_NEW_BUCKET_TCYUN_ACL_PRIVATE'),
'public-read': t('MANAGE_NEW_BUCKET_TCYUN_ACL_PUBLIC_R'),
'public-read-write': t('MANAGE_NEW_BUCKET_TCYUN_ACL_PUBLIC_RW')
}
}
},
options: ['BucketName', 'region', 'acl']
},
aliyun: {
name: $T('MANAGE_NEW_BUCKET_ALIYUN_NAME'),
name: t('MANAGE_NEW_BUCKET_ALIYUN_NAME'),
icon: 'aliyun',
configOptions: {
BucketName: {
required: true,
description: $T('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_DESC'),
placeholder: $T('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_PLACEHOLDER'),
description: t('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_DESC'),
placeholder: t('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_PLACEHOLDER'),
paraType: 'string',
component: 'input',
default: 'piclist',
rule: [
{
required: true,
message: $T('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_A'),
message: t('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_A'),
trigger: 'blur'
},
{
validator: (rule: any, value: any, callback: any) => {
const reg = /^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$/
if (value.length > 63) {
callback(new Error($T('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_B')))
callback(new Error(t('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_B')))
} else if (!reg.test(value)) {
callback(new Error($T('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_C')))
callback(new Error(t('MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_C')))
} else {
callback()
}
@@ -92,7 +96,7 @@ export const newBucketConfig: IStringKeyMap = {
},
region: {
required: true,
description: $T('MANAGE_NEW_BUCKET_ALIYUN_REGION'),
description: t('MANAGE_NEW_BUCKET_ALIYUN_REGION'),
paraType: 'string',
component: 'select',
default: 'oss-cn-hangzhou',
@@ -100,43 +104,43 @@ export const newBucketConfig: IStringKeyMap = {
},
acl: {
required: true,
description: $T('MANAGE_NEW_BUCKET_ALIYUN_ACL_DESC'),
description: t('MANAGE_NEW_BUCKET_ALIYUN_ACL_DESC'),
paraType: 'string',
component: 'select',
default: 'private',
options: {
private: $T('MANAGE_NEW_BUCKET_ALIYUN_ACL_PRIVATE'),
publicRead: $T('MANAGE_NEW_BUCKET_ALIYUN_ACL_PUBLIC_R'),
publicReadWrite: $T('MANAGE_NEW_BUCKET_ALIYUN_ACL_PUBLIC_RW')
private: t('MANAGE_NEW_BUCKET_ALIYUN_ACL_PRIVATE'),
publicRead: t('MANAGE_NEW_BUCKET_ALIYUN_ACL_PUBLIC_R'),
publicReadWrite: t('MANAGE_NEW_BUCKET_ALIYUN_ACL_PUBLIC_RW')
}
}
},
options: ['BucketName', 'region', 'acl']
},
qiniu: {
name: $T('MANAGE_NEW_BUCKET_QINIU_NAME'),
name: t('MANAGE_NEW_BUCKET_QINIU_NAME'),
icon: 'qiniu',
configOptions: {
BucketName: {
required: true,
description: $T('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_DESC'),
placeholder: $T('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_PLACEHOLDER'),
description: t('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_DESC'),
placeholder: t('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_PLACEHOLDER'),
paraType: 'string',
component: 'input',
default: 'piclist',
rule: [
{
required: true,
message: $T('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_A'),
message: t('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_A'),
trigger: 'blur'
},
{
validator: (rule: any, value: any, callback: any) => {
const reg = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/
if (value.length > 63) {
callback(new Error($T('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_B')))
callback(new Error(t('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_B')))
} else if (!reg.test(value)) {
callback(new Error($T('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_C')))
callback(new Error(t('MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_C')))
} else {
callback()
}
@@ -147,7 +151,7 @@ export const newBucketConfig: IStringKeyMap = {
},
region: {
required: true,
description: $T('MANAGE_NEW_BUCKET_QINIU_REGION'),
description: t('MANAGE_NEW_BUCKET_QINIU_REGION'),
paraType: 'string',
component: 'select',
default: 'z0',
@@ -155,7 +159,7 @@ export const newBucketConfig: IStringKeyMap = {
},
acl: {
required: true,
description: $T('MANAGE_NEW_BUCKET_QINIU_ACL_DESC'),
description: t('MANAGE_NEW_BUCKET_QINIU_ACL_DESC'),
paraType: 'boolean',
component: 'switch',
default: false
@@ -164,42 +168,42 @@ export const newBucketConfig: IStringKeyMap = {
options: ['BucketName', 'region', 'acl']
},
s3plist: {
name: $T('MANAGE_NEW_BUCKET_S3PLIST_NAME'),
name: t('MANAGE_NEW_BUCKET_S3PLIST_NAME'),
icon: 's3plist',
configOptions: {
BucketName: {
required: true,
description: $T('MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_DESC'),
placeholder: $T('MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_PLACEHOLDER'),
description: t('MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_DESC'),
placeholder: t('MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_PLACEHOLDER'),
paraType: 'string',
component: 'input',
default: 'piclist',
rule: [
{
required: true,
message: $T('MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_RULE_MSG_A'),
message: t('MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_RULE_MSG_A'),
trigger: 'blur'
}
]
},
region: {
required: true,
description: $T('MANAGE_NEW_BUCKET_S3PLIST_REGION'),
description: t('MANAGE_NEW_BUCKET_S3PLIST_REGION'),
paraType: 'string',
component: 'input',
default: 'us-east-1'
},
acl: {
required: true,
description: $T('MANAGE_NEW_BUCKET_S3PLIST_ACL_DESC'),
description: t('MANAGE_NEW_BUCKET_S3PLIST_ACL_DESC'),
paraType: 'string',
component: 'select',
default: 'private',
options: {
private: $T('MANAGE_NEW_BUCKET_S3PLIST_ACL_PRIVATE'),
'public-read': $T('MANAGE_NEW_BUCKET_S3PLIST_ACL_PUBLIC_R'),
'public-read-write': $T('MANAGE_NEW_BUCKET_S3PLIST_ACL_PUBLIC_RW'),
'authenticated-read': $T('MANAGE_NEW_BUCKET_S3PLIST_ACL_AUTHENTICATED_READ')
private: t('MANAGE_NEW_BUCKET_S3PLIST_ACL_PRIVATE'),
'public-read': t('MANAGE_NEW_BUCKET_S3PLIST_ACL_PUBLIC_R'),
'public-read-write': t('MANAGE_NEW_BUCKET_S3PLIST_ACL_PUBLIC_RW'),
'authenticated-read': t('MANAGE_NEW_BUCKET_S3PLIST_ACL_AUTHENTICATED_READ')
}
}
},