From 32c28e32cd0e8dffc3024e22b3bccd2427ebd8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=C2=B7Dong?= <98630204+GeorgeDong32@users.noreply.github.com> Date: Fri, 8 Aug 2025 00:39:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(Nutstore):=20=E6=B7=BB=E5=8A=A0=E5=9D=9A?= =?UTF-8?q?=E6=9E=9C=E4=BA=91=E5=A4=87=E4=BB=BD=E6=96=87=E6=9C=AC=20(#8940?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/WebdavBackupManager.tsx | 19 +++++++--- src/renderer/src/components/WebdavModals.tsx | 11 ++++-- src/renderer/src/i18n/locales/en-us.json | 14 ++++++-- src/renderer/src/i18n/locales/ja-jp.json | 14 ++++++-- src/renderer/src/i18n/locales/ru-ru.json | 14 ++++++-- src/renderer/src/i18n/locales/zh-cn.json | 14 ++++++-- src/renderer/src/i18n/locales/zh-tw.json | 14 ++++++-- src/renderer/src/i18n/translate/el-gr.json | 17 +++++++-- src/renderer/src/i18n/translate/es-es.json | 17 +++++++-- src/renderer/src/i18n/translate/fr-fr.json | 35 +++++++++++++------ src/renderer/src/i18n/translate/pt-pt.json | 17 +++++++-- .../DataSettings/NutstoreSettings.tsx | 9 +++++ 12 files changed, 161 insertions(+), 34 deletions(-) diff --git a/src/renderer/src/components/WebdavBackupManager.tsx b/src/renderer/src/components/WebdavBackupManager.tsx index fdd174b4a6..f04cbef04e 100644 --- a/src/renderer/src/components/WebdavBackupManager.tsx +++ b/src/renderer/src/components/WebdavBackupManager.tsx @@ -30,9 +30,20 @@ interface WebdavBackupManagerProps { webdavDisableStream?: boolean } restoreMethod?: (fileName: string) => Promise + 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 [backupFiles, setBackupFiles] = useState([]) const [loading, setLoading] = useState(false) @@ -167,14 +178,14 @@ export function WebdavBackupManager({ visible, onClose, webdavConfig, restoreMet const handleRestore = async (fileName: string) => { if (!webdavHost) { - window.message.error(t('message.error.invalid.webdav')) + window.message.error(customLabels?.invalidConfigMessage || t('message.error.invalid.webdav')) return } window.modal.confirm({ - title: t('settings.data.webdav.restore.confirm.title'), + title: customLabels?.restoreConfirmTitle || t('settings.data.webdav.restore.confirm.title'), icon: , - content: t('settings.data.webdav.restore.confirm.content'), + content: customLabels?.restoreConfirmContent || t('settings.data.webdav.restore.confirm.content'), okText: t('common.confirm'), cancelText: t('common.cancel'), centered: true, diff --git a/src/renderer/src/components/WebdavModals.tsx b/src/renderer/src/components/WebdavModals.tsx index b587a79aa8..8f90e14127 100644 --- a/src/renderer/src/components/WebdavModals.tsx +++ b/src/renderer/src/components/WebdavModals.tsx @@ -11,6 +11,10 @@ interface WebdavModalProps { backuping: boolean customFileName: string setCustomFileName: (value: string) => void + customLabels?: { + modalTitle?: string + filenamePlaceholder?: string + } } export function useWebdavBackupModal({ backupMethod }: { backupMethod?: typeof backupToWebdav } = {}) { @@ -59,13 +63,14 @@ export function WebdavBackupModal({ handleCancel, backuping, customFileName, - setCustomFileName + setCustomFileName, + customLabels }: WebdavModalProps) { const { t } = useTranslation() return ( setCustomFileName(e.target.value)} - placeholder={t('settings.data.webdav.backup.modal.filename.placeholder')} + placeholder={customLabels?.filenamePlaceholder || t('settings.data.webdav.backup.modal.filename.placeholder')} /> ) diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index bb24f698e9..66a998f54f 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "backup": { - "button": "Backup to Nutstore" + "button": "Backup to Nutstore", + "modal": { + "filename": { + "placeholder": "Enter backup filename" + }, + "title": "Backup to Nutstore" + } }, "checkConnection": { "fail": "Nutstore connection failed", @@ -2260,7 +2266,11 @@ "title": "Nutstore Storage Path" }, "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", "username": "Nutstore Username" diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index c1b6e73ac6..42b86582b3 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "backup": { - "button": "Nutstoreにバックアップ" + "button": "Nutstoreにバックアップ", + "modal": { + "filename": { + "placeholder": "バックアップファイル名を入力" + }, + "title": "Nutstoreにバックアップ" + } }, "checkConnection": { "fail": "Nutstore接続に失敗しました", @@ -2260,7 +2266,11 @@ "title": "Nutstoreストレージパス" }, "restore": { - "button": "Nutstoreから復元" + "button": "Nutstoreから復元", + "confirm": { + "content": "Nutstoreからの復元により現在のデータが上書きされます。続行しますか?", + "title": "Nutstoreから復元" + } }, "title": "Nutstore設定", "username": "Nutstoreユーザー名" diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index ce701d95dd..850c46309f 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "backup": { - "button": "Резервное копирование в Nutstore" + "button": "Резервное копирование в Nutstore", + "modal": { + "filename": { + "placeholder": "Пожалуйста, введите имя файла резервной копии" + }, + "title": "Резервное копирование в Nutstore" + } }, "checkConnection": { "fail": "Ошибка подключения к Nutstore", @@ -2260,7 +2266,11 @@ "title": "Путь хранения Nutstore" }, "restore": { - "button": "Восстановление из Nutstore" + "button": "Восстановление из Nutstore", + "confirm": { + "content": "Восстановление из Nutstore перезапишет текущие данные. Продолжить?", + "title": "Восстановить из Nutstore" + } }, "title": "Настройки Nutstore", "username": "Имя пользователя Nutstore" diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 49bed6aff4..b1c08f4e4e 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "backup": { - "button": "备份到坚果云" + "button": "备份到坚果云", + "modal": { + "filename": { + "placeholder": "请输入备份文件名" + }, + "title": "备份到坚果云" + } }, "checkConnection": { "fail": "坚果云连接失败", @@ -2260,7 +2266,11 @@ "title": "坚果云存储路径" }, "restore": { - "button": "从坚果云恢复" + "button": "从坚果云恢复", + "confirm": { + "content": "从坚果云恢复将会覆盖当前数据,是否继续?", + "title": "从坚果云恢复" + } }, "title": "坚果云配置", "username": "坚果云用户名" diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index 42fdbc2ba4..36d39f370c 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "backup": { - "button": "備份到堅果雲" + "button": "備份到堅果雲", + "modal": { + "filename": { + "placeholder": "請輸入備份檔案名" + }, + "title": "備份到堅果雲" + } }, "checkConnection": { "fail": "堅果雲連接失敗", @@ -2260,7 +2266,11 @@ "title": "堅果雲存儲路徑" }, "restore": { - "button": "從堅果雲恢復" + "button": "從堅果雲恢復", + "confirm": { + "content": "從堅果雲恢復將覆蓋目前資料,是否繼續?", + "title": "從堅果雲恢復" + } }, "title": "堅果雲設定", "username": "堅果雲用戶名" diff --git a/src/renderer/src/i18n/translate/el-gr.json b/src/renderer/src/i18n/translate/el-gr.json index 946c06713e..7e22afefe6 100644 --- a/src/renderer/src/i18n/translate/el-gr.json +++ b/src/renderer/src/i18n/translate/el-gr.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "backup": { - "button": "Αντίγραφο ασφαλείας στο Jotunn Cloud" + "button": "Αντίγραφο ασφαλείας στο Jotunn Cloud", + "modal": { + "filename": { + "placeholder": "Παρακαλώ εισαγάγετε το όνομα του αρχείου δημιουργίας αντιγράφου ασφαλείας" + }, + "title": "Δημιουργία αντιγράφων ασφαλείας στο Jianshu Cloud" + } }, "checkConnection": { "fail": "Αποτυχία σύνδεσης στο Jotunn Cloud", @@ -2260,7 +2266,11 @@ "title": "Διαδρομή αποθήκευσης Jotunn Cloud" }, "restore": { - "button": "Επαναφορά από το Jotunn Cloud" + "button": "Επαναφορά από το Jotunn Cloud", + "confirm": { + "content": "Η επαναφορά από το Nutstore θα αντικαταστήσει τα τρέχοντα δεδομένα. Θέλετε να συνεχίσετε;", + "title": "Επαναφορά από το Nutstore" + } }, "title": "Ρυθμίσεις Jotunn Cloud", "username": "Όνομα χρήστη Jotunn Cloud" @@ -3573,6 +3583,9 @@ "noReleaseNotes": "Χωρίς σημειώσεις", "title": "Ενημέρωση" }, + "warning": { + "missing_provider": "Ο προμηθευτής δεν υπάρχει, έγινε επαναφορά στον προεπιλεγμένο προμηθευτή {{provider}}. Αυτό μπορεί να προκαλέσει προβλήματα." + }, "words": { "knowledgeGraph": "γνώσεις Γράφου", "quit": "Έξοδος", diff --git a/src/renderer/src/i18n/translate/es-es.json b/src/renderer/src/i18n/translate/es-es.json index 74b02b4d37..d68114880a 100644 --- a/src/renderer/src/i18n/translate/es-es.json +++ b/src/renderer/src/i18n/translate/es-es.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "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": { "fail": "Fallo en la conexión con Nutstore", @@ -2260,7 +2266,11 @@ "title": "Ruta de almacenamiento de Nutstore" }, "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", "username": "Nombre de usuario de Nutstore" @@ -3573,6 +3583,9 @@ "noReleaseNotes": "Sin notas de la versión", "title": "Actualización" }, + "warning": { + "missing_provider": "El proveedor no existe, se ha revertido al proveedor predeterminado {{provider}}. Esto podría causar problemas." + }, "words": { "knowledgeGraph": "Grafo de Conocimiento", "quit": "Salir", diff --git a/src/renderer/src/i18n/translate/fr-fr.json b/src/renderer/src/i18n/translate/fr-fr.json index 2cb4872529..86f424d5e5 100644 --- a/src/renderer/src/i18n/translate/fr-fr.json +++ b/src/renderer/src/i18n/translate/fr-fr.json @@ -2226,12 +2226,18 @@ }, "nutstore": { "backup": { - "button": "Резервное копирование в坚果云" + "button": "Sauvegarder sur Nutstore", + "modal": { + "filename": { + "placeholder": "Veuillez saisir le nom du fichier de sauvegarde" + }, + "title": "Sauvegarder sur Nutstore" + } }, "checkConnection": { - "fail": "Не удалось подключиться к坚果云", + "fail": "Échec de la connexion à Nutstore", "name": "Проверить соединение", - "success": "Соединение с坚果云 установлено" + "success": "Connecté à Nutstore" }, "isLogin": "Вход выполнен", "login": { @@ -2239,8 +2245,8 @@ }, "logout": { "button": "Выйти из аккаунта", - "content": "После выхода будет невозможно создать резервную копию в坚果云 или восстановить данные из нее", - "title": "Вы действительно хотите выйти из аккаунта坚果云?" + "content": "Après la déconnexion, il ne sera plus possible de sauvegarder vers Nutstore ni de restaurer depuis Nutstore.", + "title": "Êtes-vous sûr de vouloir vous déconnecter de Nutstore ?" }, "new_folder": { "button": { @@ -2251,19 +2257,23 @@ }, "notLogin": "Вход не выполнен", "path": { - "label": "Путь хранения данных坚果云", - "placeholder": "Введите путь хранения данных坚果云" + "label": "Chemin de stockage Nutstore", + "placeholder": "Veuillez saisir le chemin de stockage de Nutstore" }, "pathSelector": { "currentPath": "Текущий путь", "return": "Назад", - "title": "Путь хранения данных坚果云" + "title": "Chemin de stockage Nutstore" }, "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": "Настройка坚果云", - "username": "Имя пользователя坚果云" + "title": "Configuration de Nutstore", + "username": "Nom d’utilisateur Nutstore" }, "obsidian": { "default_vault": "Référentiel Obsidian par défaut", @@ -3573,6 +3583,9 @@ "noReleaseNotes": "Aucune note de version", "title": "Mise à jour" }, + "warning": { + "missing_provider": "Le fournisseur n’existe pas, retour au fournisseur par défaut {{provider}}. Cela peut entraîner des problèmes." + }, "words": { "knowledgeGraph": "Graphe de connaissances", "quit": "Quitter", diff --git a/src/renderer/src/i18n/translate/pt-pt.json b/src/renderer/src/i18n/translate/pt-pt.json index 637c591fc8..3fcfd9189c 100644 --- a/src/renderer/src/i18n/translate/pt-pt.json +++ b/src/renderer/src/i18n/translate/pt-pt.json @@ -2226,7 +2226,13 @@ }, "nutstore": { "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": { "fail": "Falha na conexão com o Nutstore", @@ -2260,7 +2266,11 @@ "title": "Caminho de armazenamento do Nutstore" }, "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", "username": "Nome de usuário do Nutstore" @@ -3573,6 +3583,9 @@ "noReleaseNotes": "Sem notas de versão", "title": "Atualização" }, + "warning": { + "missing_provider": "O fornecedor não existe; foi revertido para o fornecedor predefinido {{provider}}. Isto pode causar problemas." + }, "words": { "knowledgeGraph": "Gráfico de Conhecimento", "quit": "Sair", diff --git a/src/renderer/src/pages/settings/DataSettings/NutstoreSettings.tsx b/src/renderer/src/pages/settings/DataSettings/NutstoreSettings.tsx index f4ecf72edb..c5ac8ccd45 100644 --- a/src/renderer/src/pages/settings/DataSettings/NutstoreSettings.tsx +++ b/src/renderer/src/pages/settings/DataSettings/NutstoreSettings.tsx @@ -325,6 +325,10 @@ const NutstoreSettings: FC = () => { backuping={backuping} customFileName={customFileName} setCustomFileName={setCustomFileName} + customLabels={{ + modalTitle: t('settings.data.nutstore.backup.modal.title'), + filenamePlaceholder: t('settings.data.nutstore.backup.modal.filename.placeholder') + }} /> { webdavPath: storagePath }} 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') + }} />