中英双语
This commit is contained in:
1 parent
ea26af26ee
commit
b98c0333e6
50 files changed
+4082
-2049
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { watch, type WatchStopHandle } from 'vue'
|
||||
import type { SettingsState, useParticleStore } from '../store/particleStore'
|
||||
import { translate } from '../i18n'
|
||||
|
||||
type EditorStore = ReturnType<typeof useParticleStore>
|
||||
|
||||
@@ -79,12 +80,12 @@ function parseSystemSettingsCache(text: string): SystemSettingsFile {
|
||||
try {
|
||||
parsed = JSON.parse(text)
|
||||
} catch {
|
||||
throw new Error('系统设置缓存不是有效的 JSON')
|
||||
throw new Error(translate('errors.settingsInvalidJson'))
|
||||
}
|
||||
const candidate = parsed as Partial<SystemSettingsFile>
|
||||
if (candidate.format !== SYSTEM_SETTINGS_FORMAT) throw new Error('不是 Spine粒子编辑器系统设置缓存')
|
||||
if (candidate.version !== SYSTEM_SETTINGS_VERSION) throw new Error(`暂不支持系统配置版本:${candidate.version ?? '未知'}`)
|
||||
if (!candidate.settings || typeof candidate.settings !== 'object') throw new Error('系统设置缓存缺少 settings')
|
||||
if (candidate.format !== SYSTEM_SETTINGS_FORMAT) throw new Error(translate('errors.settingsFormat'))
|
||||
if (candidate.version !== SYSTEM_SETTINGS_VERSION) throw new Error(translate('errors.settingsVersion', { version: candidate.version ?? translate('export.unknown') }))
|
||||
if (!candidate.settings || typeof candidate.settings !== 'object') throw new Error(translate('errors.settingsMissing'))
|
||||
return candidate as SystemSettingsFile
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user