translate some dialogs

This commit is contained in:
Nriver 2024-07-22 17:31:54 +08:00
parent e284ea945c
commit cb9b4c07e5
6 changed files with 135 additions and 35 deletions

View File

@ -1,3 +1,4 @@
import { t } from "../../services/i18n.js";
import treeService from '../../services/tree.js'; import treeService from '../../services/tree.js';
import noteAutocompleteService from "../../services/note_autocomplete.js"; import noteAutocompleteService from "../../services/note_autocomplete.js";
import utils from "../../services/utils.js"; import utils from "../../services/utils.js";
@ -8,21 +9,21 @@ const TPL = `
<div class="modal-dialog modal-lg" style="max-width: 1000px" role="document"> <div class="modal-dialog modal-lg" style="max-width: 1000px" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title mr-auto">Add link</h5> <h5 class="modal-title mr-auto">${t('add_link.add_link')}</h5>
<button type="button" class="help-button" title="Help on links" data-help-page="Links">?</button> <button type="button" class="help-button" title="${t('add_link.help_on_links')}" data-help-page="Links">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;"> <button type="button" class="close" data-dismiss="modal" aria-label="${t('add_link.close')}" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<form class="add-link-form"> <form class="add-link-form">
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="add-link-note-autocomplete">Note</label> <label for="add-link-note-autocomplete">${t('add_link.note')}</label>
<div class="input-group"> <div class="input-group">
<input class="add-link-note-autocomplete form-control" placeholder="search for note by its name"> <input class="add-link-note-autocomplete form-control" placeholder="${t('add_link.search_note')}">
</div> </div>
</div> </div>
@ -30,20 +31,20 @@ const TPL = `
<div class="add-link-title-radios form-check"> <div class="add-link-title-radios form-check">
<label class="form-check-label"> <label class="form-check-label">
<input class="form-check-input" type="radio" name="link-type" value="reference-link" checked> <input class="form-check-input" type="radio" name="link-type" value="reference-link" checked>
link title mirrors the note's current title ${t('add_link.link_title_mirrors')}
</label> </label>
</div> </div>
<div class="add-link-title-radios form-check"> <div class="add-link-title-radios form-check">
<label class="form-check-label"> <label class="form-check-label">
<input class="form-check-input" type="radio" name="link-type" value="hyper-link"> <input class="form-check-input" type="radio" name="link-type" value="hyper-link">
link title can be changed arbitrarily ${t('add_link.link_title_arbitrary')}
</label> </label>
</div> </div>
<div class="add-link-title-form-group form-group"> <div class="add-link-title-form-group form-group">
<br/> <br/>
<label> <label>
Link title ${t('add_link.link_title')}
<input class="link-title form-control" style="width: 100%;"> <input class="link-title form-control" style="width: 100%;">
</label> </label>
@ -51,7 +52,7 @@ const TPL = `
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary">Add link <kbd>enter</kbd></button> <button type="submit" class="btn btn-primary">${t('add_link.add_link')} <kbd>enter</kbd></button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -5,6 +5,7 @@ import toastService from "../../services/toast.js";
import utils from "../../services/utils.js"; import utils from "../../services/utils.js";
import BasicWidget from "../basic_widget.js"; import BasicWidget from "../basic_widget.js";
import appContext from "../../components/app_context.js"; import appContext from "../../components/app_context.js";
import { t } from "../../services/i18n.js";
let branchId; let branchId;
@ -13,17 +14,17 @@ const TPL = `<div class="branch-prefix-dialog modal fade mx-auto" tabindex="-1"
<form class="branch-prefix-form"> <form class="branch-prefix-form">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title mr-auto">Edit branch prefix</h5> <h5 class="modal-title mr-auto">${t('branch_prefix.edit_branch_prefix')}</h5>
<button class="help-button" type="button" data-help-page="Tree-concepts#prefix" title="Help on Tree prefix">?</button> <button class="help-button" type="button" data-help-page="Tree-concepts#prefix" title="${t('branch_prefix.help_on_tree_prefix')}">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0;"> <button type="button" class="close" data-dismiss="modal" aria-label="${t('branch_prefix.close')}" style="margin-left: 0;">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="branch-prefix-input">Prefix: </label> &nbsp; <label for="branch-prefix-input">${t('branch_prefix.prefix')}</label> &nbsp;
<div class="input-group"> <div class="input-group">
<input class="branch-prefix-input form-control"> <input class="branch-prefix-input form-control">
@ -35,7 +36,7 @@ const TPL = `<div class="branch-prefix-dialog modal fade mx-auto" tabindex="-1"
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button class="btn btn-primary btn-sm">Save</button> <button class="btn btn-primary btn-sm">${t('branch_prefix.save')}</button>
</div> </div>
</div> </div>
</form> </form>
@ -100,6 +101,6 @@ export default class BranchPrefixDialog extends BasicWidget {
this.$widget.modal('hide'); this.$widget.modal('hide');
toastService.showMessage("Branch prefix has been saved."); toastService.showMessage(t('branch_prefix.branch_prefix_saved'));
} }
} }

View File

@ -4,6 +4,7 @@ import bulkActionService from "../../services/bulk_action.js";
import utils from "../../services/utils.js"; import utils from "../../services/utils.js";
import server from "../../services/server.js"; import server from "../../services/server.js";
import toastService from "../../services/toast.js"; import toastService from "../../services/toast.js";
import { t } from "../../services/i18n.js";
const TPL = ` const TPL = `
<div class="bulk-actions-dialog modal mx-auto" tabindex="-1" role="dialog"> <div class="bulk-actions-dialog modal mx-auto" tabindex="-1" role="dialog">
@ -37,32 +38,32 @@ const TPL = `
<div class="modal-dialog modal-xl" role="document"> <div class="modal-dialog modal-xl" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title mr-auto">Bulk actions</h5> <h5 class="modal-title mr-auto">${t('bulk_actions.bulk_actions')}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;"> <button type="button" class="close" data-dismiss="modal" aria-label="${t('bulk_actions.close')}">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<h4>Affected notes: <span class="affected-note-count">0</span></h4> <h4>${t('bulk_actions.affected_notes')}: <span class="affected-note-count">0</span></h4>
<div class="form-check"> <div class="form-check">
<label class="form-check-label"> <label class="form-check-label">
<input class="include-descendants form-check-input" type="checkbox" value=""> <input class="include-descendants form-check-input" type="checkbox" value="">
Include descendants of the selected notes ${t('bulk_actions.include_descendants')}
</label> </label>
</div> </div>
<h4>Available actions</h4> <h4>${t('bulk_actions.available_actions')}</h4>
<table class="bulk-available-action-list"></table> <table class="bulk-available-action-list"></table>
<h4>Chosen actions</h4> <h4>${t('bulk_actions.chosen_actions')}</h4>
<table class="bulk-existing-action-list"></table> <table class="bulk-existing-action-list"></table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="execute-bulk-actions btn btn-primary">Execute bulk actions</button> <button type="submit" class="execute-bulk-actions btn btn-primary">${t('bulk_actions.execute_bulk_actions')}</button>
</div> </div>
</div> </div>
</div> </div>
@ -95,7 +96,7 @@ export default class BulkActionsDialog extends BasicWidget {
includeDescendants: this.$includeDescendants.is(":checked") includeDescendants: this.$includeDescendants.is(":checked")
}); });
toastService.showMessage("Bulk actions have been executed successfully.", 3000); toastService.showMessage(t('bulk_actions.bulk_actions_executed'), 3000);
utils.closeActiveDialog(); utils.closeActiveDialog();
}); });
@ -120,7 +121,7 @@ export default class BulkActionsDialog extends BasicWidget {
if (actions.length > 0) { if (actions.length > 0) {
this.$existingActionList.append(...actions.map(action => action.render())); this.$existingActionList.append(...actions.map(action => action.render()));
} else { } else {
this.$existingActionList.append($("<p>None yet ... add an action by clicking one of the available ones above.</p>")) this.$existingActionList.append($("<p>").text(t('bulk_actions.none_yet')))
} }
} }

