diff --git a/src/public/app/doc_notes/cn/hidden.html b/src/public/app/doc_notes/cn/hidden.html new file mode 100644 index 000000000..f369e0f82 --- /dev/null +++ b/src/public/app/doc_notes/cn/hidden.html @@ -0,0 +1,3 @@ +

隐藏树用于记录各种应用层数据,这些数据大部分时间可能对用户不可见。

+ +

确保你知道自己在做什么。对这个子树的错误更改可能会导致应用程序崩溃。

diff --git a/src/public/app/doc_notes/cn/launchbar_command_launcher.html b/src/public/app/doc_notes/cn/launchbar_command_launcher.html new file mode 100644 index 000000000..1171d699a --- /dev/null +++ b/src/public/app/doc_notes/cn/launchbar_command_launcher.html @@ -0,0 +1 @@ +

此启动器操作的键盘快捷键可以在“选项”->“快捷键”中进行配置。

diff --git a/src/public/app/doc_notes/cn/launchbar_history_navigation.html b/src/public/app/doc_notes/cn/launchbar_history_navigation.html new file mode 100644 index 000000000..e86b0af1a --- /dev/null +++ b/src/public/app/doc_notes/cn/launchbar_history_navigation.html @@ -0,0 +1,3 @@ +

“后退”和“前进”按钮允许您在导航历史中移动。

+ +

这些启动器仅在桌面版本中有效,在服务器版本中将被忽略,您可以使用浏览器的原生导航按钮代替。

diff --git a/src/public/app/doc_notes/cn/launchbar_intro.html b/src/public/app/doc_notes/cn/launchbar_intro.html new file mode 100644 index 000000000..e7b32a3cd --- /dev/null +++ b/src/public/app/doc_notes/cn/launchbar_intro.html @@ -0,0 +1,11 @@ +

欢迎来到启动栏配置界面。

+ +

您可以在此处执行以下操作:

+ + diff --git a/src/public/app/doc_notes/cn/launchbar_note_launcher.html b/src/public/app/doc_notes/cn/launchbar_note_launcher.html new file mode 100644 index 000000000..1bede769c --- /dev/null +++ b/src/public/app/doc_notes/cn/launchbar_note_launcher.html @@ -0,0 +1,9 @@ +

您可以定义以下属性:

+ +
    +
  1. target - 激活启动器时应打开的笔记
  2. +
  3. hoistedNote - 可选,在打开目标笔记之前将更改提升的笔记
  4. +
  5. keyboardShortcut - 可选,按下键盘快捷键将打开该笔记
  6. +
+ +

启动栏显示来自启动器的标题/图标,这不一定与目标笔记的标题/图标一致。

diff --git a/src/public/app/doc_notes/cn/launchbar_script_launcher.html b/src/public/app/doc_notes/cn/launchbar_script_launcher.html new file mode 100644 index 000000000..6f17afedd --- /dev/null +++ b/src/public/app/doc_notes/cn/launchbar_script_launcher.html @@ -0,0 +1,12 @@ +

脚本启动器可以执行通过 ~script 关系连接的脚本(代码笔记)。

+ +
    +
  1. script - 与应在启动器激活时执行的脚本笔记的关系
  2. +
  3. keyboardShortcut - 可选,按下键盘快捷键将激活启动器
  4. +
+ +

示例脚本

+ +
+api.showMessage("当前笔记是 " + api.getActiveContextNote().title);
+
diff --git a/src/public/app/doc_notes/cn/launchbar_spacer.html b/src/public/app/doc_notes/cn/launchbar_spacer.html new file mode 100644 index 000000000..bcc0e3efe --- /dev/null +++ b/src/public/app/doc_notes/cn/launchbar_spacer.html @@ -0,0 +1,6 @@ +

间隔器允许您在视觉上将启动器分组。您可以在提升的属性中进行配置:

+ + diff --git a/src/public/app/doc_notes/cn/launchbar_widget_launcher.html b/src/public/app/doc_notes/cn/launchbar_widget_launcher.html new file mode 100644 index 000000000..8ef57fa7c --- /dev/null +++ b/src/public/app/doc_notes/cn/launchbar_widget_launcher.html @@ -0,0 +1,34 @@ +

请在提升的属性中定义目标小部件笔记。该小部件将用于渲染启动栏图标。

+ +

示例启动栏小部件

