mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 02:02:29 +08:00
Merge pull request #491 from TriliumNext/feature/i18n-part6
Feature/i18n part6
This commit is contained in:
commit
d7eaf72a6d
@ -13,7 +13,7 @@ import MobileScreenSwitcherExecutor from "./mobile_screen_switcher.js";
|
||||
import MainTreeExecutors from "./main_tree_executors.js";
|
||||
import toast from "../services/toast.js";
|
||||
import ShortcutComponent from "./shortcut_component.js";
|
||||
import { initLocale } from "../services/i18n.js";
|
||||
import { t, initLocale } from "../services/i18n.js";
|
||||
|
||||
class AppContext extends Component {
|
||||
constructor(isMainWindow) {
|
||||
@ -33,11 +33,11 @@ class AppContext extends Component {
|
||||
await initLocale();
|
||||
}
|
||||
|
||||
setLayout(layout) {
|
||||
setLayout(layout) {
|
||||
this.layout = layout;
|
||||
}
|
||||
|
||||
async start() {
|
||||
async start() {
|
||||
this.initComponents();
|
||||
this.renderWidgets();
|
||||
|
||||
@ -151,7 +151,7 @@ $(window).on('beforeunload', () => {
|
||||
if (!component.beforeUnloadEvent()) {
|
||||
console.log(`Component ${component.componentId} is not finished saving its state.`);
|
||||
|
||||
toast.showMessage("Please wait for a couple of seconds for the save to finish, then you can try again.", 10000);
|
||||
toast.showMessage(t("app_context.please_wait_for_save"), 10000);
|
||||
|
||||
allSaved = false;
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ export default class TreeContextMenu {
|
||||
{ title: "----" },
|
||||
{ title: `${t("tree-context-menu.search-in-subtree")} <kbd data-command="searchInSubtree"></kbd>`, command: "searchInSubtree", uiIcon: "bx bx-search",
|
||||
enabled: notSearch && noSelectedNotes },
|
||||
isHoisted ? null : { title: 'Hoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch },
|
||||
!isHoisted || !isNotRoot ? null : { title: 'Unhoist note <kbd data-command="toggleNoteHoisting"></kbd>', command: "toggleNoteHoisting", uiIcon: "bx bx-door-open" },
|
||||
isHoisted ? null : { title: `${t("tree-context-menu.hoist-note")} <kbd data-command="toggleNoteHoisting"></kbd>`, command: "toggleNoteHoisting", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch },
|
||||
!isHoisted || !isNotRoot ? null : { title: `${t("tree-context-menu.unhoist-note")} <kbd data-command="toggleNoteHoisting"></kbd>`, command: "toggleNoteHoisting", uiIcon: "bx bx-door-open" },
|
||||
{ title: `${t("tree-context-menu.edit-branch-prefix")} <kbd data-command="editBranchPrefix"></kbd>`, command: "editBranchPrefix", uiIcon: "bx bx-empty",
|
||||
enabled: isNotRoot && parentNotSearch && noSelectedNotes && notOptions },
|
||||
{ title: t("tree-context-menu.advanced"), uiIcon: "bx bx-empty", enabled: true, items: [
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { t } from "../services/i18n.js";
|
||||
import BasicWidget from "./basic_widget.js";
|
||||
import contextMenu from "../menus/context_menu.js";
|
||||
import utils from "../services/utils.js";
|
||||
@ -37,11 +38,11 @@ const TAB_TPL = `
|
||||
<div class="note-tab-drag-handle"></div>
|
||||
<div class="note-tab-icon"></div>
|
||||
<div class="note-tab-title"></div>
|
||||
<div class="note-tab-close bx bx-x" title="Close tab" data-trigger-command="closeActiveTab"></div>
|
||||
<div class="note-tab-close bx bx-x" title="${t('tab_row.close_tab')}" data-trigger-command="closeActiveTab"></div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
const NEW_TAB_BUTTON_TPL = `<div class="note-new-tab" data-trigger-command="openNewTab" title="Add new tab">+</div>`;
|
||||
const NEW_TAB_BUTTON_TPL = `<div class="note-new-tab" data-trigger-command="openNewTab" title="${t('tab_row.add_new_tab')}">+</div>`;
|
||||
const FILLER_TPL = `<div class="tab-row-filler"></div>`;
|
||||
|
||||
const TAB_ROW_TPL = `
|
||||
@ -258,10 +259,10 @@ export default class TabRowWidget extends BasicWidget {
|
||||
x: e.pageX,
|
||||
y: e.pageY,
|
||||
items: [
|
||||
{title: "Close", command: "closeTab", uiIcon: "bx bx-x"},
|
||||
{title: "Close other tabs", command: "closeOtherTabs", uiIcon: "bx bx-x"},
|
||||
{title: "Close all tabs", command: "closeAllTabs", uiIcon: "bx bx-x"},
|
||||
{title: "Move this tab to a new window", command: "moveTabToNewWindow", uiIcon: "bx bx-window-open"}
|
||||
{title: t('tab_row.close'), command: "closeTab", uiIcon: "bx bx-x"},
|
||||
{title: t('tab_row.close_other_tabs'), command: "closeOtherTabs", uiIcon: "bx bx-x"},
|
||||
{title: t('tab_row.close_all_tabs'), command: "closeAllTabs", uiIcon: "bx bx-x"},
|
||||
{title: t('tab_row.move_tab_to_new_window'), command: "moveTabToNewWindow", uiIcon: "bx bx-window-open"}
|
||||
],
|
||||
selectMenuItemHandler: ({command}) => {
|
||||
this.triggerCommand(command, {ntxId});
|
||||
@ -387,7 +388,7 @@ export default class TabRowWidget extends BasicWidget {
|
||||
this.$newTab.before($tab);
|
||||
this.setVisibility();
|
||||
this.setTabCloseEvent($tab);
|
||||
this.updateTitle($tab, 'New tab');
|
||||
this.updateTitle($tab, t('tab_row.new_tab'));
|
||||
this.cleanUpPreviouslyDraggedTabs();
|
||||
this.layoutTabs();
|
||||
this.setupDraggabilly();
|
||||
@ -672,7 +673,7 @@ export default class TabRowWidget extends BasicWidget {
|
||||
const {note} = noteContext;
|
||||
|
||||
if (!note) {
|
||||
this.updateTitle($tab, 'New tab');
|
||||
this.updateTitle($tab, t('tab_row.new_tab'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* to the wrong heading (although what "right" means in those cases is not
|
||||
* clear), but it won't crash.
|
||||
*/
|
||||
|
||||
import { t } from "../services/i18n.js";
|
||||
import attributeService from "../services/attributes.js";
|
||||
import RightPanelWidget from "./right_panel_widget.js";
|
||||
import options from "../services/options.js";
|
||||
@ -55,14 +55,14 @@ const TPL = `<div class="toc-widget">
|
||||
|
||||
export default class TocWidget extends RightPanelWidget {
|
||||
get widgetTitle() {
|
||||
return "Table of Contents";
|
||||
return t("toc.table_of_contents");
|
||||
}
|
||||
|
||||
get widgetButtons() {
|
||||
return [
|
||||
new OnClickButtonWidget()
|
||||
.icon("bx-cog")
|
||||
.title("Options")
|
||||
.title(t("toc.options"))
|
||||
.titlePlacement("left")
|
||||
.onClick(() => appContext.tabManager.openContextWithNote('_optionsTextNotes', {activate: true}))
|
||||
.class("icon-action"),
|
||||
@ -125,18 +125,18 @@ export default class TocWidget extends RightPanelWidget {
|
||||
*
|
||||
* @param {string} html Note's html content
|
||||
* @returns {string} The HTML content with mathematical formulas rendered by KaTeX.
|
||||
*/
|
||||
*/
|
||||
async replaceMathTextWithKatax(html) {
|
||||
const mathTextRegex = /<span class="math-tex">\\\(([\s\S]*?)\\\)<\/span>/g;
|
||||
var matches = [...html.matchAll(mathTextRegex)];
|
||||
let modifiedText = html;
|
||||
|
||||
|
||||
if (matches.length > 0) {
|
||||
// Process all matches asynchronously
|
||||
for (const match of matches) {
|
||||
let latexCode = match[1];
|
||||
let rendered;
|
||||
|
||||
|
||||
try {
|
||||
rendered = katex.renderToString(latexCode, {
|
||||
throwOnError: false
|
||||
@ -158,7 +158,7 @@ export default class TocWidget extends RightPanelWidget {
|
||||
rendered = match[0]; // Fall back to original on error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Replace the matched formula in the modified text
|
||||
modifiedText = modifiedText.replace(match[0], rendered);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { t } from "../services/i18n.js";
|
||||
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
||||
import server from "../services/server.js";
|
||||
import fileWatcher from "../services/file_watcher.js";
|
||||
@ -11,12 +12,12 @@ const TPL = `
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>File <code class="file-path"></code> has been last modified on <span class="file-last-modified"></span>.</p>
|
||||
<p>${t("watched_file_update_status.file_last_modified", { count: '' })}</p>
|
||||
|
||||
<div style="display: flex; flex-direction: row; justify-content: space-evenly;">
|
||||
<button class="btn btn-sm file-upload-button">Upload modified file</button>
|
||||
<button class="btn btn-sm file-upload-button">${t("watched_file_update_status.upload_modified_file")}</button>
|
||||
|
||||
<button class="btn btn-sm ignore-this-change-button">Ignore this change</button>
|
||||
<button class="btn btn-sm ignore-this-change-button">${t("watched_file_update_status.ignore_this_change")}</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
@ -247,6 +247,9 @@
|
||||
"revisions_deleted": "笔记历史版本已删除。",
|
||||
"revision_restored": "笔记历史版本已恢复。",
|
||||
"revision_deleted": "笔记历史版本已删除。",
|
||||
"snapshot_interval": "笔记快照保存间隔: {{seconds}}秒。",
|
||||
"maximum_revisions": "当前笔记的最历史数量: {{number}}。",
|
||||
"settings": "笔记历史设置",
|
||||
"download_button": "下载",
|
||||
"mime": "MIME类型:",
|
||||
"file_size": "文件大小:",
|
||||
@ -1090,6 +1093,13 @@
|
||||
"note_revisions_snapshot_description": "笔记修改快照时间间隔是指经过多少秒后会为笔记创建新的修改历史。更多信息请参见<a href=\"https://triliumnext.github.io/Docs/Wiki/note-revisions.html\" class=\"external\">wiki</a>。",
|
||||
"snapshot_time_interval_label": "笔记修改快照时间间隔(单位:秒)"
|
||||
},
|
||||
"revisions_snapshot_limit": {
|
||||
"note_revisions_snapshot_limit_title": "笔记历史快照限制",
|
||||
"note_revisions_snapshot_limit_description": "笔记历史快照数限制指的是每个笔记可以保存的最大历史记录数量。其中 -1 表示没有限制,0 表示删除所有历史记录。你可以通过 #versioningLimit 标签设置单个笔记的最大历史记录数量。",
|
||||
"snapshot_number_limit_label": "笔记历史快照数量限制:",
|
||||
"erase_excess_revision_snapshots": "立即删除多余的历史快照",
|
||||
"erase_excess_revision_snapshots_prompt": "多余的历史快照已被删除。"
|
||||
},
|
||||
"search_engine": {
|
||||
"title": "搜索引擎",
|
||||
"custom_search_engine_info": "自定义搜索引擎需要设置名称和URL。如果这两者之一未设置,将默认使用DuckDuckGo作为搜索引擎。",
|
||||
@ -1280,6 +1290,8 @@
|
||||
"insert-child-note": "插入子笔记",
|
||||
"delete": "删除",
|
||||
"search-in-subtree": "在子树中搜索",
|
||||
"hoist-note": "提升笔记",
|
||||
"unhoist-note": "取消提升笔记",
|
||||
"edit-branch-prefix": "编辑分支前缀",
|
||||
"advanced": "高级",
|
||||
"expand-subtree": "展开子树",
|
||||
@ -1391,5 +1403,26 @@
|
||||
},
|
||||
"sql_table_schemas": {
|
||||
"tables": "表"
|
||||
},
|
||||
"tab_row": {
|
||||
"close_tab": "关闭标签页",
|
||||
"add_new_tab": "添加新标签页",
|
||||
"close": "关闭",
|
||||
"close_other_tabs": "关闭其他标签页",
|
||||
"close_all_tabs": "关闭所有标签页",
|
||||
"move_tab_to_new_window": "将此标签页移动到新窗口",
|
||||
"new_tab": "新标签页"
|
||||
},
|
||||
"toc": {
|
||||
"table_of_contents": "目录",
|
||||
"options": "选项"
|
||||
},
|
||||
"watched_file_update_status": {
|
||||
"file_last_modified": "文件 <code class=\"file-path\"></code> 最后修改时间为 <span class=\"file-last-modified\"></span>。",
|
||||
"upload_modified_file": "上传修改的文件",
|
||||
"ignore_this_change": "忽略此更改"
|
||||
},
|
||||
"app_context": {
|
||||
"please_wait_for_save": "请等待几秒钟以完成保存,然后您可以尝试再操作一次。"
|
||||
}
|
||||
}
|
||||
|
@ -1290,6 +1290,8 @@
|
||||
"insert-child-note": "Insert child note",
|
||||
"delete": "Delete",
|
||||
"search-in-subtree": "Search in subtree",
|
||||
"hoist-note": "Hoist note",
|
||||
"unhoist-note": "Unhoist note",
|
||||
"edit-branch-prefix": "Edit branch prefix",
|
||||
"advanced": "Advanced",
|
||||
"expand-subtree": "Expand subtree",
|
||||
@ -1401,5 +1403,26 @@
|
||||
},
|
||||
"sql_table_schemas": {
|
||||
"tables": "Tables"
|
||||
},
|
||||
"tab_row": {
|
||||
"close_tab": "Close tab",
|
||||
"add_new_tab": "Add new tab",
|
||||
"close": "Close",
|
||||
"close_other_tabs": "Close other tabs",
|
||||
"close_all_tabs": "Close all tabs",
|
||||
"move_tab_to_new_window": "Move this tab to a new window",
|
||||
"new_tab": "New tab"
|
||||
},
|
||||
"toc": {
|
||||
"table_of_contents": "Table of Contents",
|
||||
"options": "Options"
|
||||
},
|
||||
"watched_file_update_status": {
|
||||
"file_last_modified": "File <code class=\"file-path\"></code> has been last modified on <span class=\"file-last-modified\"></span>.",
|
||||
"upload_modified_file": "Upload modified file",
|
||||
"ignore_this_change": "Ignore this change"
|
||||
},
|
||||
"app_context": {
|
||||
"please_wait_for_save": "Please wait for a couple of seconds for the save to finish, then you can try again."
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user