View File

@ -6,15 +6,16 @@ import froca from "../../services/froca.js";
import branchService from "../../services/branches.js"; import branchService from "../../services/branches.js";
import appContext from "../../components/app_context.js"; import appContext from "../../components/app_context.js";
import BasicWidget from "../basic_widget.js"; import BasicWidget from "../basic_widget.js";
import { t } from "../../services/i18n.js"; // Added import for i18n
const TPL = ` const TPL = `
<div class="clone-to-dialog modal mx-auto" tabindex="-1" role="dialog"> <div class="clone-to-dialog modal mx-auto" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" style="max-width: 1000px" role="document"> <div class="modal-dialog modal-lg" style="max-width: 1000px" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title mr-auto">Clone notes to ...</h5> <h5 class="modal-title mr-auto">${t('clone_to.clone_notes_to')}</h5>
<button type="button" class="help-button" title="Help on links" data-help-page="Cloning-notes">?</button> <button type="button" class="help-button" title="${t('clone_to.help_on_links')}" data-help-page="Cloning-notes">?</button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;"> <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-left: 0 !important;">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
@ -22,28 +23,28 @@ const TPL = `
</div> </div>
<form class="clone-to-form"> <form class="clone-to-form">
<div class="modal-body"> <div class="modal-body">
<h5>Notes to clone</h5> <h5>${t('clone_to.notes_to_clone')}</h5>
<ul class="clone-to-note-list" style="max-height: 200px; overflow: auto;"></ul> <ul class="clone-to-note-list" style="max-height: 200px; overflow: auto;"></ul>
<div class="form-group"> <div class="form-group">
<label style="width: 100%"> <label style="width: 100%">
Target parent note ${t('clone_to.target_parent_note')}
<div class="input-group"> <div class="input-group">
<input class="clone-to-note-autocomplete form-control" placeholder="search for note by its name"> <input class="clone-to-note-autocomplete form-control" placeholder="${t('clone_to.search_for_note_by_its_name')}">
</div> </div>
</label> </label>
</div> </div>
<div class="form-group" title="Cloned note will be shown in note tree with given prefix"> <div class="form-group" title="${t('clone_to.cloned_note_prefix_title')}">
<label style="width: 100%"> <label style="width: 100%">
Prefix (optional) ${t('clone_to.prefix_optional')}
<input class="clone-prefix form-control" style="width: 100%;"> <input class="clone-prefix form-control" style="width: 100%;">
</label> </label>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary">Clone to selected note <kbd>enter</kbd></button> <button type="submit" class="btn btn-primary">${t('clone_to.clone_to_selected_note')} <kbd>enter</kbd></button>
</div> </div>
</form> </form>
</div> </div>
@ -73,7 +74,7 @@ export default class CloneToDialog extends BasicWidget {
this.cloneNotesTo(notePath); this.cloneNotesTo(notePath);
} }
else { else {
logError("No path to clone to."); logError(t('clone_to.no_path_to_clone_to'));
} }
return false; return false;
@ -119,7 +120,7 @@ export default class CloneToDialog extends BasicWidget {
const clonedNote = await froca.getNote(cloneNoteId); const clonedNote = await froca.getNote(cloneNoteId);
const targetNote = await froca.getBranch(targetBranchId).getNote(); const targetNote = await froca.getBranch(targetBranchId).getNote();
toastService.showMessage(`Note "${clonedNote.title}" has been cloned into ${targetNote.title}`); toastService.showMessage(t('clone_to.note_cloned', {clonedTitle: clonedNote.title, targetTitle: targetNote.title}));
} }
} }
} }

View File

@ -0,0 +1,54 @@
{
"about": {
"title": "关于 TriliumNext Notes",
"homepage": "项目主页:",
"app_version": "应用版本:",
"db_version": "数据库版本:",
"sync_version": "同步版本:",
"build_date": "构建日期:",
"build_revision": "构建修订版:",
"data_directory": "数据目录:"
},
"add_link": {
"add_link": "添加链接",
"help_on_links": "链接帮助",
"close": "关闭",
"note": "笔记",
"search_note": "按名称搜索笔记",
"link_title_mirrors": "链接标题与笔记当前标题同步",
"link_title_arbitrary": "链接标题可以任意更改",
"link_title": "链接标题"
},
"branch_prefix": {
"edit_branch_prefix": "编辑分支前缀",
"help_on_tree_prefix": "树前缀帮助",
"close": "关闭",
"prefix": "前缀:",
"save": "保存",
"branch_prefix_saved": "分支前缀已保存。"
},
"bulk_actions": {
"bulk_actions": "批量操作",
"close": "关闭",
"affected_notes": "受影响的笔记",
"include_descendants": "包括所选笔记的后代",
"available_actions": "可用操作",
"chosen_actions": "选择的操作",
"execute_bulk_actions": "执行批量操作",
"bulk_actions_executed": "批量操作已成功执行。",
"none_yet": "暂无操作 ... 通过点击上方的可用操作添加一个操作。"
},
"clone_to": {
"clone_notes_to": "克隆笔记到...",
"help_on_links": "链接帮助",
"notes_to_clone": "要克隆的笔记",
"target_parent_note": "目标父笔记",
"search_for_note_by_its_name": "按名称搜索笔记",
"cloned_note_prefix_title": "克隆的笔记将在笔记树中显示给定的前缀",
"prefix_optional": "前缀(可选)",
"clone_to_selected_note": "克隆到选定的笔记",
"no_path_to_clone_to": "没有克隆路径。",
"note_cloned": "笔记 \"{{clonedTitle}}\" 已克隆到 \"{{targetTitle}}\""
}
}

View File

@ -8,5 +8,47 @@
"build_date": "Build date:", "build_date": "Build date:",
"build_revision": "Build revision:", "build_revision": "Build revision:",
"data_directory": "Data directory:" "data_directory": "Data directory:"
},
"add_link": {
"add_link": "Add link",
"help_on_links": "Help on links",
"close": "Close",
"note": "Note",
"search_note": "search for note by its name",
"link_title_mirrors": "link title mirrors the note's current title",
"link_title_arbitrary": "link title can be changed arbitrarily",
"link_title": "Link title"
},
"branch_prefix": {
"edit_branch_prefix": "Edit branch prefix",
"help_on_tree_prefix": "Help on Tree prefix",
"close": "Close",
"prefix": "Prefix: ",
"save": "Save",
"branch_prefix_saved": "Branch prefix has been saved."
},
"bulk_actions": {
"bulk_actions": "Bulk actions",
"close": "Close",
"affected_notes": "Affected notes",
"include_descendants": "Include descendants of the selected notes",
"available_actions": "Available actions",
"chosen_actions": "Chosen actions",
"execute_bulk_actions": "Execute bulk actions",
"bulk_actions_executed": "Bulk actions have been executed successfully.",
"none_yet": "None yet ... add an action by clicking one of the available ones above."
},
"clone_to": {
"clone_notes_to": "Clone notes to ...",
"help_on_links": "Help on links",
"notes_to_clone": "Notes to clone",
"target_parent_note": "Target parent note",
"search_for_note_by_its_name": "search for note by its name",
"cloned_note_prefix_title": "Cloned note will be shown in note tree with given prefix",
"prefix_optional": "Prefix (optional)",
"clone_to_selected_note": "Clone to selected note",
"no_path_to_clone_to": "No path to clone to.",
"note_cloned": "Note \"{{clonedTitle}}\" has been cloned into \"{{targetTitle}}\""
} }
}
}