i18n: Translate confirmation popups

This commit is contained in:
Elian Doran 2024-10-20 10:49:50 +03:00
parent ae593ea363
commit 8cc487da7c
No known key found for this signature in database
7 changed files with 31 additions and 13 deletions

View File

@ -3,6 +3,7 @@ import froca from "../services/froca.js";
import contextMenu from "./context_menu.js"; import contextMenu from "./context_menu.js";
import dialogService from "../services/dialog.js"; import dialogService from "../services/dialog.js";
import server from "../services/server.js"; import server from "../services/server.js";
import { t } from '../services/i18n.js';
export default class LauncherContextMenu { export default class LauncherContextMenu {
/** /**
@ -53,9 +54,7 @@ export default class LauncherContextMenu {
async selectMenuItemHandler({command}) { async selectMenuItemHandler({command}) {
if (command === 'resetLauncher') { if (command === 'resetLauncher') {
const confirmed = await dialogService.confirm(`Do you really want to reset "${this.node.title}"? const confirmed = await dialogService.confirm(t("launcher_context_menu.reset_launcher_confirm", { title: this.node.title }));
All data / settings in this note (and its children) will be lost
and the launcher will be returned to its original location.`);
if (confirmed) { if (confirmed) {
await server.post(`special-notes/launchers/${this.node.data.noteId}/reset`); await server.post(`special-notes/launchers/${this.node.data.noteId}/reset`);

View File

@ -136,7 +136,7 @@ export default class TreeContextMenu {
this.treeWidget.triggerCommand("openNewNoteSplit", {ntxId, notePath}); this.treeWidget.triggerCommand("openNewNoteSplit", {ntxId, notePath});
} }
else if (command === 'convertNoteToAttachment') { else if (command === 'convertNoteToAttachment') {
if (!await dialogService.confirm(`Are you sure you want to convert note selected notes into attachments of their parent notes?`)) { if (!await dialogService.confirm(t("tree-context-menu.convert-to-attachment-confirm"))) {
return; return;
} }

View File

@ -2,6 +2,7 @@ import appContext from "../components/app_context.js";
import treeService from "./tree.js"; import treeService from "./tree.js";
import dialogService from "./dialog.js"; import dialogService from "./dialog.js";
import froca from "./froca.js"; import froca from "./froca.js";
import { t } from "./i18n.js";
function getHoistedNoteId() { function getHoistedNoteId() {
const activeNoteContext = appContext.tabManager.getActiveContext(); const activeNoteContext = appContext.tabManager.getActiveContext();
@ -53,7 +54,7 @@ async function checkNoteAccess(notePath, noteContext) {
const hoistedNote = await froca.getNote(hoistedNoteId); const hoistedNote = await froca.getNote(hoistedNoteId);
if ((!hoistedNote.hasAncestor('_hidden') || resolvedNotePath.includes('_lbBookmarks')) if ((!hoistedNote.hasAncestor('_hidden') || resolvedNotePath.includes('_lbBookmarks'))
&& !await dialogService.confirm(`Requested note '${requestedNote.title}' is outside of hoisted note '${hoistedNote.title}' subtree and you must unhoist to access the note. Do you want to proceed with unhoisting?`)) { && !await dialogService.confirm(t("hoisted_note.confirm_unhoisting", { requestedNote: requestedNote.title, hoistedNote: hoistedNote.title }))) {
return false; return false;
} }

View File

@ -127,7 +127,7 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
} }
async convertNoteIntoAttachmentCommand() { async convertNoteIntoAttachmentCommand() {
if (!await dialogService.confirm(`Are you sure you want to convert note '${this.note.title}' into an attachment of the parent note?`)) { if (!await dialogService.confirm(t("note_actions.convert_into_attachment_prompt", { title: this.note.title }))) {
return; return;
} }

View File

@ -159,7 +159,7 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
return true; return true;
} }
return await dialogService.confirm("It is not recommended to change note type when note content is not empty. Do you want to continue anyway?"); return await dialogService.confirm(t("note_types.confirm-change"));
} }
async entitiesReloadedEvent({ loadResults }) { async entitiesReloadedEvent({ loadResults }) {

View File

@ -635,7 +635,8 @@
"print_note": "Print note", "print_note": "Print note",
"save_revision": "Save revision", "save_revision": "Save revision",
"convert_into_attachment_failed": "Converting note '{{title}}' failed.", "convert_into_attachment_failed": "Converting note '{{title}}' failed.",
"convert_into_attachment_successful": "Note '{{title}' has been converted to attachment." "convert_into_attachment_successful": "Note '{{title}' has been converted to attachment.",
"convert_into_attachment_prompt": "Are you sure you want to convert note '{{title}}' into an attachment of the parent note?"
}, },
"onclick_button": { "onclick_button": {
"no_click_handler": "Button widget '{{componentId}}' has no defined click handler" "no_click_handler": "Button widget '{{componentId}}' has no defined click handler"
@ -1325,7 +1326,8 @@
"export": "Export", "export": "Export",
"import-into-note": "Import into note", "import-into-note": "Import into note",
"apply-bulk-actions": "Apply bulk actions", "apply-bulk-actions": "Apply bulk actions",
"converted-to-attachments": "{{count}} notes have been converted to attachments." "converted-to-attachments": "{{count}} notes have been converted to attachments.",
"convert-to-attachment-confirm": "Are you sure you want to convert note selected notes into attachments of their parent notes?"
}, },
"shared_info": { "shared_info": {
"shared_publicly": "This note is shared publicly on", "shared_publicly": "This note is shared publicly on",
@ -1348,7 +1350,8 @@
"image": "Image", "image": "Image",
"launcher": "Launcher", "launcher": "Launcher",
"doc": "Doc", "doc": "Doc",
"widget": "Widget" "widget": "Widget",
"confirm-change": "It is not recommended to change note type when note content is not empty. Do you want to continue anyway?"
}, },
"protect_note": { "protect_note": {
"toggle-on": "Protect the note", "toggle-on": "Protect the note",
@ -1468,5 +1471,11 @@
"sync-check-failed": "Sync check failed!", "sync-check-failed": "Sync check failed!",
"consistency-checks-failed": "Consistency checks failed! See logs for details.", "consistency-checks-failed": "Consistency checks failed! See logs for details.",
"encountered-error": "Encountered error \"{{message}}\", check out the console." "encountered-error": "Encountered error \"{{message}}\", check out the console."
},
"hoisted_note": {
"confirm_unhoisting": "Requested note '{{requestedNote}}' is outside of hoisted note '{{hoistedNote}}' subtree and you must unhoist to access the note. Do you want to proceed with unhoisting?"
},
"launcher_context_menu": {
"reset_launcher_confirm": "Do you really want to reset \"{{title}}\"? All data / settings in this note (and its children) will be lost and the launcher will be returned to its original location."
} }
} }

View File

@ -788,7 +788,8 @@
"save_revision": "Salvează o nouă revizie", "save_revision": "Salvează o nouă revizie",
"search_in_note": "Caută în notiță", "search_in_note": "Caută în notiță",
"convert_into_attachment_failed": "Nu s-a putut converti notița „{{title}}”.", "convert_into_attachment_failed": "Nu s-a putut converti notița „{{title}}”.",
"convert_into_attachment_successful": "Notița „{{title}}” a fost convertită în atașament." "convert_into_attachment_successful": "Notița „{{title}}” a fost convertită în atașament.",
"convert_into_attachment_prompt": "Doriți convertirea notiței „{{title}}” într-un atașament al notiței părinte?"
}, },
"note_erasure_timeout": { "note_erasure_timeout": {
"deleted_notes_erased": "Notițele șterse au fost eliminate permanent.", "deleted_notes_erased": "Notițele șterse au fost eliminate permanent.",
@ -1295,7 +1296,8 @@
"unprotect-subtree": "Deprotejează ierarhia", "unprotect-subtree": "Deprotejează ierarhia",
"hoist-note": "Focalizează notița", "hoist-note": "Focalizează notița",
"unhoist-note": "Defocalizează notița", "unhoist-note": "Defocalizează notița",
"converted-to-attachments": "{{count}} notițe au fost convertite în atașamente." "converted-to-attachments": "{{count}} notițe au fost convertite în atașamente.",
"convert-to-attachment-confirm": "Doriți convertirea notițelor selectate în atașamente ale notiței părinte?"
}, },
"shared_info": { "shared_info": {
"help_link": "Pentru informații vizitați <a href=\"https://triliumnext.github.io/Docs/Wiki/sharing.html\">wiki-ul</a>.", "help_link": "Pentru informații vizitați <a href=\"https://triliumnext.github.io/Docs/Wiki/sharing.html\">wiki-ul</a>.",
@ -1318,7 +1320,8 @@
"file": "Fișier", "file": "Fișier",
"image": "Imagine", "image": "Imagine",
"launcher": "Scurtătură", "launcher": "Scurtătură",
"widget": "Widget" "widget": "Widget",
"confirm-change": "Nu se recomandă schimbarea tipului notiței atunci când ea are un conținut. Procedați oricum?"
}, },
"protect_note": { "protect_note": {
"toggle-off": "Deprotejează notița", "toggle-off": "Deprotejează notița",
@ -1468,5 +1471,11 @@
"consistency-checks-failed": "Au fost identificate erori de consistență! Vedeți mai multe detalii în loguri.", "consistency-checks-failed": "Au fost identificate erori de consistență! Vedeți mai multe detalii în loguri.",
"encountered-error": "A fost întâmpinată o eroare: „{{message}}”. Vedeți în loguri pentru mai multe detalii.", "encountered-error": "A fost întâmpinată o eroare: „{{message}}”. Vedeți în loguri pentru mai multe detalii.",
"sync-check-failed": "Verificările de sincronizare au eșuat!" "sync-check-failed": "Verificările de sincronizare au eșuat!"
},
"hoisted_note": {
"confirm_unhoisting": "Notița dorită „{{requestedNote}}” este în afara ierarhiei notiței focalizate „{{hoistedNote}}”. Doriți defocalizarea pentru a accesa notița?"
},
"launcher_context_menu": {
"reset_launcher_confirm": "Doriți resetarea lansatorului „{{title}}”? Toate datele și setările din această notiță (și subnotițele ei) vor fi pierdute, iar lansatorul va fi resetat în poziția lui originală."
} }
} }