feat(Nutstore): 添加坚果云备份文本 (#8940)

This commit is contained in:
George·Dong 2025-08-08 00:39:24 +08:00 committed by GitHub
parent 9129625365
commit 32c28e32cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 161 additions and 34 deletions

View File

@ -30,9 +30,20 @@ interface WebdavBackupManagerProps {
webdavDisableStream?: boolean webdavDisableStream?: boolean
} }
restoreMethod?: (fileName: string) => Promise<void> restoreMethod?: (fileName: string) => Promise<void>
customLabels?: {
restoreConfirmTitle?: string
restoreConfirmContent?: string
invalidConfigMessage?: string
}
} }
export function WebdavBackupManager({ visible, onClose, webdavConfig, restoreMethod }: WebdavBackupManagerProps) { export function WebdavBackupManager({
visible,
onClose,
webdavConfig,
restoreMethod,
customLabels
}: WebdavBackupManagerProps) {
const { t } = useTranslation() const { t } = useTranslation()
const [backupFiles, setBackupFiles] = useState<BackupFile[]>([]) const [backupFiles, setBackupFiles] = useState<BackupFile[]>([])
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
@ -167,14 +178,14 @@ export function WebdavBackupManager({ visible, onClose, webdavConfig, restoreMet
const handleRestore = async (fileName: string) => { const handleRestore = async (fileName: string) => {
if (!webdavHost) { if (!webdavHost) {
window.message.error(t('message.error.invalid.webdav')) window.message.error(customLabels?.invalidConfigMessage || t('message.error.invalid.webdav'))
return return
} }
window.modal.confirm({ window.modal.confirm({
title: t('settings.data.webdav.restore.confirm.title'), title: customLabels?.restoreConfirmTitle || t('settings.data.webdav.restore.confirm.title'),
icon: <ExclamationCircleOutlined />, icon: <ExclamationCircleOutlined />,
content: t('settings.data.webdav.restore.confirm.content'), content: customLabels?.restoreConfirmContent || t('settings.data.webdav.restore.confirm.content'),
okText: t('common.confirm'), okText: t('common.confirm'),
cancelText: t('common.cancel'), cancelText: t('common.cancel'),
centered: true, centered: true,

View File

@ -11,6 +11,10 @@ interface WebdavModalProps {
backuping: boolean backuping: boolean
customFileName: string customFileName: string
setCustomFileName: (value: string) => void setCustomFileName: (value: string) => void
customLabels?: {
modalTitle?: string
filenamePlaceholder?: string
}
} }
export function useWebdavBackupModal({ backupMethod }: { backupMethod?: typeof backupToWebdav } = {}) { export function useWebdavBackupModal({ backupMethod }: { backupMethod?: typeof backupToWebdav } = {}) {
@ -59,13 +63,14 @@ export function WebdavBackupModal({
handleCancel, handleCancel,
backuping, backuping,
customFileName, customFileName,
setCustomFileName setCustomFileName,
customLabels
}: WebdavModalProps) { }: WebdavModalProps) {
const { t } = useTranslation() const { t } = useTranslation()
return ( return (
<Modal <Modal
title={t('settings.data.webdav.backup.modal.title')} title={customLabels?.modalTitle || t('settings.data.webdav.backup.modal.title')}
open={isModalVisible} open={isModalVisible}
onOk={handleBackup} onOk={handleBackup}
onCancel={handleCancel} onCancel={handleCancel}
@ -75,7 +80,7 @@ export function WebdavBackupModal({
<Input <Input
value={customFileName} value={customFileName}
onChange={(e) => setCustomFileName(e.target.value)} onChange={(e) => setCustomFileName(e.target.value)}
placeholder={t('settings.data.webdav.backup.modal.filename.placeholder')} placeholder={customLabels?.filenamePlaceholder || t('settings.data.webdav.backup.modal.filename.placeholder')}
/> />
</Modal> </Modal>
) )

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "Backup to Nutstore" "button": "Backup to Nutstore",
"modal": {
"filename": {
"placeholder": "Enter backup filename"
},
"title": "Backup to Nutstore"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "Nutstore connection failed", "fail": "Nutstore connection failed",
@ -2260,7 +2266,11 @@
"title": "Nutstore Storage Path" "title": "Nutstore Storage Path"
}, },
"restore": { "restore": {
"button": "Restore from Nutstore" "button": "Restore from Nutstore",
"confirm": {
"content": "Restoring from Nutstore will overwrite current data. Do you want to continue?",
"title": "Restore from Nutstore"
}
}, },
"title": "Nutstore Configuration", "title": "Nutstore Configuration",
"username": "Nutstore Username" "username": "Nutstore Username"

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "Nutstoreにバックアップ" "button": "Nutstoreにバックアップ",
"modal": {
"filename": {
"placeholder": "バックアップファイル名を入力"
},
"title": "Nutstoreにバックアップ"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "Nutstore接続に失敗しました", "fail": "Nutstore接続に失敗しました",
@ -2260,7 +2266,11 @@
"title": "Nutstoreストレージパス" "title": "Nutstoreストレージパス"
}, },
"restore": { "restore": {
"button": "Nutstoreから復元" "button": "Nutstoreから復元",
"confirm": {
"content": "Nutstoreからの復元により現在のデータが上書きされます。続行しますか",
"title": "Nutstoreから復元"
}
}, },
"title": "Nutstore設定", "title": "Nutstore設定",
"username": "Nutstoreユーザー名" "username": "Nutstoreユーザー名"

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "Резервное копирование в Nutstore" "button": "Резервное копирование в Nutstore",
"modal": {
"filename": {
"placeholder": "Пожалуйста, введите имя файла резервной копии"
},
"title": "Резервное копирование в Nutstore"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "Ошибка подключения к Nutstore", "fail": "Ошибка подключения к Nutstore",
@ -2260,7 +2266,11 @@
"title": "Путь хранения Nutstore" "title": "Путь хранения Nutstore"
}, },
"restore": { "restore": {
"button": "Восстановление из Nutstore" "button": "Восстановление из Nutstore",
"confirm": {
"content": "Восстановление из Nutstore перезапишет текущие данные. Продолжить?",
"title": "Восстановить из Nutstore"
}
}, },
"title": "Настройки Nutstore", "title": "Настройки Nutstore",
"username": "Имя пользователя Nutstore" "username": "Имя пользователя Nutstore"

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "备份到坚果云" "button": "备份到坚果云",
"modal": {
"filename": {
"placeholder": "请输入备份文件名"
},
"title": "备份到坚果云"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "坚果云连接失败", "fail": "坚果云连接失败",
@ -2260,7 +2266,11 @@
"title": "坚果云存储路径" "title": "坚果云存储路径"
}, },
"restore": { "restore": {
"button": "从坚果云恢复" "button": "从坚果云恢复",
"confirm": {
"content": "从坚果云恢复将会覆盖当前数据,是否继续?",
"title": "从坚果云恢复"
}
}, },
"title": "坚果云配置", "title": "坚果云配置",
"username": "坚果云用户名" "username": "坚果云用户名"

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "備份到堅果雲" "button": "備份到堅果雲",
"modal": {
"filename": {
"placeholder": "請輸入備份檔案名"
},
"title": "備份到堅果雲"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "堅果雲連接失敗", "fail": "堅果雲連接失敗",
@ -2260,7 +2266,11 @@
"title": "堅果雲存儲路徑" "title": "堅果雲存儲路徑"
}, },
"restore": { "restore": {
"button": "從堅果雲恢復" "button": "從堅果雲恢復",
"confirm": {
"content": "從堅果雲恢復將覆蓋目前資料,是否繼續?",
"title": "從堅果雲恢復"
}
}, },
"title": "堅果雲設定", "title": "堅果雲設定",
"username": "堅果雲用戶名" "username": "堅果雲用戶名"

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "Αντίγραφο ασφαλείας στο Jotunn Cloud" "button": "Αντίγραφο ασφαλείας στο Jotunn Cloud",
"modal": {
"filename": {
"placeholder": "Παρακαλώ εισαγάγετε το όνομα του αρχείου δημιουργίας αντιγράφου ασφαλείας"
},
"title": "Δημιουργία αντιγράφων ασφαλείας στο Jianshu Cloud"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "Αποτυχία σύνδεσης στο Jotunn Cloud", "fail": "Αποτυχία σύνδεσης στο Jotunn Cloud",
@ -2260,7 +2266,11 @@
"title": "Διαδρομή αποθήκευσης Jotunn Cloud" "title": "Διαδρομή αποθήκευσης Jotunn Cloud"
}, },
"restore": { "restore": {
"button": "Επαναφορά από το Jotunn Cloud" "button": "Επαναφορά από το Jotunn Cloud",
"confirm": {
"content": "Η επαναφορά από το Nutstore θα αντικαταστήσει τα τρέχοντα δεδομένα. Θέλετε να συνεχίσετε;",
"title": "Επαναφορά από το Nutstore"
}
}, },
"title": "Ρυθμίσεις Jotunn Cloud", "title": "Ρυθμίσεις Jotunn Cloud",
"username": "Όνομα χρήστη Jotunn Cloud" "username": "Όνομα χρήστη Jotunn Cloud"
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Χωρίς σημειώσεις", "noReleaseNotes": "Χωρίς σημειώσεις",
"title": "Ενημέρωση" "title": "Ενημέρωση"
}, },
"warning": {
"missing_provider": "Ο προμηθευτής δεν υπάρχει, έγινε επαναφορά στον προεπιλεγμένο προμηθευτή {{provider}}. Αυτό μπορεί να προκαλέσει προβλήματα."
},
"words": { "words": {
"knowledgeGraph": "γνώσεις Γράφου", "knowledgeGraph": "γνώσεις Γράφου",
"quit": "Έξοδος", "quit": "Έξοδος",

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "Hacer copia de seguridad en Nutstore" "button": "Hacer copia de seguridad en Nutstore",
"modal": {
"filename": {
"placeholder": "Por favor, introduzca el nombre del archivo de copia de seguridad"
},
"title": "Copia de seguridad en Nutstore"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "Fallo en la conexión con Nutstore", "fail": "Fallo en la conexión con Nutstore",
@ -2260,7 +2266,11 @@
"title": "Ruta de almacenamiento de Nutstore" "title": "Ruta de almacenamiento de Nutstore"
}, },
"restore": { "restore": {
"button": "Restaurar desde Nutstore" "button": "Restaurar desde Nutstore",
"confirm": {
"content": "Restaurar desde Nutstore sobrescribirá los datos actuales, ¿deseas continuar?",
"title": "Restaurar desde Nutstore"
}
}, },
"title": "Configuración de Nutstore", "title": "Configuración de Nutstore",
"username": "Nombre de usuario de Nutstore" "username": "Nombre de usuario de Nutstore"
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Sin notas de la versión", "noReleaseNotes": "Sin notas de la versión",
"title": "Actualización" "title": "Actualización"
}, },
"warning": {
"missing_provider": "El proveedor no existe, se ha revertido al proveedor predeterminado {{provider}}. Esto podría causar problemas."
},
"words": { "words": {
"knowledgeGraph": "Grafo de Conocimiento", "knowledgeGraph": "Grafo de Conocimiento",
"quit": "Salir", "quit": "Salir",

View File

@ -2226,12 +2226,18 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "Резервное копирование в坚果云" "button": "Sauvegarder sur Nutstore",
"modal": {
"filename": {
"placeholder": "Veuillez saisir le nom du fichier de sauvegarde"
},
"title": "Sauvegarder sur Nutstore"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "Не удалось подключиться к坚果云", "fail": "Échec de la connexion à Nutstore",
"name": "Проверить соединение", "name": "Проверить соединение",
"success": "Соединение с坚果云 установлено" "success": "Connecté à Nutstore"
}, },
"isLogin": "Вход выполнен", "isLogin": "Вход выполнен",
"login": { "login": {
@ -2239,8 +2245,8 @@
}, },
"logout": { "logout": {
"button": "Выйти из аккаунта", "button": "Выйти из аккаунта",
"content": "После выхода будет невозможно создать резервную копию в坚果云 или восстановить данные из нее", "content": "Après la déconnexion, il ne sera plus possible de sauvegarder vers Nutstore ni de restaurer depuis Nutstore.",
"title": "Вы действительно хотите выйти из аккаунта坚果云?" "title": "Êtes-vous sûr de vouloir vous déconnecter de Nutstore ?"
}, },
"new_folder": { "new_folder": {
"button": { "button": {
@ -2251,19 +2257,23 @@
}, },
"notLogin": "Вход не выполнен", "notLogin": "Вход не выполнен",
"path": { "path": {
"label": "Путь хранения данных坚果云", "label": "Chemin de stockage Nutstore",
"placeholder": "Введите путь хранения данных坚果云" "placeholder": "Veuillez saisir le chemin de stockage de Nutstore"
}, },
"pathSelector": { "pathSelector": {
"currentPath": "Текущий путь", "currentPath": "Текущий путь",
"return": "Назад", "return": "Назад",
"title": "Путь хранения данных坚果云" "title": "Chemin de stockage Nutstore"
}, },
"restore": { "restore": {
"button": "Восстановление из坚果云" "button": "Restauration depuis Nutstore",
"confirm": {
"content": "La restauration depuis Nutstore écrasera les données actuelles. Continuer ?",
"title": "Récupérer depuis Nutstore"
}
}, },
"title": "Настройка坚果云", "title": "Configuration de Nutstore",
"username": "Имя пользователя坚果云" "username": "Nom dutilisateur Nutstore"
}, },
"obsidian": { "obsidian": {
"default_vault": "Référentiel Obsidian par défaut", "default_vault": "Référentiel Obsidian par défaut",
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Aucune note de version", "noReleaseNotes": "Aucune note de version",
"title": "Mise à jour" "title": "Mise à jour"
}, },
"warning": {
"missing_provider": "Le fournisseur nexiste pas, retour au fournisseur par défaut {{provider}}. Cela peut entraîner des problèmes."
},
"words": { "words": {
"knowledgeGraph": "Graphe de connaissances", "knowledgeGraph": "Graphe de connaissances",
"quit": "Quitter", "quit": "Quitter",

View File

@ -2226,7 +2226,13 @@
}, },
"nutstore": { "nutstore": {
"backup": { "backup": {
"button": "Fazer backup para o Nutstore" "button": "Fazer backup para o Nutstore",
"modal": {
"filename": {
"placeholder": "Por favor, introduza o nome do ficheiro de cópia de segurança"
},
"title": "Fazer backup para o Nutstore"
}
}, },
"checkConnection": { "checkConnection": {
"fail": "Falha na conexão com o Nutstore", "fail": "Falha na conexão com o Nutstore",
@ -2260,7 +2266,11 @@
"title": "Caminho de armazenamento do Nutstore" "title": "Caminho de armazenamento do Nutstore"
}, },
"restore": { "restore": {
"button": "Restaurar do Nutstore" "button": "Restaurar do Nutstore",
"confirm": {
"content": "Restaurar a partir da Nutstore irá substituir os dados atuais. Deseja continuar?",
"title": "Restaurar a partir do Nutstore"
}
}, },
"title": "Configuração do Nutstore", "title": "Configuração do Nutstore",
"username": "Nome de usuário do Nutstore" "username": "Nome de usuário do Nutstore"
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Sem notas de versão", "noReleaseNotes": "Sem notas de versão",
"title": "Atualização" "title": "Atualização"
}, },
"warning": {
"missing_provider": "O fornecedor não existe; foi revertido para o fornecedor predefinido {{provider}}. Isto pode causar problemas."
},
"words": { "words": {
"knowledgeGraph": "Gráfico de Conhecimento", "knowledgeGraph": "Gráfico de Conhecimento",
"quit": "Sair", "quit": "Sair",

View File

@ -325,6 +325,10 @@ const NutstoreSettings: FC = () => {
backuping={backuping} backuping={backuping}
customFileName={customFileName} customFileName={customFileName}
setCustomFileName={setCustomFileName} setCustomFileName={setCustomFileName}
customLabels={{
modalTitle: t('settings.data.nutstore.backup.modal.title'),
filenamePlaceholder: t('settings.data.nutstore.backup.modal.filename.placeholder')
}}
/> />
<WebdavBackupManager <WebdavBackupManager
@ -337,6 +341,11 @@ const NutstoreSettings: FC = () => {
webdavPath: storagePath webdavPath: storagePath
}} }}
restoreMethod={restoreFromNutstore} restoreMethod={restoreFromNutstore}
customLabels={{
restoreConfirmTitle: t('settings.data.nutstore.restore.confirm.title'),
restoreConfirmContent: t('settings.data.nutstore.restore.confirm.content'),
invalidConfigMessage: t('message.error.invalid.nutstore')
}}
/> />
</> </>
</SettingGroup> </SettingGroup>