mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	i18n: Translate protected session
This commit is contained in:
		| @@ -6,6 +6,7 @@ import appContext from "../components/app_context.js"; | |||||||
| import froca from "./froca.js"; | import froca from "./froca.js"; | ||||||
| import utils from "./utils.js"; | import utils from "./utils.js"; | ||||||
| import options from "./options.js"; | import options from "./options.js"; | ||||||
|  | import { t } from './i18n.js'; | ||||||
|  |  | ||||||
| let protectedSessionDeferred = null; | let protectedSessionDeferred = null; | ||||||
|  |  | ||||||
| @@ -85,10 +86,10 @@ async function protectNote(noteId, protect, includingSubtree) { | |||||||
|     await server.put(`notes/${noteId}/protect/${protect ? 1 : 0}?subtree=${includingSubtree ? 1 : 0}`); |     await server.put(`notes/${noteId}/protect/${protect ? 1 : 0}?subtree=${includingSubtree ? 1 : 0}`); | ||||||
| } | } | ||||||
|  |  | ||||||
| function makeToast(message, protectingLabel, text) { | function makeToast(message, title, text) { | ||||||
|     return { |     return { | ||||||
|         id: message.taskId, |         id: message.taskId, | ||||||
|         title: `${protectingLabel} status`, |         title, | ||||||
|         message: text, |         message: text, | ||||||
|         icon: message.data.protect ? "check-shield" : "shield" |         icon: message.data.protect ? "check-shield" : "shield" | ||||||
|     }; |     }; | ||||||
| @@ -99,15 +100,19 @@ ws.subscribeToMessages(async message => { | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     const protectingLabel = message.data.protect ? "Protecting" : "Unprotecting"; |     const isProtecting = message.data.protect; | ||||||
|  |     const title = isProtecting ? t("protected_session.protecting-title") : t("protected_session.unprotecting-title"); | ||||||
|      |      | ||||||
|     if (message.type === 'taskError') { |     if (message.type === 'taskError') { | ||||||
|         toastService.closePersistent(message.taskId); |         toastService.closePersistent(message.taskId); | ||||||
|         toastService.showError(message.message); |         toastService.showError(message.message); | ||||||
|     } else if (message.type === 'taskProgressCount') { |     } else if (message.type === 'taskProgressCount') { | ||||||
|         toastService.showPersistent(makeToast(message, protectingLabel,`${protectingLabel} in progress: ${message.progressCount}`)); |         const count = message.progressCount; | ||||||
|  |         const text = ( isProtecting ? t("protected_session.protecting-in-progress", { count }) : t("protected_session.unprotecting-in-progress-count", { count })); | ||||||
|  |         toastService.showPersistent(makeToast(message, title, text)); | ||||||
|     } else if (message.type === 'taskSucceeded') { |     } else if (message.type === 'taskSucceeded') { | ||||||
|         const toast = makeToast(message, protectingLabel, `${protectingLabel} finished successfully.`); |         const text = (isProtecting ? t("protected_session.protecting-finished-successfully") : t("protected_session.unprotecting-finished-successfully")) | ||||||
|  |         const toast = makeToast(message, title, text); | ||||||
|         toast.closeAfter = 3000; |         toast.closeAfter = 3000; | ||||||
|  |  | ||||||
|         toastService.showPersistent(toast); |         toastService.showPersistent(toast); | ||||||
|   | |||||||
| @@ -926,7 +926,13 @@ | |||||||
|     "enter_password_instruction": "Showing protected note requires entering your password:", |     "enter_password_instruction": "Showing protected note requires entering your password:", | ||||||
|     "start_session_button": "Start protected session", |     "start_session_button": "Start protected session", | ||||||
|     "started": "Protected session has been started.", |     "started": "Protected session has been started.", | ||||||
|     "wrong_password": "Wrong password." |     "wrong_password": "Wrong password.", | ||||||
|  |     "protecting-finished-successfully": "Protecting finished successfully.", | ||||||
|  |     "unprotecting-finished-successfully": "Unprotecting finished successfully.", | ||||||
|  |     "protecting-in-progress": "Protecting in progress: {{count}}", | ||||||
|  |     "unprotecting-in-progress-count": "Unprotecting in progress: {{count}}", | ||||||
|  |     "protecting-title": "Protecting status", | ||||||
|  |     "unprotecting-title": "Unprotecting status" | ||||||
|   }, |   }, | ||||||
|   "relation_map": { |   "relation_map": { | ||||||
|     "open_in_new_tab": "Open in new tab", |     "open_in_new_tab": "Open in new tab", | ||||||
|   | |||||||
| @@ -908,7 +908,13 @@ | |||||||
|     "enter_password_instruction": "Afișarea notițelor protejate necesită introducerea parolei:", |     "enter_password_instruction": "Afișarea notițelor protejate necesită introducerea parolei:", | ||||||
|     "start_session_button": "Deschide sesiunea protejată", |     "start_session_button": "Deschide sesiunea protejată", | ||||||
|     "started": "Sesiunea protejată este activă.", |     "started": "Sesiunea protejată este activă.", | ||||||
|     "wrong_password": "Parolă greșită." |     "wrong_password": "Parolă greșită.", | ||||||
|  |     "protecting-finished-successfully": "Protejarea a avut succes.", | ||||||
|  |     "protecting-in-progress": "Protejare în curs: {{count}}", | ||||||
|  |     "protecting-title": "Stare protejare", | ||||||
|  |     "unprotecting-title": "Stare deprotejare", | ||||||
|  |     "unprotecting-finished-successfully": "Deprotejarea a avut succes.", | ||||||
|  |     "unprotecting-in-progress-count": "Deprotejare în curs: {{count}}" | ||||||
|   }, |   }, | ||||||
|   "protected_session_password": { |   "protected_session_password": { | ||||||
|     "close_label": "Închide", |     "close_label": "Închide", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user