Skip to content

Commit

Permalink
add translation for 2 type widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
Nriver committed Aug 8, 2024
1 parent 01f99d7 commit 9885abc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/public/app/widgets/type_widgets/render.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import renderService from "../../services/render.js";
import TypeWidget from "./type_widget.js";
import { t } from "../../services/i18n.js";

const TPL = `
<div class="note-detail-render note-detail-printable">
Expand All @@ -10,9 +11,9 @@ const TPL = `
</style>
<div class="note-detail-render-help alert alert-warning" style="margin: 50px; padding: 20px;">
<p><strong>This help note is shown because this note of type Render HTML doesn't have required relation to function properly.</strong></p>
<p><strong>${t("render.note_detail_render_help_1")}</strong></p>
<p>Render HTML note type is used for <a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/scripts.md">scripting</a>. In short, you have a HTML code note (optionally with some JavaScript) and this note will render it. To make it work, you need to define a <a class="external" href="https://github.com/TriliumNext/Docs/blob/main/Wiki/attributes.md">relation</a> called "renderNote" pointing to the HTML note to render.</p>
<p>${t("render.note_detail_render_help_2")}</p>
</div>
<div class="note-detail-render-content"></div>
Expand Down
14 changes: 7 additions & 7 deletions src/public/app/widgets/type_widgets/web_view.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { t } from "../../services/i18n.js";
import TypeWidget from "./type_widget.js";
import attributeService from "../../services/attributes.js";

const TPL = `
<div class="note-detail-web-view note-detail-printable" style="height: 100%">
<div class="note-detail-web-view-help alert alert-warning" style="margin: 50px; padding: 20px 20px 0px 20px;">
<h4>Web View</h4>
<h4>${t("web_view.web_view")}</h4>
<p>Note of type Web View allow you to embed websites into Trilium.</p>
<p>${t("web_view.embed_websites")}</p>
<p>To start, please create a label with a URL address you want to embed, e.g. <code>#webViewSrc="http://www.google.com"</code></p>
<p>${t("web_view.create_label")}</p>
<h4>Disclaimer on the experimental status</h4>
<h4>${t("web_view.disclaimer")}</h4>
<p>Web View is an experimental note type, and it might be removed or substantially changed in the future. Web View works also only in the desktop build.</p>
<p>${t("web_view.experimental_note")}</p>
</div>
<webview class="note-detail-web-view-content"></webview>
Expand Down Expand Up @@ -42,8 +43,7 @@ export default class WebViewTypeWidget extends TypeWidget {
this.$noteDetailWebViewContent
.show()
.attr("src", webViewSrc);
}
else {
} else {
this.$noteDetailWebViewContent.hide();
this.$noteDetailWebViewHelp.show();
}
Expand Down
11 changes: 11 additions & 0 deletions src/public/translations/cn/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -915,5 +915,16 @@
"enter_title_of_new_note": "输入新笔记的标题",
"default_new_note_title": "新笔记",
"click_on_canvas_to_place_new_note": "点击画布以放置新笔记"
},
"render": {
"note_detail_render_help_1": "之所以显示此帮助说明,是因为该类型的渲染HTML没有设置好必须的关联关系。",
"note_detail_render_help_2": "渲染笔记类型用于编写 <a class=\"external\" href=\"https://github.com/TriliumNext/Docs/blob/main/Wiki/scripts.md\">脚本</a>。简单说就是你可以写HTML代码(或者加上一些JavaScript代码), 然后这个笔记会把页面渲染出来。要使其正常工作,您需要定义一个名为 \"renderNote\" 的关系 <a class=\"external\" href=\"https://github.com/TriliumNext/Docs/blob/main/Wiki/attributes.md\">关系</a> 指向要呈现的 HTML 笔记。"
},
"web_view": {
"web_view": "网页视图",
"embed_websites": "网页视图类型的笔记允许您将网站嵌入到 Trilium 中。",
"create_label": "首先,请创建一个带有您要嵌入的 URL 地址的标签,例如 #webViewSrc=\"https://www.bing.com\"",
"disclaimer": "实验性功能免责声明",
"experimental_note": "网页视图是一种实验性的笔记类型,将来可能会被移除或大幅更改。网页视图只在桌面端有效。"
}
}
11 changes: 11 additions & 0 deletions src/public/translations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -916,5 +916,16 @@
"enter_title_of_new_note": "Enter title of new note",
"default_new_note_title": "new note",
"click_on_canvas_to_place_new_note": "Click on canvas to place new note"
},
"render": {
"note_detail_render_help_1": "This help note is shown because this note of type Render HTML doesn't have required relation to function properly.",
"note_detail_render_help_2": "Render HTML note type is used for <a class=\"external\" href=\"https://github.com/TriliumNext/Docs/blob/main/Wiki/scripts.md\">scripting</a>. In short, you have a HTML code note (optionally with some JavaScript) and this note will render it. To make it work, you need to define a <a class=\"external\" href=\"https://github.com/TriliumNext/Docs/blob/main/Wiki/attributes.md\">relation</a> called \"renderNote\" pointing to the HTML note to render."
},
"web_view": {
"web_view": "Web View",
"embed_websites": "Note of type Web View allows you to embed websites into Trilium.",
"create_label": "To start, please create a label with a URL address you want to embed, e.g. #webViewSrc=\"https://www.google.com\"",
"disclaimer": "Disclaimer on the experimental status",
"experimental_note": "Web View is an experimental note type, and it might be removed or substantially changed in the future. Web View works also only in the desktop build."
}
}

0 comments on commit 9885abc

Please sign in to comment.