i18n: Translate toast messages

This commit is contained in:
Elian Doran 2024-10-20 02:06:08 +03:00
parent 93efce4023
commit 28f6712a4f
No known key found for this signature in database
11 changed files with 71 additions and 25 deletions

View File

@ -178,7 +178,7 @@ export default class Entrypoints extends Component {
await appContext.triggerEvent('sqlQueryResults', {ntxId: ntxId, results: resp.results}); await appContext.triggerEvent('sqlQueryResults', {ntxId: ntxId, results: resp.results});
} }
toastService.showMessage("Note executed"); toastService.showMessage(t("entrypoints.note-executed"));
} }
hideAllPopups() { hideAllPopups() {
@ -200,6 +200,6 @@ export default class Entrypoints extends Component {
await server.post(`notes/${noteId}/revision`); await server.post(`notes/${noteId}/revision`);
toastService.showMessage("Note revision has been created."); toastService.showMessage(t("entrypoints.note-revision-created"));
} }
} }

View File

@ -154,7 +154,7 @@ export default class TreeContextMenu {
} }
} }
toastService.showMessage(`${converted} notes have been converted to attachments.`); toastService.showMessage(t("tree-context-menu.converted-to-attachments", { count: converted }));
} }
else if (command === 'copyNotePathToClipboard') { else if (command === 'copyNotePathToClipboard') {
navigator.clipboard.writeText('#' + notePath); navigator.clipboard.writeText('#' + notePath);

View File

@ -78,7 +78,7 @@ async function copy(branchIds) {
clipboard.writeHTML(links.join(', ')); clipboard.writeHTML(links.join(', '));
} }
toastService.showMessage("Note(s) have been copied into clipboard."); toastService.showMessage(t("clipboard.copied"));
} }
function cut(branchIds) { function cut(branchIds) {
@ -87,7 +87,7 @@ function cut(branchIds) {
if (clipboardBranchIds.length > 0) { if (clipboardBranchIds.length > 0) {
clipboardMode = 'cut'; clipboardMode = 'cut';
toastService.showMessage("Note(s) have been cut into clipboard."); toastService.showMessage(t("clipboard.cut"));
} }
} }

View File

@ -8,9 +8,9 @@ function copyImageReferenceToClipboard($imageWrapper) {
const success = document.execCommand('copy'); const success = document.execCommand('copy');
if (success) { if (success) {
toastService.showMessage("A reference to the image has been copied to clipboard. This can be pasted in any text note."); toastService.showMessage(t("image.copied-to-clipboard"));
} else { } else {
toastService.showAndLogError("Could not copy the image reference to clipboard."); toastService.showAndLogError(t("image.cannot-copy"));
} }
} }
finally { finally {

View File

@ -119,7 +119,7 @@ async function duplicateSubtree(noteId, parentNotePath) {
activeNoteContext.setNote(`${parentNotePath}/${note.noteId}`); activeNoteContext.setNote(`${parentNotePath}/${note.noteId}`);
const origNote = await froca.getNote(noteId); const origNote = await froca.getNote(noteId);
toastService.showMessage(`Note "${origNote.title}" has been duplicated`); toastService.showMessage(t("note_create.duplicated", { title: origNote.title }));
} }
export default { export default {

View File

@ -72,7 +72,7 @@ ws.subscribeToMessages(async message => {
protectedSessionDeferred = null; protectedSessionDeferred = null;
} }
toastService.showMessage("Protected session has been started."); toastService.showMessage(t("protected_session.started"));
} }
else if (message.type === 'protectedSessionLogout') { else if (message.type === 'protectedSessionLogout') {
utils.reloadFrontendApp(`Protected session logout`); utils.reloadFrontendApp(`Protected session logout`);

View File

@ -5,7 +5,7 @@ async function syncNow(ignoreNotConfigured = false) {
const result = await server.post('sync/now'); const result = await server.post('sync/now');
if (result.success) { if (result.success) {
toastService.showMessage("Sync finished successfully."); toastService.showMessage(t("sync.finished-successfully"));
} }
else { else {
if (result.message.length > 200) { if (result.message.length > 200) {
@ -13,7 +13,7 @@ async function syncNow(ignoreNotConfigured = false) {
} }
if (!ignoreNotConfigured || result.errorCode !== 'NOT_CONFIGURED') { if (!ignoreNotConfigured || result.errorCode !== 'NOT_CONFIGURED') {
toastService.showError(`Sync failed: ${result.message}`); toastService.showError(t("sync.failed", { message: result.message }));
} }
} }
} }

View File

@ -134,11 +134,11 @@ export default class NoteActionsWidget extends NoteContextAwareWidget {
const {attachment: newAttachment} = await server.post(`notes/${this.noteId}/convert-to-attachment`); const {attachment: newAttachment} = await server.post(`notes/${this.noteId}/convert-to-attachment`);
if (!newAttachment) { if (!newAttachment) {
toastService.showMessage(`Converting note '${this.note.title}' failed.`); toastService.showMessage(t("note_actions.convert_into_attachment_failed", { title: this.note.title }));
return; return;
} }
toastService.showMessage(`Note '${newAttachment.title}' has been converted to attachment.`); toastService.showMessage(t("note_actions.convert_into_attachment_successful", { title: newAttachment.title }));
await ws.waitForMaxKnownEntityChangeId(); await ws.waitForMaxKnownEntityChangeId();
await appContext.tabManager.getActiveContext().setNote(newAttachment.ownerId, { await appContext.tabManager.getActiveContext().setNote(newAttachment.ownerId, {
viewScope: { viewScope: {

View File

@ -1031,7 +1031,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
activeNode.load(true); activeNode.load(true);
activeNode.setExpanded(true, {noAnimation: true}); activeNode.setExpanded(true, {noAnimation: true});
toastService.showMessage("Saved search note refreshed."); toastService.showMessage(t("note_tree.saved-search-note-refreshed"));
} }
async batchUpdate(cb) { async batchUpdate(cb) {
@ -1075,7 +1075,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
node.setExpanded(false); node.setExpanded(false);
if (noneCollapsedYet) { if (noneCollapsedYet) {
toastService.showMessage("Auto collapsing notes after inactivity..."); toastService.showMessage(t("note_tree.auto-collapsing-notes-after-inactivity"));
noneCollapsedYet = false; noneCollapsedYet = false;
} }
} }

View File

@ -632,7 +632,9 @@
"export_note": "Export note", "export_note": "Export note",
"delete_note": "Delete note", "delete_note": "Delete note",
"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_successful": "Note '{{title}' has been converted to attachment."
}, },
"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"
@ -921,7 +923,8 @@
}, },
"protected_session": { "protected_session": {
"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."
}, },
"relation_map": { "relation_map": {
"open_in_new_tab": "Open in new tab", "open_in_new_tab": "Open in new tab",
@ -992,7 +995,9 @@
"fill_entity_changes_button": "Fill entity changes records", "fill_entity_changes_button": "Fill entity changes records",
"full_sync_triggered": "Full sync triggered", "full_sync_triggered": "Full sync triggered",
"filling_entity_changes": "Filling entity changes rows...", "filling_entity_changes": "Filling entity changes rows...",
"sync_rows_filled_successfully": "Sync rows filled successfully" "sync_rows_filled_successfully": "Sync rows filled successfully",
"finished-successfully": "Sync finished successfully.",
"failed": "Sync failed: {{message}}"
}, },
"vacuum_database": { "vacuum_database": {
"title": "Vacuum Database", "title": "Vacuum Database",
@ -1311,7 +1316,8 @@
"duplicate-subtree": "Duplicate subtree", "duplicate-subtree": "Duplicate subtree",
"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."
}, },
"shared_info": { "shared_info": {
"shared_publicly": "This note is shared publicly on", "shared_publicly": "This note is shared publicly on",
@ -1380,7 +1386,9 @@
"hide-archived-notes": "Hide archived notes", "hide-archived-notes": "Hide archived notes",
"automatically-collapse-notes": "Automatically collapse notes", "automatically-collapse-notes": "Automatically collapse notes",
"automatically-collapse-notes-title": "Notes will be collapsed after period of inactivity to declutter the tree.", "automatically-collapse-notes-title": "Notes will be collapsed after period of inactivity to declutter the tree.",
"save-changes": "Save & apply changes" "save-changes": "Save & apply changes",
"auto-collapsing-notes-after-inactivity": "Auto collapsing notes after inactivity...",
"saved-search-note-refreshed": "Saved search note refreshed."
}, },
"title_bar_buttons": { "title_bar_buttons": {
"window-on-top": "Keep this window on top." "window-on-top": "Keep this window on top."
@ -1424,5 +1432,20 @@
}, },
"app_context": { "app_context": {
"please_wait_for_save": "Please wait for a couple of seconds for the save to finish, then you can try again." "please_wait_for_save": "Please wait for a couple of seconds for the save to finish, then you can try again."
},
"note_create": {
"duplicated": "Note \"{{title}}\" has been duplicated."
},
"image": {
"copied-to-clipboard": "A reference to the image has been copied to clipboard. This can be pasted in any text note.",
"cannot-copy": "Could not copy the image reference to clipboard."
},
"clipboard": {
"cut": "Note(s) have been cut into clipboard.",
"copied": "Note(s) have been copied into clipboard."
},
"entrypoints": {
"note-revision-created": "Note revision has been created.",
"note-executed": "Note executed."
} }
} }

View File

@ -785,7 +785,9 @@
"print_note": "Imprimare notiță", "print_note": "Imprimare notiță",
"re_render_note": "Reinterpretare notiță", "re_render_note": "Reinterpretare notiță",
"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_successful": "Notița „{{title}}” a fost convertită în atașament."
}, },
"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.",
@ -903,7 +905,8 @@
}, },
"protected_session": { "protected_session": {
"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ă."
}, },
"protected_session_password": { "protected_session_password": {
"close_label": "Închide", "close_label": "Închide",
@ -1134,7 +1137,9 @@
"force_full_sync_button": "Forțează sincronizare completă", "force_full_sync_button": "Forțează sincronizare completă",
"full_sync_triggered": "S-a activat o sincronizare completă", "full_sync_triggered": "S-a activat o sincronizare completă",
"sync_rows_filled_successfully": "Rândurile de sincronizare s-au completat cu succes", "sync_rows_filled_successfully": "Rândurile de sincronizare s-au completat cu succes",
"title": "Sincronizare" "title": "Sincronizare",
"failed": "Eroare la sincronizare: {{message}}",
"finished-successfully": "Sincronizarea a avut succes."
}, },
"sync_2": { "sync_2": {
"config_title": "Configurația sincronizării", "config_title": "Configurația sincronizării",
@ -1281,7 +1286,8 @@
"sort-by": "Ordonare după...", "sort-by": "Ordonare după...",
"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."
}, },
"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>.",
@ -1370,7 +1376,9 @@
"hide-archived-notes": "Ascunde notițele arhivate", "hide-archived-notes": "Ascunde notițele arhivate",
"save-changes": "Salvează și aplică modificările", "save-changes": "Salvează și aplică modificările",
"scroll-active-title": "Mergi la notița activă", "scroll-active-title": "Mergi la notița activă",
"tree-settings-title": "Setări ale ierarhiei notițelor" "tree-settings-title": "Setări ale ierarhiei notițelor",
"auto-collapsing-notes-after-inactivity": "Se minimizează notițele după inactivitate...",
"saved-search-note-refreshed": "Notița de căutare salvată a fost reîmprospătată."
}, },
"title_bar_buttons": { "title_bar_buttons": {
"window-on-top": "Menține fereastra mereu vizibilă" "window-on-top": "Menține fereastra mereu vizibilă"
@ -1424,5 +1432,20 @@
"file_last_modified": "Fișierul <code class=\"file-path\"></code> a fost ultima oară modificat la data de <span class=\"file-last-modified\"></span>.", "file_last_modified": "Fișierul <code class=\"file-path\"></code> a fost ultima oară modificat la data de <span class=\"file-last-modified\"></span>.",
"ignore_this_change": "Ignoră această schimbare", "ignore_this_change": "Ignoră această schimbare",
"upload_modified_file": "Încarcă fișier modificat" "upload_modified_file": "Încarcă fișier modificat"
},
"clipboard": {
"copied": "Notițele au fost copiate în clipboard.",
"cut": "Notițele au fost decupate în clipboard."
},
"entrypoints": {
"note-executed": "Notița a fost executată.",
"note-revision-created": "S-a creat o revizie a notiței."
},
"image": {
"cannot-copy": "Nu s-a putut copia în clipboard referința către imagine.",
"copied-to-clipboard": "S-a copiat o referință către imagine în clipboard. Aceasta se poate lipi în orice notiță text."
},
"note_create": {
"duplicated": "Notița „{{title}}” a fost dublificată."
} }
} }