mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-05 07:28:42 +08:00
🐛 Fix(custom): fix i18n issue in cloud page
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
### 🐛 问题修复
|
||||
|
||||
- 修复了云端页面部分文字没有跟随语言设置进行改变的问题
|
||||
- 修复了单图床重命名设置项在更新时,配置文件设置的值未正确更新的问题
|
||||
- 修复了某些情况下重命名未生效的问题
|
||||
- 修复了部分情况下,忽略软件更新选项未正确保存的问题
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- Fixed an issue where some text on the cloud page did not change according to the language settings.
|
||||
- Fixed an issue where the value set in the configuration file for the single image bed renaming setting was not correctly updated during updates.
|
||||
- Fixed an issue where renaming did not take effect in certain cases.
|
||||
- Fixed an issue where the option to ignore software updates was not correctly saved in some cases.
|
||||
|
||||
@@ -281,7 +281,7 @@ import useMessage from '@/hooks/useMessage'
|
||||
import ManageEditPage from '@/manage/pages/ManageEditPage.vue'
|
||||
import { useManageStore } from '@/manage/store/manageStore'
|
||||
import { formObjToTableData } from '@/manage/utils/common'
|
||||
import { supportedPicBedList } from '@/manage/utils/constants'
|
||||
import { getSupportedPicBedList } from '@/manage/utils/constants'
|
||||
import { getConfig, removeConfig, saveConfig } from '@/manage/utils/dataSender'
|
||||
import { formatEndpoint } from '@/utils/common'
|
||||
import { configPaths } from '@/utils/configPaths'
|
||||
@@ -289,6 +289,7 @@ import { getConfig as getPicListConfig } from '@/utils/dataSender'
|
||||
import { II18nLanguage, IRPCActionType } from '@/utils/enum'
|
||||
|
||||
const { t } = useI18n()
|
||||
const supportedPicBedList = computed(() => getSupportedPicBedList(t))
|
||||
const manageStore = useManageStore()
|
||||
const router = useRouter()
|
||||
const message = useMessage()
|
||||
@@ -331,7 +332,7 @@ const tabItems = computed(() => {
|
||||
iconComponent: FolderIcon,
|
||||
}
|
||||
|
||||
const dynamicItems = Object.values(supportedPicBedList).map((item: any) => ({
|
||||
const dynamicItems = Object.values(supportedPicBedList.value).map((item: any) => ({
|
||||
key: item.icon,
|
||||
name: item.name,
|
||||
icon: item.icon,
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DownloadIcon, InfoIcon, LinkIcon, RotateCcwIcon, SaveIcon, XIcon } from 'lucide-vue-next'
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import { computed, onMounted, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import CustomButton from '@/components/common/CustomButton.vue'
|
||||
@@ -170,7 +170,7 @@ import SettingCard from '@/components/common/SettingCard.vue'
|
||||
import SingleSelect from '@/components/common/SingleSelect.vue'
|
||||
import useMessage from '@/hooks/useMessage'
|
||||
import { useManageStore } from '@/manage/store/manageStore'
|
||||
import { supportedPicBedList } from '@/manage/utils/constants'
|
||||
import { getSupportedPicBedList } from '@/manage/utils/constants'
|
||||
import { getConfig, saveConfig } from '@/manage/utils/dataSender'
|
||||
import { formatEndpoint } from '@/utils/common'
|
||||
import { IRPCActionType } from '@/utils/enum'
|
||||
@@ -184,6 +184,7 @@ const { aliasName, platformName } = defineProps<{
|
||||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
const supportedPicBedList = computed(() => getSupportedPicBedList(t))
|
||||
const manageStore = useManageStore()
|
||||
const message = useMessage()
|
||||
const formErrors = ref<IStringKeyMap>({})
|
||||
@@ -201,7 +202,7 @@ watch(selectedAlias, newAlias => {
|
||||
const handleReferenceClick = (url: string) => window.electron.sendRPC(IRPCActionType.OPEN_URL, url)
|
||||
|
||||
const validateField = (picBedName: string, optionKey: string) => {
|
||||
const configOption = supportedPicBedList[picBedName]?.configOptions?.[optionKey]
|
||||
const configOption = supportedPicBedList.value[picBedName]?.configOptions?.[optionKey]
|
||||
const value = configResult.value[optionKey]
|
||||
|
||||
if (!configOption) return
|
||||
@@ -263,7 +264,7 @@ async function handleConfigChange() {
|
||||
}
|
||||
|
||||
const aliasList = Object.values(existingConfiguration.value).map(item => item.alias)
|
||||
const allKeys = Object.keys(supportedPicBedList[platformName].configOptions)
|
||||
const allKeys = Object.keys(supportedPicBedList.value[platformName].configOptions)
|
||||
const resultMap: IStringKeyMap = {}
|
||||
if (aliasList.includes(configResult.value.alias) && aliasName !== configResult.value.alias) {
|
||||
notifyUser(t('pages.manage.login.aliasExistMsg'), 'error')
|
||||
@@ -277,11 +278,14 @@ async function handleConfigChange() {
|
||||
}
|
||||
}
|
||||
|
||||
if (supportedPicBedList[platformName].configOptions[key].default !== undefined && configResult.value[key] === '') {
|
||||
resultMap[key] = supportedPicBedList[platformName].configOptions[key].default
|
||||
if (
|
||||
supportedPicBedList.value[platformName].configOptions[key].default !== undefined &&
|
||||
configResult.value[key] === ''
|
||||
) {
|
||||
resultMap[key] = supportedPicBedList.value[platformName].configOptions[key].default
|
||||
} else if (configResult.value[key] === undefined) {
|
||||
if (supportedPicBedList[platformName].configOptions[key].default !== undefined) {
|
||||
resultMap[key] = supportedPicBedList[platformName].configOptions[key].default
|
||||
if (supportedPicBedList.value[platformName].configOptions[key].default !== undefined) {
|
||||
resultMap[key] = supportedPicBedList.value[platformName].configOptions[key].default
|
||||
} else {
|
||||
resultMap[key] = ''
|
||||
}
|
||||
@@ -346,8 +350,8 @@ async function getExistingConfig(name: string) {
|
||||
|
||||
function handleConfigImport(alias: string) {
|
||||
if (alias === '') {
|
||||
supportedPicBedList[platformName].options.forEach((option: any) => {
|
||||
const defaultValue = supportedPicBedList[platformName].configOptions[option].default
|
||||
supportedPicBedList.value[platformName].options.forEach((option: any) => {
|
||||
const defaultValue = supportedPicBedList.value[platformName].configOptions[option].default
|
||||
if (defaultValue !== undefined && option !== 'alias') {
|
||||
configResult.value[option] = defaultValue
|
||||
}
|
||||
@@ -357,7 +361,7 @@ function handleConfigImport(alias: string) {
|
||||
const selectedConfig = existingConfiguration.value[alias]
|
||||
if (!selectedConfig) return
|
||||
|
||||
supportedPicBedList[selectedConfig.picBedName].options.forEach((option: any) => {
|
||||
supportedPicBedList.value[selectedConfig.picBedName].options.forEach((option: any) => {
|
||||
if (selectedConfig[option] !== undefined) {
|
||||
configResult.value[option] = selectedConfig[option]
|
||||
}
|
||||
@@ -365,7 +369,7 @@ function handleConfigImport(alias: string) {
|
||||
}
|
||||
|
||||
const validateAllFields = (picBedName: string): boolean => {
|
||||
const options = supportedPicBedList[picBedName]?.options || []
|
||||
const options = supportedPicBedList.value[picBedName]?.options || []
|
||||
let isValid = true
|
||||
|
||||
for (const option of options) {
|
||||
@@ -393,11 +397,11 @@ const handleConfigReset = () => {
|
||||
}
|
||||
|
||||
const initializeDefaultValues = () => {
|
||||
if (!supportedPicBedList[platformName]) return
|
||||
if (!supportedPicBedList.value[platformName]) return
|
||||
|
||||
const options = supportedPicBedList[platformName].options || []
|
||||
const options = supportedPicBedList.value[platformName].options || []
|
||||
for (const option of options) {
|
||||
const configOption = supportedPicBedList[platformName].configOptions[option]
|
||||
const configOption = supportedPicBedList.value[platformName].configOptions[option]
|
||||
|
||||
if (configResult.value[option] === undefined || configResult.value[option] === '') {
|
||||
if (configOption.default !== undefined) {
|
||||
|
||||
@@ -287,11 +287,12 @@ import BucketPage from '@/manage/pages/BucketPage.vue'
|
||||
import EmptyPage from '@/manage/pages/EmptyPage.vue'
|
||||
import ManageSetting from '@/manage/pages/ManageSetting.vue'
|
||||
import { useManageStore } from '@/manage/store/manageStore'
|
||||
import { supportedPicBedList } from '@/manage/utils/constants'
|
||||
import { getSupportedPicBedList } from '@/manage/utils/constants'
|
||||
import { newBucketConfig } from '@/manage/utils/newBucketConfig'
|
||||
import { IRPCActionType } from '@/utils/enum'
|
||||
|
||||
const { t } = useI18n()
|
||||
const supportedPicBedList = computed(() => getSupportedPicBedList(t))
|
||||
const manageStore = useManageStore() as any
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
@@ -1,22 +1,4 @@
|
||||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
import en from '@/i18n/locales/en.json'
|
||||
import zhCN from '@/i18n/locales/zh-CN.json'
|
||||
import zhTW from '@/i18n/locales/zh-TW.json'
|
||||
|
||||
type MessageSchema = typeof en
|
||||
|
||||
const i18n = createI18n<MessageSchema, 'en' | 'zh-CN' | 'zh-TW'>({
|
||||
legacy: false,
|
||||
locale: localStorage.getItem('currentLanguage') || 'zh-CN',
|
||||
fallbackLocale: 'zh-CN',
|
||||
messages: {
|
||||
en,
|
||||
'zh-CN': zhCN,
|
||||
'zh-TW': zhTW,
|
||||
},
|
||||
})
|
||||
const { t } = i18n.global
|
||||
export function getSupportedPicBedList(t: (key: string, values?: Record<string, unknown>) => string): IStringKeyMap {
|
||||
const defaultBaseRule = (name: string) => {
|
||||
return [
|
||||
{
|
||||
@@ -76,7 +58,7 @@ const bucketNameTooltip = t('pages.manage.constant.bucketNameTip')
|
||||
const baseDirTooltip = t('pages.manage.constant.baseDirTip')
|
||||
const isAutoCustomUrlTooltip = t('pages.manage.constant.isAutoCustomUrlTip')
|
||||
|
||||
export const supportedPicBedList: IStringKeyMap = {
|
||||
return {
|
||||
smms: {
|
||||
name: 'S.EE',
|
||||
icon: 'smms',
|
||||
@@ -176,7 +158,16 @@ export const supportedPicBedList: IStringKeyMap = {
|
||||
},
|
||||
},
|
||||
explain: t('pages.manage.constant.explain'),
|
||||
options: ['alias', 'accessKey', 'secretKey', 'bucketName', 'baseDir', 'isAutoCustomUrl', 'paging', 'itemsPerPage'],
|
||||
options: [
|
||||
'alias',
|
||||
'accessKey',
|
||||
'secretKey',
|
||||
'bucketName',
|
||||
'baseDir',
|
||||
'isAutoCustomUrl',
|
||||
'paging',
|
||||
'itemsPerPage',
|
||||
],
|
||||
refLink: 'https://piclist.cn/manage.html#%E4%B8%83%E7%89%9B%E4%BA%91',
|
||||
referenceText: t('pages.manage.constant.referText'),
|
||||
},
|
||||
@@ -1095,3 +1086,4 @@ export const supportedPicBedList: IStringKeyMap = {
|
||||
referenceText: t('pages.manage.constant.referText'),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -320,7 +320,6 @@ interface IQiniuConfig {
|
||||
|
||||
interface ISMMSConfig {
|
||||
token: string
|
||||
backupDomain?: string
|
||||
}
|
||||
|
||||
interface ITcYunConfig {
|
||||
|
||||
Reference in New Issue
Block a user