mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 10:22:29 +08:00
i18n: Translate protected session
This commit is contained in:
parent
26e4decaec
commit
ae593ea363
@ -6,6 +6,7 @@ import appContext from "../components/app_context.js";
|
||||
import froca from "./froca.js";
|
||||
import utils from "./utils.js";
|
||||
import options from "./options.js";
|
||||
import { t } from './i18n.js';
|
||||
|
||||
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}`);
|
||||
}
|
||||
|
||||
function makeToast(message, protectingLabel, text) {
|
||||
function makeToast(message, title, text) {
|
||||
return {
|
||||
id: message.taskId,
|
||||
title: `${protectingLabel} status`,
|
||||
title,
|
||||
message: text,
|
||||
icon: message.data.protect ? "check-shield" : "shield"
|
||||
};
|
||||
@ -99,15 +100,19 @@ ws.subscribeToMessages(async message => {
|
||||
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') {
|
||||
toastService.closePersistent(message.taskId);
|
||||
toastService.showError(message.message);
|
||||
} 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') {
|
||||
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;
|
||||
|
||||
toastService.showPersistent(toast);
|
||||
|
@ -926,7 +926,13 @@
|
||||
"enter_password_instruction": "Showing protected note requires entering your password:",
|
||||
"start_session_button": "Start protected session",
|
||||
"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": {
|
||||
"open_in_new_tab": "Open in new tab",
|
||||
|
@ -908,7 +908,13 @@
|
||||
"enter_password_instruction": "Afișarea notițelor protejate necesită introducerea parolei:",
|
||||
"start_session_button": "Deschide sesiunea protejată",
|
||||
"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": {
|
||||
"close_label": "Închide",
|
||||
|
Loading…
x
Reference in New Issue
Block a user