i18n: Translate protected session

This commit is contained in:
Elian Doran 2024-10-20 02:34:33 +03:00
parent 26e4decaec
commit ae593ea363
No known key found for this signature in database
3 changed files with 25 additions and 8 deletions

View File

@ -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);

View File

@ -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",

View File

@ -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",