+ +
+const TPL = `<div style="height: 53px; width: 53px;"></div>`;
+
+class ExampleLaunchbarWidget extends api.NoteContextAwareWidget {
+    doRender() {
+        this.$widget = $(TPL);
+    }
+
+    async refreshWithNote(note) {
+        this.$widget.css("background-color", this.stringToColor(note.title));
+    }
+
+    stringToColor(str) {
+        let hash = 0;
+        for (let i = 0; i < str.length; i++) {
+            hash = str.charCodeAt(i) + ((hash << 5) - hash);
+        }
+
+        let color = '#';
+        for (let i = 0; i < 3; i++) {
+            const value = (hash >> (i * 8)) & 0xFF;
+            color += ('00' + value.toString(16)).substr(-2);
+        }
+
+        return color;
+    }
+}
+
+module.exports = new ExampleLaunchbarWidget();
+
diff --git a/src/public/app/doc_notes/cn/share.html b/src/public/app/doc_notes/cn/share.html new file mode 100644 index 000000000..3eedb8c09 --- /dev/null +++ b/src/public/app/doc_notes/cn/share.html @@ -0,0 +1 @@ +

在这里您可以找到所有分享的笔记。

diff --git a/src/public/app/doc_notes/cn/user_hidden.html b/src/public/app/doc_notes/cn/user_hidden.html new file mode 100644 index 000000000..715be770d --- /dev/null +++ b/src/public/app/doc_notes/cn/user_hidden.html @@ -0,0 +1 @@ +

此笔记作为一个子树,用于存储由用户脚本生成的数据,这些数据本应避免在隐藏子树中随意创建。

diff --git a/src/public/app/doc_notes/hidden.html b/src/public/app/doc_notes/en/hidden.html similarity index 100% rename from src/public/app/doc_notes/hidden.html rename to src/public/app/doc_notes/en/hidden.html diff --git a/src/public/app/doc_notes/launchbar_command_launcher.html b/src/public/app/doc_notes/en/launchbar_command_launcher.html similarity index 100% rename from src/public/app/doc_notes/launchbar_command_launcher.html rename to src/public/app/doc_notes/en/launchbar_command_launcher.html diff --git a/src/public/app/doc_notes/launchbar_history_navigation.html b/src/public/app/doc_notes/en/launchbar_history_navigation.html similarity index 100% rename from src/public/app/doc_notes/launchbar_history_navigation.html rename to src/public/app/doc_notes/en/launchbar_history_navigation.html diff --git a/src/public/app/doc_notes/launchbar_intro.html b/src/public/app/doc_notes/en/launchbar_intro.html similarity index 100% rename from src/public/app/doc_notes/launchbar_intro.html rename to src/public/app/doc_notes/en/launchbar_intro.html diff --git a/src/public/app/doc_notes/launchbar_note_launcher.html b/src/public/app/doc_notes/en/launchbar_note_launcher.html similarity index 100% rename from src/public/app/doc_notes/launchbar_note_launcher.html rename to src/public/app/doc_notes/en/launchbar_note_launcher.html diff --git a/src/public/app/doc_notes/launchbar_script_launcher.html b/src/public/app/doc_notes/en/launchbar_script_launcher.html similarity index 100% rename from src/public/app/doc_notes/launchbar_script_launcher.html rename to src/public/app/doc_notes/en/launchbar_script_launcher.html diff --git a/src/public/app/doc_notes/launchbar_spacer.html b/src/public/app/doc_notes/en/launchbar_spacer.html similarity index 100% rename from src/public/app/doc_notes/launchbar_spacer.html rename to src/public/app/doc_notes/en/launchbar_spacer.html diff --git a/src/public/app/doc_notes/launchbar_widget_launcher.html b/src/public/app/doc_notes/en/launchbar_widget_launcher.html similarity index 100% rename from src/public/app/doc_notes/launchbar_widget_launcher.html rename to src/public/app/doc_notes/en/launchbar_widget_launcher.html diff --git a/src/public/app/doc_notes/share.html b/src/public/app/doc_notes/en/share.html similarity index 100% rename from src/public/app/doc_notes/share.html rename to src/public/app/doc_notes/en/share.html diff --git a/src/public/app/doc_notes/user_hidden.html b/src/public/app/doc_notes/en/user_hidden.html similarity index 100% rename from src/public/app/doc_notes/user_hidden.html rename to src/public/app/doc_notes/en/user_hidden.html diff --git a/src/public/app/widgets/type_widgets/doc.js b/src/public/app/widgets/type_widgets/doc.js index 234ff21aa..5ca738f26 100644 --- a/src/public/app/widgets/type_widgets/doc.js +++ b/src/public/app/widgets/type_widgets/doc.js @@ -31,7 +31,14 @@ export default class DocTypeWidget extends TypeWidget { const docName = note.getLabelValue('docName'); if (docName) { - this.$content.load(`${window.glob.appPath}/doc_notes/${docName}.html`); + // find doc based on language + const lng = i18next.language; + this.$content.load(`${window.glob.appPath}/doc_notes/${lng}/${docName}.html`, (response, status) => { + // fallback to english doc if no translation available + if (status === 'error') { + this.$content.load(`${window.glob.appPath}/doc_notes/en/${docName}.html`); + } + }); } else { this.$content.empty(); }