diff --git a/dashboard/src/components/BackupFilesUploader.vue b/dashboard/src/components/BackupFilesUploader.vue index c403b58..0130ab8 100644 --- a/dashboard/src/components/BackupFilesUploader.vue +++ b/dashboard/src/components/BackupFilesUploader.vue @@ -29,26 +29,26 @@ class="text-base" :class="error ? 'text-red-500' : 'text-gray-600'" > - {{ - uploading - ? `上传中 ${progress}%` - : success - ? formatBytes(fileObj.size) - : error - ? error - : file.description - }} + {{ + uploading + ? $t('Uploading {progress}%', { progress }) + : success + ? formatBytes(fileObj.size) + : error + ? error + : file.description + }} @@ -72,36 +72,32 @@ export default { icon: '', type: 'database', ext: 'application/x-gzip,application/sql,.sql', - title: '数据库备份', - description: - '上传数据库备份文件。通常文件名以 .sql.gz 或 .sql 结尾', + title: this.$t('Database Backup'), + description: this.$t('Upload database backup file. Usually the filename ends with .sql.gz or .sql'), file: null }, { icon: '', type: 'public', ext: 'application/x-tar', - title: '公共文件', - description: - '上传公共文件备份。通常文件名以 -files.tar 结尾', + title: this.$t('Public Files'), + description: this.$t('Upload public files backup. Usually the filename ends with -files.tar'), file: null }, { icon: '', type: 'private', ext: 'application/x-tar', - title: '私有文件', - description: - '上传私有文件备份。通常文件名以 -private-files.tar 结尾', + title: this.$t('Private Files'), + description: this.$t('Upload private files backup. Usually the filename ends with -private-files.tar'), file: null }, { icon: '', type: 'config', ext: 'application/json', - title: '站点配置(如备份已加密则必需)', - description: - '上传站点配置文件。通常文件名以 -site_config_backup.json 结尾', + title: this.$t('Site Config (required if backup is encrypted)'), + description: this.$t('Upload site config file. Usually the filename ends with -site_config_backup.json'), file: null } ] @@ -118,7 +114,7 @@ export default { // valid strings are "database.sql.gz", "database.sql", "database.sql (1).gz", "database.sql (2).gz" if (!/\.sql( \(\d\))?\.gz$|\.sql$/.test(file.name)) { throw new Error( - '数据库备份文件应以"database.sql.gz"或"database.sql"结尾' + this.$t('Database backup file should end with "database.sql.gz" or "database.sql"') ); } if ( @@ -128,17 +124,18 @@ export default { 'application/sql' ].includes(file.type) ) { - throw new Error('无效的数据库备份文件'); + throw new Error(this.$t('Invalid database backup file')); } } if (['public', 'private'].includes(type)) { if (file.type != 'application/x-tar') { - throw new Error(`无效的${type === 'public' ? '公共' : '私有'}文件备份文件`); + const fileType = type === 'public' ? this.$t('public') : this.$t('private'); + throw new Error(this.$t('Invalid {fileType} files backup file', { fileType })); } } if (type === 'config') { if (file.type != 'application/json') { - throw new Error(`无效的站点配置文件`); + throw new Error(this.$t('Invalid site config file')); } } } diff --git a/dashboard/src/components/SiteDatabaseRestoreDialog.vue b/dashboard/src/components/SiteDatabaseRestoreDialog.vue index 11a8772..958ddc0 100644 --- a/dashboard/src/components/SiteDatabaseRestoreDialog.vue +++ b/dashboard/src/components/SiteDatabaseRestoreDialog.vue @@ -1,10 +1,10 @@