mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-06 07:56:56 +08:00
✨ Feature(custom): split i18n in main and renderer, use vue-i18n
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
:style="handleBarActive ? 'height: 85%;' : 'height: 95%;'"
|
||||
>
|
||||
<div class="view-title">
|
||||
{{ $T('GALLERY') }} - {{ filterList.length }}
|
||||
{{ $t('GALLERY') }} - {{ filterList.length }}
|
||||
<el-icon
|
||||
style="margin-left: 4px"
|
||||
class="cursor-pointer"
|
||||
@@ -14,11 +14,11 @@
|
||||
<CaretTop v-show="handleBarActive" />
|
||||
</el-icon>
|
||||
<span style="position: absolute; right: 0; top: 0; margin-right: 20px; font-size: 0.8em; color: #fff">
|
||||
{{ $T('GALLERY_SYNC_DELETE') }}
|
||||
{{ $t('GALLERY_SYNC_DELETE') }}
|
||||
<el-switch
|
||||
v-model="deleteCloud"
|
||||
:active-text="$T('SETTINGS_OPEN')"
|
||||
:inactive-text="$T('SETTINGS_CLOSE')"
|
||||
:active-text="$t('SETTINGS_OPEN')"
|
||||
:inactive-text="$t('SETTINGS_CLOSE')"
|
||||
@change="handleDeleteCloudFile"
|
||||
/>
|
||||
<el-button
|
||||
@@ -29,7 +29,7 @@
|
||||
<el-tooltip
|
||||
class="item"
|
||||
effect="dark"
|
||||
:content="$T('REFRESH')"
|
||||
:content="$t('REFRESH')"
|
||||
placement="bottom"
|
||||
:persistent="false"
|
||||
teleported
|
||||
@@ -61,7 +61,7 @@
|
||||
collapse-tags
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:placeholder="$T('CHOOSE_SHOWED_PICBED')"
|
||||
:placeholder="$t('CHOOSE_SHOWED_PICBED')"
|
||||
:persistent="false"
|
||||
teleported
|
||||
>
|
||||
@@ -97,7 +97,7 @@
|
||||
v-model="pasteStyle"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
:placeholder="$T('CHOOSE_PASTE_FORMAT')"
|
||||
:placeholder="$t('CHOOSE_PASTE_FORMAT')"
|
||||
:persistent="false"
|
||||
teleported
|
||||
@change="handlePasteStyleChange"
|
||||
@@ -135,20 +135,20 @@
|
||||
type="primary"
|
||||
:icon="Sort"
|
||||
>
|
||||
{{ $T('MANAGE_BUCKET_SORT_TITLE') }}
|
||||
{{ $t('MANAGE_BUCKET_SORT_TITLE') }}
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-item @click="sortFile('name')">
|
||||
{{ $T('MANAGE_BUCKET_SORT_NAME') }}
|
||||
{{ $t('MANAGE_BUCKET_SORT_NAME') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="sortFile('ext')">
|
||||
{{ $T('MANAGE_BUCKET_SORT_EXT') }}
|
||||
{{ $t('MANAGE_BUCKET_SORT_EXT') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="sortFile('time')">
|
||||
{{ $T('MANAGE_BUCKET_SORT_TIME') }}
|
||||
{{ $t('MANAGE_BUCKET_SORT_TIME') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click="sortFile('check')">
|
||||
{{ $T('MANAGE_BUCKET_SORT_CHECK') }}
|
||||
{{ $t('MANAGE_BUCKET_SORT_CHECK') }}
|
||||
</el-dropdown-item>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@@ -161,7 +161,7 @@
|
||||
<el-col :span="5">
|
||||
<el-input
|
||||
v-model="searchText"
|
||||
:placeholder="$T('GALLERY_SEARCH_FILENAME')"
|
||||
:placeholder="$t('GALLERY_SEARCH_FILENAME')"
|
||||
size="small"
|
||||
>
|
||||
<template #suffix>
|
||||
@@ -178,7 +178,7 @@
|
||||
<el-col :span="6">
|
||||
<el-input
|
||||
v-model="searchTextURL"
|
||||
:placeholder="$T('GALLERY_SEARCH_URL')"
|
||||
:placeholder="$t('GALLERY_SEARCH_URL')"
|
||||
size="small"
|
||||
>
|
||||
<template #suffix>
|
||||
@@ -205,7 +205,7 @@
|
||||
:class="{ active: isMultiple(choosedList) }"
|
||||
@click="multiCopy"
|
||||
>
|
||||
{{ $T('COPY') }}
|
||||
{{ $t('COPY') }}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
@@ -214,7 +214,7 @@
|
||||
:class="{ active: filterList.length > 0 }"
|
||||
@click="() => (isShowBatchRenameDialog = true)"
|
||||
>
|
||||
{{ $T('GALLERY_CHANGE_URL') }}
|
||||
{{ $t('GALLERY_CHANGE_URL') }}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
@@ -223,7 +223,7 @@
|
||||
:class="{ active: isMultiple(choosedList) }"
|
||||
@click="multiRemove"
|
||||
>
|
||||
{{ $T('DELETE') }}
|
||||
{{ $t('DELETE') }}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
@@ -232,7 +232,7 @@
|
||||
:class="{ active: filterList.length > 0 }"
|
||||
@click="toggleSelectAll"
|
||||
>
|
||||
{{ isAllSelected ? $T('CANCEL') : $T('SELECT_ALL') }}
|
||||
{{ isAllSelected ? $t('CANCEL') : $t('SELECT_ALL') }}
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -320,7 +320,7 @@
|
||||
</el-row>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="$T('CHANGE_IMAGE_URL')"
|
||||
:title="$t('CHANGE_IMAGE_URL')"
|
||||
width="500px"
|
||||
:modal-append-to-body="false"
|
||||
append-to-body
|
||||
@@ -328,19 +328,19 @@
|
||||
<el-input v-model="imgInfo.imgUrl" />
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">
|
||||
{{ $T('CANCEL') }}
|
||||
{{ $t('CANCEL') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="confirmModify"
|
||||
>
|
||||
{{ $T('CONFIRM') }}
|
||||
{{ $t('CONFIRM') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-model="isShowBatchRenameDialog"
|
||||
:title="$T('CHANGE_IMAGE_URL')"
|
||||
:title="$t('CHANGE_IMAGE_URL')"
|
||||
center
|
||||
align-center
|
||||
draggable
|
||||
@@ -352,10 +352,10 @@
|
||||
style="margin-bottom: 10px"
|
||||
>
|
||||
<span>
|
||||
{{ $T('MANAGE_BUCKET_RENAME_FILE_INPUT_A') + $T('GALLERY_MATCHED') + mathcedCount + ' ' }}
|
||||
{{ $t('MANAGE_BUCKET_RENAME_FILE_INPUT_A') + $t('GALLERY_MATCHED') + mathcedCount + ' ' }}
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="$T('MANAGE_BUCKET_RENAME_FILE_INPUT_A_TIPS')"
|
||||
:content="$t('MANAGE_BUCKET_RENAME_FILE_INPUT_A_TIPS')"
|
||||
placement="right"
|
||||
:persistent="false"
|
||||
teleported
|
||||
@@ -368,7 +368,7 @@
|
||||
</el-link>
|
||||
<el-input
|
||||
v-model="batchRenameMatch"
|
||||
:placeholder="$T('MANAGE_BUCKET_RENAME_FILE_INPUT_A_PLACEHOLDER')"
|
||||
:placeholder="$t('MANAGE_BUCKET_RENAME_FILE_INPUT_A_PLACEHOLDER')"
|
||||
clearable
|
||||
/>
|
||||
<el-link
|
||||
@@ -376,7 +376,7 @@
|
||||
style="margin-bottom: 10px; margin-top: 10px"
|
||||
>
|
||||
<span>
|
||||
{{ $T('MANAGE_BUCKET_RENAME_FILE_INPUT_B') }}
|
||||
{{ $t('MANAGE_BUCKET_RENAME_FILE_INPUT_B') }}
|
||||
<el-popover
|
||||
effect="light"
|
||||
placement="right"
|
||||
@@ -417,7 +417,7 @@
|
||||
align="center"
|
||||
label-style="width: 100px;"
|
||||
>
|
||||
{{ $T('MANAGE_BUCKET_RENAME_FILE_TABLE_IID') }}
|
||||
{{ $t('MANAGE_BUCKET_RENAME_FILE_TABLE_IID') }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-popover>
|
||||
@@ -440,7 +440,7 @@
|
||||
}
|
||||
"
|
||||
>
|
||||
{{ $T('MANAGE_BUCKET_RENAME_FILE_CANCEL') }}
|
||||
{{ $t('MANAGE_BUCKET_RENAME_FILE_CANCEL') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -448,7 +448,7 @@
|
||||
:icon="Edit"
|
||||
@click="handleBatchRename()"
|
||||
>
|
||||
{{ $T('MANAGE_BUCKET_RENAME_FILE_CONFIRM') }}
|
||||
{{ $t('MANAGE_BUCKET_RENAME_FILE_CONFIRM') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -470,10 +470,10 @@ import {
|
||||
} from '@element-plus/icons-vue'
|
||||
import { CheckboxValueType, ElMessage, ElMessageBox, ElNotification } from 'element-plus'
|
||||
import { computed, nextTick, onActivated, onBeforeMount, onBeforeUnmount, reactive, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { onBeforeRouteUpdate } from 'vue-router'
|
||||
|
||||
import ALLApi from '@/apis/allApi'
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import { customRenameFormatTable, customStrMatch, customStrReplace } from '@/manage/utils/common'
|
||||
import { getConfig, saveConfig } from '@/utils/dataSender'
|
||||
import $$db from '@/utils/db'
|
||||
@@ -482,6 +482,8 @@ import { IPasteStyle, IRPCActionType } from '#/types/enum'
|
||||
import { ICheckBoxValueType, IGalleryItem, ImgInfo, IObj, IObjT } from '#/types/types'
|
||||
import { configPaths } from '#/utils/configPaths'
|
||||
import { picBedsCanbeDeleted } from '#/utils/static'
|
||||
|
||||
const { t } = useI18n()
|
||||
type IResult<T> = T & {
|
||||
id: string
|
||||
createdAt: number
|
||||
@@ -516,8 +518,8 @@ const pasteStyleMap = {
|
||||
}
|
||||
const useShortUrl = ref<string>('')
|
||||
const shortURLMap = {
|
||||
[$T('UPLOAD_SHORT_URL')]: $T('UPLOAD_SHORT_URL'),
|
||||
[$T('UPLOAD_NORMAL_URL')]: $T('UPLOAD_NORMAL_URL')
|
||||
[t('UPLOAD_SHORT_URL')]: t('UPLOAD_SHORT_URL'),
|
||||
[t('UPLOAD_NORMAL_URL')]: t('UPLOAD_NORMAL_URL')
|
||||
}
|
||||
const fileSortNameReverse = ref(false)
|
||||
const fileSortTimeReverse = ref(false)
|
||||
@@ -722,7 +724,7 @@ async function copy (item: ImgInfo) {
|
||||
})
|
||||
}
|
||||
const obj = {
|
||||
title: $T('COPY_LINK_SUCCEED'),
|
||||
title: t('COPY_LINK_SUCCEED'),
|
||||
body: result ? result[0] : ''
|
||||
}
|
||||
const myNotification = new Notification(obj.title, obj)
|
||||
@@ -734,9 +736,9 @@ async function copy (item: ImgInfo) {
|
||||
|
||||
function remove (item: ImgInfo) {
|
||||
if (!item.id) return
|
||||
$confirm($T('TIPS_REMOVE_LINK'), $T('TIPS_NOTICE'), {
|
||||
confirmButtonText: $T('CONFIRM'),
|
||||
cancelButtonText: $T('CANCEL'),
|
||||
$confirm(t('TIPS_REMOVE_LINK'), t('TIPS_NOTICE'), {
|
||||
confirmButtonText: t('CONFIRM'),
|
||||
cancelButtonText: t('CANCEL'),
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
@@ -748,14 +750,14 @@ function remove (item: ImgInfo) {
|
||||
const result = await ALLApi.delete(item)
|
||||
if (result) {
|
||||
ElNotification({
|
||||
title: $T('GALLERY_SYNC_DELETE_NOTICE_TITLE'),
|
||||
message: `${item.fileName} ${$T('GALLERY_SYNC_DELETE_NOTICE_SUCCEED')}`,
|
||||
title: t('GALLERY_SYNC_DELETE_NOTICE_TITLE'),
|
||||
message: `${item.fileName} ${t('GALLERY_SYNC_DELETE_NOTICE_SUCCEED')}`,
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
ElNotification({
|
||||
title: $T('GALLERY_SYNC_DELETE_NOTICE_TITLE'),
|
||||
message: `${item.fileName} ${$T('GALLERY_SYNC_DELETE_NOTICE_FAILED')}`,
|
||||
title: t('GALLERY_SYNC_DELETE_NOTICE_TITLE'),
|
||||
message: `${item.fileName} ${t('GALLERY_SYNC_DELETE_NOTICE_FAILED')}`,
|
||||
type: 'error'
|
||||
})
|
||||
return true
|
||||
@@ -764,7 +766,7 @@ function remove (item: ImgInfo) {
|
||||
await $$db.removeById(item.id!)
|
||||
window.electron.sendRPC(IRPCActionType.GALLERY_REMOVE_FILES, [file])
|
||||
const obj = {
|
||||
title: $T('OPERATION_SUCCEED'),
|
||||
title: t('OPERATION_SUCCEED'),
|
||||
body: ''
|
||||
}
|
||||
const myNotification = new Notification(obj.title, obj)
|
||||
@@ -796,7 +798,7 @@ async function confirmModify () {
|
||||
imgUrl: imgInfo.imgUrl
|
||||
})
|
||||
const obj = {
|
||||
title: $T('CHANGE_IMAGE_URL_SUCCEED'),
|
||||
title: t('CHANGE_IMAGE_URL_SUCCEED'),
|
||||
body: imgInfo.imgUrl
|
||||
}
|
||||
const myNotification = new Notification(obj.title, obj)
|
||||
@@ -830,13 +832,13 @@ function multiRemove () {
|
||||
const multiRemoveNumber = Object.values(choosedList).filter(item => item).length
|
||||
if (multiRemoveNumber) {
|
||||
$confirm(
|
||||
$T('TIPS_WILL_REMOVE_CHOOSED_IMAGES', {
|
||||
t('TIPS_WILL_REMOVE_CHOOSED_IMAGES', {
|
||||
m: multiRemoveNumber
|
||||
}),
|
||||
$T('TIPS_NOTICE'),
|
||||
t('TIPS_NOTICE'),
|
||||
{
|
||||
confirmButtonText: $T('CONFIRM'),
|
||||
cancelButtonText: $T('CANCEL'),
|
||||
confirmButtonText: t('CONFIRM'),
|
||||
cancelButtonText: t('CANCEL'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
@@ -854,8 +856,8 @@ function multiRemove () {
|
||||
const result = await ALLApi.delete(file)
|
||||
if (result) {
|
||||
ElNotification({
|
||||
title: $T('GALLERY_SYNC_DELETE'),
|
||||
message: `${file.fileName} ${$T('GALLERY_SYNC_DELETE_NOTICE_SUCCEED')}`,
|
||||
title: t('GALLERY_SYNC_DELETE'),
|
||||
message: `${file.fileName} ${t('GALLERY_SYNC_DELETE_NOTICE_SUCCEED')}`,
|
||||
type: 'success',
|
||||
duration: multiRemoveNumber > 5 ? 1000 : 2000
|
||||
})
|
||||
@@ -863,8 +865,8 @@ function multiRemove () {
|
||||
await $$db.removeById(key)
|
||||
} else {
|
||||
ElNotification({
|
||||
title: $T('GALLERY_SYNC_DELETE'),
|
||||
message: `${file.fileName} ${$T('GALLERY_SYNC_DELETE_NOTICE_FAILED')}`,
|
||||
title: t('GALLERY_SYNC_DELETE'),
|
||||
message: `${file.fileName} ${t('GALLERY_SYNC_DELETE_NOTICE_FAILED')}`,
|
||||
type: 'error',
|
||||
duration: multiRemoveNumber > 5 ? 1000 : 2000
|
||||
})
|
||||
@@ -892,7 +894,7 @@ function multiRemove () {
|
||||
// TODO: check this
|
||||
// choosedList = {} // 只有删除才能将这个置空
|
||||
const obj = {
|
||||
title: $T('OPERATION_SUCCEED'),
|
||||
title: t('OPERATION_SUCCEED'),
|
||||
body: ''
|
||||
}
|
||||
window.electron.sendRPC(IRPCActionType.GALLERY_REMOVE_FILES, files)
|
||||
@@ -930,7 +932,7 @@ async function multiCopy () {
|
||||
}
|
||||
}
|
||||
const obj = {
|
||||
title: $T('BATCH_COPY_LINK_SUCCEED'),
|
||||
title: t('BATCH_COPY_LINK_SUCCEED'),
|
||||
body: copyString.join('\n')
|
||||
}
|
||||
const myNotification = new Notification(obj.title, obj)
|
||||
@@ -952,7 +954,7 @@ async function handlePasteStyleChange (val: string) {
|
||||
}
|
||||
|
||||
function handleUseShortUrlChange (value: string) {
|
||||
saveConfig(configPaths.settings.useShortUrl, value === $T('UPLOAD_SHORT_URL'))
|
||||
saveConfig(configPaths.settings.useShortUrl, value === t('UPLOAD_SHORT_URL'))
|
||||
useShortUrl.value = value
|
||||
}
|
||||
|
||||
@@ -1005,7 +1007,7 @@ function sortFile (type: 'name' | 'time' | 'ext' | 'check') {
|
||||
function handleBatchRename () {
|
||||
isShowBatchRenameDialog.value = false
|
||||
if (batchRenameMatch.value === '') {
|
||||
ElMessage.warning($T('MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG'))
|
||||
ElMessage.warning(t('MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG'))
|
||||
return
|
||||
}
|
||||
let matchedFiles = [] as any[]
|
||||
@@ -1015,7 +1017,7 @@ function handleBatchRename () {
|
||||
}
|
||||
})
|
||||
if (matchedFiles.length === 0) {
|
||||
ElMessage.warning($T('MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG2'))
|
||||
ElMessage.warning(t('MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG2'))
|
||||
return
|
||||
}
|
||||
for (const matchedFile of matchedFiles) {
|
||||
@@ -1023,7 +1025,7 @@ function handleBatchRename () {
|
||||
}
|
||||
matchedFiles = matchedFiles.filter((item: any) => item.imgUrl !== item.newUrl)
|
||||
if (matchedFiles.length === 0) {
|
||||
ElMessage.warning($T('MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG3'))
|
||||
ElMessage.warning(t('MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG3'))
|
||||
}
|
||||
for (let i = 0; i < matchedFiles.length; i++) {
|
||||
matchedFiles[i].newUrl = matchedFiles[i].newUrl.replaceAll('{auto}', (i + 1).toString())
|
||||
@@ -1044,7 +1046,7 @@ function handleBatchRename () {
|
||||
Promise.all(promiseList)
|
||||
.then(() => {
|
||||
const obj = {
|
||||
title: $T('OPERATION_SUCCEED'),
|
||||
title: t('OPERATION_SUCCEED'),
|
||||
body: ''
|
||||
}
|
||||
const myNotification = new Notification(obj.title, obj)
|
||||
@@ -1059,11 +1061,11 @@ function handleBatchRename () {
|
||||
}
|
||||
if (duplicateFilesNum > 0) {
|
||||
ElMessageBox.confirm(
|
||||
`${$T('MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_A')} ${duplicateFilesNum} ${$T('MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_B')}`,
|
||||
$T('MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_C'),
|
||||
`${t('MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_A')} ${duplicateFilesNum} ${t('MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_B')}`,
|
||||
t('MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_C'),
|
||||
{
|
||||
confirmButtonText: $T('MANAGE_BUCKET_BATCH_RENAME_REPEATED_CONFIRM'),
|
||||
cancelButtonText: $T('MANAGE_BUCKET_BATCH_RENAME_REPEATED_CANCEL'),
|
||||
confirmButtonText: t('MANAGE_BUCKET_BATCH_RENAME_REPEATED_CONFIRM'),
|
||||
cancelButtonText: t('MANAGE_BUCKET_BATCH_RENAME_REPEATED_CANCEL'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
@@ -1071,7 +1073,7 @@ function handleBatchRename () {
|
||||
rename()
|
||||
})
|
||||
.catch(() => {
|
||||
ElMessage.info($T('MANAGE_BUCKET_BATCH_RENAME_CANCEL'))
|
||||
ElMessage.info(t('MANAGE_BUCKET_BATCH_RENAME_CANCEL'))
|
||||
})
|
||||
} else {
|
||||
rename()
|
||||
@@ -1085,8 +1087,8 @@ onBeforeUnmount(() => {
|
||||
onActivated(async () => {
|
||||
pasteStyle.value = (await getConfig(configPaths.settings.pasteStyle)) || IPasteStyle.MARKDOWN
|
||||
useShortUrl.value = (await getConfig(configPaths.settings.useShortUrl))
|
||||
? $T('UPLOAD_SHORT_URL')
|
||||
: $T('UPLOAD_NORMAL_URL')
|
||||
? t('UPLOAD_SHORT_URL')
|
||||
: t('UPLOAD_NORMAL_URL')
|
||||
initDeleteCloud()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -33,18 +33,19 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { IpcRendererEvent } from 'electron'
|
||||
import type { IpcRendererEvent } from 'electron'
|
||||
import { ElMessage as $message } from 'element-plus'
|
||||
import type { IConfig } from 'piclist'
|
||||
import { onBeforeMount, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import { getConfig } from '@/utils/dataSender'
|
||||
import { osGlobal } from '@/utils/global'
|
||||
import { IRPCActionType } from '#/types/enum'
|
||||
import { IFileWithPath } from '#/types/types'
|
||||
import { isUrl } from '#/utils/common'
|
||||
|
||||
const { t } = useI18n()
|
||||
const logoPath = ref('')
|
||||
const dragover = ref(false)
|
||||
const progress = ref(0)
|
||||
@@ -114,7 +115,7 @@ function onDrop (e: DragEvent) {
|
||||
if (isUrl(str)) {
|
||||
window.electron.sendRPC(IRPCActionType.UPLOAD_CHOOSED_FILES, [{ path: str }])
|
||||
} else {
|
||||
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
$message.error(t('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +133,7 @@ function handleURLDrag (items: DataTransferItemList, dataTransfer: DataTransfer)
|
||||
}
|
||||
])
|
||||
} else {
|
||||
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
$message.error(t('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+282
-268
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="plugin-view">
|
||||
<div class="view-title">
|
||||
{{ $T('PLUGIN_SETTINGS') }} -
|
||||
{{ $t('PLUGIN_SETTINGS') }} -
|
||||
<el-tooltip
|
||||
:content="pluginListToolTip"
|
||||
placement="right"
|
||||
@@ -48,7 +48,7 @@
|
||||
>
|
||||
<el-input
|
||||
v-model="searchText"
|
||||
:placeholder="$T('PLUGIN_SEARCH_PLACEHOLDER')"
|
||||
:placeholder="$t('PLUGIN_SEARCH_PLACEHOLDER')"
|
||||
size="small"
|
||||
>
|
||||
<template #suffix>
|
||||
@@ -132,20 +132,20 @@
|
||||
class="config-button install"
|
||||
@click="installPlugin(item)"
|
||||
>
|
||||
{{ $T('PLUGIN_INSTALL') }}
|
||||
{{ $t('PLUGIN_INSTALL') }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="item.ing"
|
||||
class="config-button ing"
|
||||
>
|
||||
{{ $T('PLUGIN_INSTALLING') }}
|
||||
{{ $t('PLUGIN_INSTALLING') }}
|
||||
</span>
|
||||
</template>
|
||||
<span
|
||||
v-else
|
||||
class="config-button ing"
|
||||
>
|
||||
{{ $T('PLUGIN_INSTALLED') }}
|
||||
{{ $t('PLUGIN_INSTALLED') }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -153,7 +153,7 @@
|
||||
v-if="item.ing"
|
||||
class="config-button ing"
|
||||
>
|
||||
{{ $T('PLUGIN_DOING_SOMETHING') }}
|
||||
{{ $t('PLUGIN_DOING_SOMETHING') }}
|
||||
</span>
|
||||
<template v-else>
|
||||
<el-icon
|
||||
@@ -190,14 +190,14 @@
|
||||
round
|
||||
@click="reloadApp"
|
||||
>
|
||||
{{ $T('TIPS_NEED_RELOAD') }}
|
||||
{{ $t('TIPS_NEED_RELOAD') }}
|
||||
</el-button>
|
||||
</el-row>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:modal-append-to-body="false"
|
||||
:title="
|
||||
$T('CONFIG_THING', {
|
||||
$t('CONFIG_THING', {
|
||||
c: configName
|
||||
})
|
||||
"
|
||||
@@ -216,14 +216,14 @@
|
||||
round
|
||||
@click="dialogVisible = false"
|
||||
>
|
||||
{{ $T('CANCEL') }}
|
||||
{{ $t('CANCEL') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
round
|
||||
@click="handleConfirmConfig"
|
||||
>
|
||||
{{ $T('CONFIRM') }}
|
||||
{{ $t('CONFIRM') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -236,9 +236,9 @@ import type { IpcRendererEvent } from 'electron'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { debounce, DebouncedFunc } from 'lodash-es'
|
||||
import { computed, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref, toRaw, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import ConfigForm from '@/components/ConfigFormForPlugin.vue'
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import { getConfig, saveConfig } from '@/utils/dataSender'
|
||||
import { osGlobal, updatePicBedGlobal } from '@/utils/global'
|
||||
import {
|
||||
@@ -252,6 +252,7 @@ import { INPMSearchResultObject, IPicGoPlugin } from '#/types/types'
|
||||
import { handleStreamlinePluginName } from '#/utils/common'
|
||||
import { configPaths } from '#/utils/configPaths'
|
||||
|
||||
const { t } = useI18n()
|
||||
const $confirm = ElMessageBox.confirm
|
||||
const searchText = ref('')
|
||||
const pluginList = ref<IPicGoPlugin[]>([])
|
||||
@@ -263,9 +264,9 @@ const pluginNameList = ref<string[]>([])
|
||||
const loading = ref(true)
|
||||
const needReload = ref(false)
|
||||
const latestVersionMap = reactive<{ [key: string]: string }>({})
|
||||
const pluginListToolTip = $T('PLUGIN_LIST')
|
||||
const importLocalPluginToolTip = $T('PLUGIN_IMPORT_LOCAL')
|
||||
const updateAllToolTip = $T('PLUGIN_UPDATE_ALL')
|
||||
const pluginListToolTip = t('PLUGIN_LIST')
|
||||
const importLocalPluginToolTip = t('PLUGIN_IMPORT_LOCAL')
|
||||
const updateAllToolTip = t('PLUGIN_UPDATE_ALL')
|
||||
const defaultLogo = ref('this.src=\'/roundLogo.png\'')
|
||||
const $configForm = ref<InstanceType<typeof ConfigForm> | null>(null)
|
||||
const npmSearchText = computed(() => {
|
||||
@@ -440,9 +441,9 @@ function getPluginList () {
|
||||
|
||||
function installPlugin (item: IPicGoPlugin) {
|
||||
if (!item.gui) {
|
||||
$confirm($T('TIPS_PLUGIN_NOT_GUI_IMPLEMENT'), $T('TIPS_NOTICE'), {
|
||||
confirmButtonText: $T('CONFIRM'),
|
||||
cancelButtonText: $T('CANCEL'),
|
||||
$confirm(t('TIPS_PLUGIN_NOT_GUI_IMPLEMENT'), t('TIPS_NOTICE'), {
|
||||
confirmButtonText: t('CONFIRM'),
|
||||
cancelButtonText: t('CANCEL'),
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
@@ -467,8 +468,8 @@ async function handleReload () {
|
||||
needReload: true
|
||||
})
|
||||
needReload.value = true
|
||||
const successNotification = new Notification($T('PLUGIN_UPDATE_SUCCEED'), {
|
||||
body: $T('TIPS_NEED_RELOAD')
|
||||
const successNotification = new Notification(t('PLUGIN_UPDATE_SUCCEED'), {
|
||||
body: t('TIPS_NEED_RELOAD')
|
||||
})
|
||||
successNotification.onclick = () => {
|
||||
reloadApp()
|
||||
@@ -499,8 +500,8 @@ async function handleConfirmConfig () {
|
||||
})
|
||||
break
|
||||
}
|
||||
const successNotification = new Notification($T('SETTINGS_RESULT'), {
|
||||
body: $T('TIPS_SET_SUCCEED')
|
||||
const successNotification = new Notification(t('SETTINGS_RESULT'), {
|
||||
body: t('TIPS_SET_SUCCEED')
|
||||
})
|
||||
successNotification.onclick = () => {
|
||||
return true
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@submit.prevent
|
||||
>
|
||||
<el-form-item
|
||||
:label="$T('FILE_RENAME')"
|
||||
:label="$t('FILE_RENAME')"
|
||||
prop="fileName"
|
||||
:rules="[{ required: true, message: 'file name is required', trigger: 'blur' }]"
|
||||
>
|
||||
@@ -35,7 +35,7 @@
|
||||
size="small"
|
||||
@click="cancel"
|
||||
>
|
||||
{{ $T('CANCEL') }}
|
||||
{{ $t('CANCEL') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -43,7 +43,7 @@
|
||||
size="small"
|
||||
@click="confirmName"
|
||||
>
|
||||
{{ $T('CONFIRM') }}
|
||||
{{ $t('CONFIRM') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
@@ -56,7 +56,6 @@ import type { IpcRendererEvent } from 'electron'
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { onBeforeMount, onBeforeUnmount, reactive, ref } from 'vue'
|
||||
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import { GET_RENAME_FILE_NAME, RENAME_FILE_NAME } from '#/events/constants'
|
||||
|
||||
const id = ref<string | null>(null)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="shortcut-page">
|
||||
<div class="view-title">
|
||||
{{ $T('SETTINGS_SET_SHORTCUT') }}
|
||||
{{ $t('SETTINGS_SET_SHORTCUT') }}
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col
|
||||
@@ -15,28 +15,28 @@
|
||||
header-cell-class-name="shortcut-page-table-border"
|
||||
cell-class-name="shortcut-page-table-border"
|
||||
>
|
||||
<el-table-column :label="$T('SHORTCUT_NAME')">
|
||||
<el-table-column :label="$t('SHORTCUT_NAME')">
|
||||
<template #default="scope">
|
||||
{{ scope.row.label ? scope.row.label : scope.row.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="160px"
|
||||
:label="$T('SHORTCUT_BIND')"
|
||||
:label="$t('SHORTCUT_BIND')"
|
||||
prop="key"
|
||||
/>
|
||||
<el-table-column :label="$T('SHORTCUT_STATUS')">
|
||||
<el-table-column :label="$t('SHORTCUT_STATUS')">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
size="small"
|
||||
:type="scope.row.enable ? 'success' : 'danger'"
|
||||
>
|
||||
{{ scope.row.enable ? $T('SHORTCUT_ENABLED') : $T('SHORTCUT_DISABLED') }}
|
||||
{{ scope.row.enable ? $t('SHORTCUT_ENABLED') : $t('SHORTCUT_DISABLED') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$T('SHORTCUT_SOURCE')"
|
||||
:label="$t('SHORTCUT_SOURCE')"
|
||||
width="100px"
|
||||
>
|
||||
<template #default="scope">
|
||||
@@ -44,7 +44,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
:label="$T('SHORTCUT_HANDLE')"
|
||||
:label="$t('SHORTCUT_HANDLE')"
|
||||
width="100px"
|
||||
>
|
||||
<template #default="scope">
|
||||
@@ -58,7 +58,7 @@
|
||||
:link="true"
|
||||
@click="toggleEnable(scope.row)"
|
||||
>
|
||||
{{ scope.row.enable ? $T('SHORTCUT_DISABLE') : $T('SHORTCUT_ENABLE') }}
|
||||
{{ scope.row.enable ? $t('SHORTCUT_DISABLE') : $t('SHORTCUT_ENABLE') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
class="edit"
|
||||
@@ -67,7 +67,7 @@
|
||||
:link="true"
|
||||
@click="openKeyBindingDialog(scope.row, scope.$index)"
|
||||
>
|
||||
{{ $T('SHORTCUT_EDIT') }}
|
||||
{{ $t('SHORTCUT_EDIT') }}
|
||||
</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
@@ -77,7 +77,7 @@
|
||||
</el-row>
|
||||
<el-dialog
|
||||
v-model="keyBindingVisible"
|
||||
:title="$T('SHORTCUT_CHANGE_UPLOAD')"
|
||||
:title="$t('SHORTCUT_CHANGE_UPLOAD')"
|
||||
:modal-append-to-body="false"
|
||||
append-to-body
|
||||
>
|
||||
@@ -99,14 +99,14 @@
|
||||
round
|
||||
@click="cancelKeyBinding"
|
||||
>
|
||||
{{ $T('CANCEL') }}
|
||||
{{ $t('CANCEL') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
round
|
||||
@click="confirmKeyBinding"
|
||||
>
|
||||
{{ $T('CONFIRM') }}
|
||||
{{ $t('CONFIRM') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@@ -116,7 +116,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeMount, onBeforeUnmount, ref, watch } from 'vue'
|
||||
|
||||
import { T as $T } from '@/i18n'
|
||||
import { getConfig } from '@/utils/dataSender'
|
||||
import keyBinding from '@/utils/key-binding'
|
||||
import { IRPCActionType } from '#/types/enum'
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
>
|
||||
<el-row class="toolbox-header__text">
|
||||
<el-row class="toolbox-header__title">
|
||||
{{ $T('TOOLBOX_TITLE') }}
|
||||
{{ $t('TOOLBOX_TITLE') }}
|
||||
</el-row>
|
||||
<el-row class="toolbox-header__sub-title">
|
||||
{{ $T('TOOLBOX_SUB_TITLE') }}
|
||||
{{ $t('TOOLBOX_SUB_TITLE') }}
|
||||
</el-row>
|
||||
</el-row>
|
||||
</el-row>
|
||||
@@ -24,12 +24,12 @@
|
||||
:disabled="isLoading"
|
||||
@click="handleCheck"
|
||||
>
|
||||
{{ $T('TOOLBOX_START_SCAN') }}
|
||||
{{ $t('TOOLBOX_START_SCAN') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-else-if="isAllSuccess">
|
||||
<div class="toolbox-tips">
|
||||
{{ $T('TOOLBOX_SUCCESS_TIPS') }}
|
||||
{{ $t('TOOLBOX_SUCCESS_TIPS') }}
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="!isAllSuccess">
|
||||
@@ -39,19 +39,19 @@
|
||||
round
|
||||
@click="handleFix"
|
||||
>
|
||||
{{ $T('TOOLBOX_START_FIX') }}
|
||||
{{ $t('TOOLBOX_START_FIX') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="toolbox-cant-fix toolbox-tips">
|
||||
{{ $T('TOOLBOX_CANT_AUTO_FIX') }}
|
||||
{{ $t('TOOLBOX_CANT_AUTO_FIX') }}
|
||||
<el-button
|
||||
type="primary"
|
||||
round
|
||||
class="toolbox-cant-fix__btn"
|
||||
@click="handleCheck"
|
||||
>
|
||||
{{ $T('TOOLBOX_RE_SCAN') }}
|
||||
{{ $t('TOOLBOX_RE_SCAN') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -95,41 +95,42 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { IToolboxCheckRes } from 'root/src/universal/types/rpc'
|
||||
import { IToolboxMap } from 'root/src/universal/types/view'
|
||||
import { computed, onUnmounted, reactive, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import ToolboxHandler from '@/components/ToolboxHandler.vue'
|
||||
import ToolboxStatusIcon from '@/components/ToolboxStatusIcon.vue'
|
||||
import { T as $T } from '@/i18n'
|
||||
import { IRPCActionType, IToolboxItemCheckStatus, IToolboxItemType } from '#/types/enum'
|
||||
import { IToolboxCheckRes } from '#/types/rpc'
|
||||
import { IToolboxMap } from '#/types/view'
|
||||
|
||||
const { t } = useI18n()
|
||||
const $confirm = ElMessageBox.confirm
|
||||
const defaultLogo = ref('/roundLogo.png')
|
||||
const activeTypes = ref<IToolboxItemType[]>([])
|
||||
const fixList = reactive<IToolboxMap>({
|
||||
[IToolboxItemType.IS_CONFIG_FILE_BROKEN]: {
|
||||
title: $T('TOOLBOX_CHECK_CONFIG_FILE_BROKEN'),
|
||||
title: t('TOOLBOX_CHECK_CONFIG_FILE_BROKEN'),
|
||||
status: IToolboxItemCheckStatus.INIT,
|
||||
handlerText: $T('SETTINGS_OPEN_CONFIG_FILE'),
|
||||
handlerText: t('SETTINGS_OPEN_CONFIG_FILE'),
|
||||
handler (value: string) {
|
||||
window.electron.sendRPC(IRPCActionType.OPEN_FILE, value)
|
||||
}
|
||||
},
|
||||
[IToolboxItemType.IS_GALLERY_FILE_BROKEN]: {
|
||||
title: $T('TOOLBOX_CHECK_GALLERY_FILE_BROKEN'),
|
||||
title: t('TOOLBOX_CHECK_GALLERY_FILE_BROKEN'),
|
||||
status: IToolboxItemCheckStatus.INIT
|
||||
},
|
||||
[IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD]: {
|
||||
title: $T('TOOLBOX_CHECK_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD'), // picgo-image-clipboard folder
|
||||
title: t('TOOLBOX_CHECK_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD'), // picgo-image-clipboard folder
|
||||
status: IToolboxItemCheckStatus.INIT,
|
||||
handlerText: $T('OPEN_FILE_PATH'),
|
||||
handlerText: t('OPEN_FILE_PATH'),
|
||||
handler (value: string) {
|
||||
window.electron.sendRPC(IRPCActionType.OPEN_FILE, value)
|
||||
}
|
||||
},
|
||||
[IToolboxItemType.HAS_PROBLEM_WITH_PROXY]: {
|
||||
title: $T('TOOLBOX_CHECK_PROBLEM_WITH_PROXY'),
|
||||
title: t('TOOLBOX_CHECK_PROBLEM_WITH_PROXY'),
|
||||
status: IToolboxItemCheckStatus.INIT,
|
||||
hasNoFixMethod: true
|
||||
}
|
||||
@@ -210,9 +211,9 @@ const handleFix = async () => {
|
||||
}
|
||||
})
|
||||
|
||||
$confirm($T('TOOLBOX_FIX_DONE_NEED_RELOAD'), $T('TIPS_NOTICE'), {
|
||||
confirmButtonText: $T('CONFIRM'),
|
||||
cancelButtonText: $T('CANCEL'),
|
||||
$confirm(t('TOOLBOX_FIX_DONE_NEED_RELOAD'), t('TIPS_NOTICE'), {
|
||||
confirmButtonText: t('CONFIRM'),
|
||||
cancelButtonText: t('CANCEL'),
|
||||
type: 'info'
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
class="open-main-window"
|
||||
@click="openSettingWindow"
|
||||
>
|
||||
{{ $T('OPEN_MAIN_WINDOW') }}
|
||||
{{ $t('OPEN_MAIN_WINDOW') }}
|
||||
</div>
|
||||
<div class="content">
|
||||
<div
|
||||
@@ -12,7 +12,7 @@
|
||||
class="wait-upload-img"
|
||||
>
|
||||
<div class="list-title">
|
||||
{{ $T('WAIT_TO_UPLOAD') }}
|
||||
{{ $t('WAIT_TO_UPLOAD') }}
|
||||
</div>
|
||||
<div
|
||||
v-for="(item, index) in clipboardFiles"
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class="uploaded-img">
|
||||
<div class="list-title">
|
||||
{{ $T('ALREADY_UPLOAD') }}
|
||||
{{ $t('ALREADY_UPLOAD') }}
|
||||
</div>
|
||||
<div
|
||||
v-for="item in files"
|
||||
@@ -64,8 +64,8 @@
|
||||
<script lang="ts" setup>
|
||||
import type { IpcRendererEvent } from 'electron'
|
||||
import { onBeforeMount, onBeforeUnmount, reactive, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import { getConfig } from '@/utils/dataSender'
|
||||
import $$db from '@/utils/db'
|
||||
import { IPasteStyle, IRPCActionType, IWindowList } from '#/types/enum'
|
||||
@@ -73,6 +73,8 @@ import { ImgInfo } from '#/types/types'
|
||||
import { handleUrlEncode } from '#/utils/common'
|
||||
import { configPaths } from '#/utils/configPaths'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
type IResult<T> = T & {
|
||||
id: string
|
||||
createdAt: number
|
||||
@@ -80,7 +82,7 @@ type IResult<T> = T & {
|
||||
}
|
||||
const files = ref<IResult<ImgInfo>[]>([])
|
||||
const notification = reactive({
|
||||
title: $T('COPY_LINK_SUCCEED'),
|
||||
title: t('COPY_LINK_SUCCEED'),
|
||||
body: ''
|
||||
})
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<el-tooltip
|
||||
placement="top"
|
||||
effect="light"
|
||||
:content="$T('UPLOAD_VIEW_HINT')"
|
||||
:content="$t('UPLOAD_VIEW_HINT')"
|
||||
:persistent="false"
|
||||
teleported
|
||||
>
|
||||
@@ -34,7 +34,7 @@
|
||||
style="margin-left: 6px"
|
||||
@click="handleImageProcess"
|
||||
>
|
||||
{{ $T('UPLOAD_PAGE_IMAGE_PROCESS_NAME') }}
|
||||
{{ $t('UPLOAD_PAGE_IMAGE_PROCESS_NAME') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div
|
||||
@@ -52,8 +52,8 @@
|
||||
<UploadFilled />
|
||||
</el-icon>
|
||||
<div class="upload-dragger__text">
|
||||
{{ $T('DRAG_FILE_TO_HERE') }}
|
||||
<span>{{ $T('CLICK_TO_UPLOAD') }}</span>
|
||||
{{ $t('DRAG_FILE_TO_HERE') }}
|
||||
<span>{{ $t('CLICK_TO_UPLOAD') }}</span>
|
||||
</div>
|
||||
<input
|
||||
id="file-uploader"
|
||||
@@ -73,7 +73,7 @@
|
||||
<div class="paste-style">
|
||||
<div class="el-col-12">
|
||||
<div class="paste-style__text">
|
||||
{{ $T('LINK_FORMAT') }}
|
||||
{{ $t('LINK_FORMAT') }}
|
||||
</div>
|
||||
<el-radio-group
|
||||
v-model="pasteStyle"
|
||||
@@ -98,19 +98,19 @@
|
||||
:value="true"
|
||||
style="border-radius: 5px"
|
||||
>
|
||||
{{ $T('UPLOAD_SHORT_URL') }}
|
||||
{{ $t('UPLOAD_SHORT_URL') }}
|
||||
</el-radio-button>
|
||||
<el-radio-button
|
||||
:value="false"
|
||||
style="border-radius: 5px"
|
||||
>
|
||||
{{ $T('UPLOAD_NORMAL_URL') }}
|
||||
{{ $t('UPLOAD_NORMAL_URL') }}
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="el-col-8">
|
||||
<div class="paste-style__text">
|
||||
{{ $T('QUICK_UPLOAD') }}
|
||||
{{ $t('QUICK_UPLOAD') }}
|
||||
</div>
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -120,7 +120,7 @@
|
||||
style="width: 50%"
|
||||
@click="uploadClipboardFiles"
|
||||
>
|
||||
{{ $T('CLIPBOARD_PICTURE') }}
|
||||
{{ $t('CLIPBOARD_PICTURE') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@@ -138,7 +138,7 @@
|
||||
</el-row>
|
||||
<el-dialog
|
||||
v-model="imageProcessDialogVisible"
|
||||
:title="$T('UPLOAD_PAGE_IMAGE_PROCESS_DIALOG_TITLE')"
|
||||
:title="$t('UPLOAD_PAGE_IMAGE_PROCESS_DIALOG_TITLE')"
|
||||
width="50%"
|
||||
draggable
|
||||
center
|
||||
@@ -155,10 +155,10 @@ import { CaretBottom, UploadFilled } from '@element-plus/icons-vue'
|
||||
import type { IpcRendererEvent } from 'electron'
|
||||
import { ElMessage as $message } from 'element-plus'
|
||||
import { onBeforeMount, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import ImageProcessSetting from '@/components/ImageProcessSetting.vue'
|
||||
import { T as $T } from '@/i18n'
|
||||
import { PICBEDS_PAGE } from '@/router/config'
|
||||
import $bus from '@/utils/bus'
|
||||
import { getConfig, saveConfig } from '@/utils/dataSender'
|
||||
@@ -170,6 +170,7 @@ import { IFileWithPath, IUploaderConfigItem } from '#/types/types'
|
||||
import { isUrl } from '#/utils/common'
|
||||
import { configPaths } from '#/utils/configPaths'
|
||||
|
||||
const { t } = useI18n()
|
||||
useDragEventListeners()
|
||||
const $router = useRouter()
|
||||
|
||||
@@ -277,7 +278,7 @@ function onDrop (e: DragEvent) {
|
||||
if (isUrl(str)) {
|
||||
window.electron.sendRPC(IRPCActionType.UPLOAD_CHOOSED_FILES, [{ path: str }])
|
||||
} else {
|
||||
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
$message.error(t('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,7 +296,7 @@ function handleURLDrag (items: DataTransferItemList, dataTransfer: DataTransfer)
|
||||
}
|
||||
])
|
||||
} else {
|
||||
$message.error($T('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
$message.error(t('TIPS_DRAG_VALID_PICTURE_OR_URL'))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,8 +350,8 @@ async function uploadURLFiles () {
|
||||
const str = await navigator.clipboard.readText()
|
||||
$bus.emit(SHOW_INPUT_BOX, {
|
||||
value: isUrl(str) ? str : '',
|
||||
title: $T('TIPS_INPUT_URL'),
|
||||
placeholder: $T('TIPS_HTTP_PREFIX')
|
||||
title: t('TIPS_INPUT_URL'),
|
||||
placeholder: t('TIPS_HTTP_PREFIX')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -363,7 +364,7 @@ function handleInputBoxValue (val: string) {
|
||||
}
|
||||
])
|
||||
} else {
|
||||
$message.error($T('TIPS_INPUT_VALID_URL'))
|
||||
$message.error(t('TIPS_INPUT_VALID_URL'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="config-list-view">
|
||||
<div class="view-title">
|
||||
{{ $T('SETTINGS') }}
|
||||
{{ $t('SETTINGS') }}
|
||||
</div>
|
||||
<el-row
|
||||
:gutter="15"
|
||||
@@ -34,7 +34,7 @@
|
||||
v-if="defaultConfigId === item._id"
|
||||
class="default-text"
|
||||
>
|
||||
{{ $T('SELECTED_SETTING_HINT') }}
|
||||
{{ $t('SELECTED_SETTING_HINT') }}
|
||||
</div>
|
||||
<div class="operation-container">
|
||||
<el-icon
|
||||
@@ -84,7 +84,7 @@
|
||||
:disabled="store?.state.defaultPicBed === type"
|
||||
@click="setDefaultPicBed(type)"
|
||||
>
|
||||
{{ $T('SETTINGS_SET_DEFAULT_PICBED') }}
|
||||
{{ $t('SETTINGS_SET_DEFAULT_PICBED') }}
|
||||
</el-button>
|
||||
</el-row>
|
||||
</div>
|
||||
@@ -94,16 +94,17 @@
|
||||
import { Delete, Edit, Plus } from '@element-plus/icons-vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { onBeforeMount, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { onBeforeRouteUpdate, useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import { useStore } from '@/hooks/useStore'
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import { PICBEDS_PAGE, UPLOADER_CONFIG_PAGE } from '@/router/config'
|
||||
import { saveConfig } from '@/utils/dataSender'
|
||||
import { IRPCActionType } from '#/types/enum'
|
||||
import { IStringKeyMap, IUploaderConfigItem } from '#/types/types'
|
||||
import { configPaths } from '#/utils/configPaths'
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
@@ -185,8 +186,8 @@ function setDefaultPicBed (type: string) {
|
||||
store?.setDefaultPicBed(type)
|
||||
const currentConfigName = curConfigList.value.find(item => item._id === defaultConfigId.value)?._configName
|
||||
window.electron.sendRPC(IRPCActionType.TRAY_SET_TOOL_TIP, `${type} ${currentConfigName || ''}`)
|
||||
const successNotification = new Notification($T('SETTINGS_DEFAULT_PICBED'), {
|
||||
body: $T('TIPS_SET_SUCCEED')
|
||||
const successNotification = new Notification(t('SETTINGS_DEFAULT_PICBED'), {
|
||||
body: t('TIPS_SET_SUCCEED')
|
||||
})
|
||||
successNotification.onclick = () => {
|
||||
return true
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<span
|
||||
class="view-title-text"
|
||||
@click="handleNameClick"
|
||||
> {{ picBedName }} {{ $T('SETTINGS') }}</span>
|
||||
> {{ picBedName }} {{ $t('SETTINGS') }}</span>
|
||||
<el-icon>
|
||||
<Link />
|
||||
</el-icon>
|
||||
@@ -23,7 +23,7 @@
|
||||
style="margin-left: 6px"
|
||||
@click="handleCopyApi"
|
||||
>
|
||||
{{ $T('UPLOAD_PAGE_COPY_UPLOAD_API') }}
|
||||
{{ $t('UPLOAD_PAGE_COPY_UPLOAD_API') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<config-form
|
||||
@@ -40,14 +40,14 @@
|
||||
round
|
||||
@click="handleReset"
|
||||
>
|
||||
{{ $T('RESET_PICBED_CONFIG') }}
|
||||
{{ $t('RESET_PICBED_CONFIG') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
round
|
||||
@click="handleConfirm"
|
||||
>
|
||||
{{ $T('CONFIRM') }}
|
||||
{{ $t('CONFIRM') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
round
|
||||
@@ -62,7 +62,7 @@
|
||||
:disabled="picBedConfigList.length === 0"
|
||||
teleported
|
||||
>
|
||||
{{ $T('MANAGE_LOGIN_PAGE_PANE_IMPORT') }}
|
||||
{{ $t('MANAGE_LOGIN_PAGE_PANE_IMPORT') }}
|
||||
<template #dropdown>
|
||||
<el-dropdown-item
|
||||
v-for="i in picBedConfigList"
|
||||
@@ -82,7 +82,7 @@
|
||||
class="single"
|
||||
>
|
||||
<div class="notice">
|
||||
{{ $T('SETTINGS_NOT_CONFIG_OPTIONS') }}
|
||||
{{ $t('SETTINGS_NOT_CONFIG_OPTIONS') }}
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -95,16 +95,17 @@ import { Link } from '@element-plus/icons-vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { ElDropdown, ElMessage } from 'element-plus'
|
||||
import { onBeforeMount, ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import ConfigForm from '@/components/ConfigForm.vue'
|
||||
import { T as $T } from '@/i18n/index'
|
||||
import { getConfig } from '@/utils/dataSender'
|
||||
import { II18nLanguage, IRPCActionType } from '#/types/enum'
|
||||
import { IPicGoPluginConfig, IStringKeyMap, IUploaderConfigItem, IUploaderConfigListItem } from '#/types/types'
|
||||
import { configPaths } from '#/utils/configPaths'
|
||||
import { picBedManualUrlList } from '#/utils/static'
|
||||
|
||||
const { t } = useI18n()
|
||||
const type = ref('')
|
||||
const config = ref<IPicGoPluginConfig[]>([])
|
||||
const picBedConfigList = ref<IUploaderConfigListItem[]>([])
|
||||
@@ -124,8 +125,8 @@ const handleConfirm = async () => {
|
||||
const result = (await $configForm.value?.validate()) || false
|
||||
if (result !== false) {
|
||||
await window.electron.triggerRPC<void>(IRPCActionType.UPLOADER_UPDATE_CONFIG, type.value, result?._id, result)
|
||||
const successNotification = new Notification($T('SETTINGS_RESULT'), {
|
||||
body: $T('TIPS_SET_SUCCEED')
|
||||
const successNotification = new Notification(t('SETTINGS_RESULT'), {
|
||||
body: t('TIPS_SET_SUCCEED')
|
||||
})
|
||||
successNotification.onclick = () => {
|
||||
return true
|
||||
@@ -167,8 +168,8 @@ async function handleConfigImport (configItem: IUploaderConfigListItem) {
|
||||
|
||||
const handleReset = async () => {
|
||||
await window.electron.triggerRPC<void>(IRPCActionType.UPLOADER_RESET_CONFIG, type.value, $route.params.configId)
|
||||
const successNotification = new Notification($T('SETTINGS_RESULT'), {
|
||||
body: $T('TIPS_RESET_SUCCEED')
|
||||
const successNotification = new Notification(t('SETTINGS_RESULT'), {
|
||||
body: t('TIPS_RESET_SUCCEED')
|
||||
})
|
||||
successNotification.onclick = () => {
|
||||
return true
|
||||
@@ -197,7 +198,7 @@ async function handleCopyApi () {
|
||||
}
|
||||
const apiUrl = `http://${host === '0.0.0.0' ? '127.0.0.1' : host}:${port}/upload?picbed=${$route.params.type}&configName=${picBedConfig._configName}${serverKey ? `&key=${serverKey}` : ''}`
|
||||
window.electron.clipboard.writeText(apiUrl)
|
||||
ElMessage.success(`${$T('MANAGE_BUCKET_COPY_SUCCESS')} ${apiUrl}`)
|
||||
ElMessage.success(`${t('MANAGE_BUCKET_COPY_SUCCESS')} ${apiUrl}`)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
ElMessage.error('Copy failed')
|
||||
|
||||
Reference in New Issue
Block a user