Skip to content

Build your personal knowledge base with Trilium Notes

add translation for doc notes

Nriver1c2975a8188c
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 0000000000..f369e0f82b
--- /dev/null
+++ b/src/public/app/doc_notes/cn/hidden.html
@@ -0,0 +1,3 @@
+<p>隐藏树用于记录各种应用层数据,这些数据大部分时间可能对用户不可见。</p>
+
+<p>确保你知道自己在做什么。对这个子树的错误更改可能会导致应用程序崩溃。</p>
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 0000000000..1171d699a3
--- /dev/null
+++ b/src/public/app/doc_notes/cn/launchbar_command_launcher.html
@@ -0,0 +1 @@
+<p>此启动器操作的键盘快捷键可以在“选项”->“快捷键”中进行配置。</p>
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 0000000000..e86b0af1a1
--- /dev/null
+++ b/src/public/app/doc_notes/cn/launchbar_history_navigation.html
@@ -0,0 +1,3 @@
+<p>“后退”和“前进”按钮允许您在导航历史中移动。</p>
+
+<p>这些启动器仅在桌面版本中有效,在服务器版本中将被忽略,您可以使用浏览器的原生导航按钮代替。</p>
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 0000000000..e7b32a3cd0
--- /dev/null
+++ b/src/public/app/doc_notes/cn/launchbar_intro.html
@@ -0,0 +1,11 @@
+<p>欢迎来到启动栏配置界面。</p>
+
+<p>您可以在此处执行以下操作:</p>
+
+<ul>
+ <li>通过拖动将可用的启动器移动到可见列表中(从而将它们放入启动栏)</li>
+ <li>通过拖动将可见的启动器移动到可用列表中(从而将它们从启动栏中隐藏)</li>
+ <li>您可以通过拖动重新排列列表中的项目</li>
+ <li>通过右键点击“可见启动器”文件夹来创建新的启动器</li>
+ <li>如果您想恢复默认设置,可以在右键菜单中找到“重置”选项。</li>
+</ul>
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 0000000000..1bede769ce
--- /dev/null
+++ b/src/public/app/doc_notes/cn/launchbar_note_launcher.html
@@ -0,0 +1,9 @@
+<p>您可以定义以下属性:</p>
+
+<ol>
+ <li><code>target</code> - 激活启动器时应打开的笔记</li>
+ <li><code>hoistedNote</code> - 可选,在打开目标笔记之前将更改提升的笔记</li>
+ <li><code>keyboardShortcut</code> - 可选,按下键盘快捷键将打开该笔记</li>
+</ol>
+
+<p>启动栏显示来自启动器的标题/图标,这不一定与目标笔记的标题/图标一致。</p>
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 0000000000..6f17afeddc
--- /dev/null
+++ b/src/public/app/doc_notes/cn/launchbar_script_launcher.html
@@ -0,0 +1,12 @@
+<p>脚本启动器可以执行通过 <code>~script</code> 关系连接的脚本(代码笔记)。</p>
+
+<ol>
+ <li><code>script</code> - 与应在启动器激活时执行的脚本笔记的关系</li>
+ <li><code>keyboardShortcut</code> - 可选,按下键盘快捷键将激活启动器</li>
+</ol>
+
+<h4>示例脚本</h4>
+
+<pre>
+api.showMessage("当前笔记是 " + api.getActiveContextNote().title);
+</pre>
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 0000000000..bcc0e3efe1
--- /dev/null
+++ b/src/public/app/doc_notes/cn/launchbar_spacer.html
@@ -0,0 +1,6 @@
+<p>间隔器允许您在视觉上将启动器分组。您可以在提升的属性中进行配置:</p>
+
+<ul>
+ <li><code>baseSize</code> - 定义以像素为单位的大小(如果有足够的空间)</li>
+ <li><code>growthFactor</code> - 如果您希望间隔器保持恒定的 <code>baseSize</code>,则设置为 0;如果设置为正值,它将增长。</li>
+</ul>
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 0000000000..8ef57fa7c1
--- /dev/null
+++ b/src/public/app/doc_notes/cn/launchbar_widget_launcher.html
@@ -0,0 +1,34 @@
+<p>请在提升的属性中定义目标小部件笔记。该小部件将用于渲染启动栏图标。</p>
+
+<h4>示例启动栏小部件</h4>
+
+<pre>
+const TPL = `&lt;div style="height: 53px; width: 53px;"&gt;&lt;/div&gt;`;
+
+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();
+</pre>
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 0000000000..3eedb8c093
--- /dev/null
+++ b/src/public/app/doc_notes/cn/share.html
@@ -0,0 +1 @@
+<p>在这里您可以找到所有分享的笔记。</p>
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 0000000000..715be770d4
--- /dev/null
+++ b/src/public/app/doc_notes/cn/user_hidden.html
@@ -0,0 +1 @@
+<p>此笔记作为一个子树,用于存储由用户脚本生成的数据,这些数据本应避免在隐藏子树中随意创建。</p>
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 234ff21aa3..5ca738f26e 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();
}