add translation for attribute editor

This commit is contained in:
Nriver 2024-07-29 10:14:27 +08:00
parent f3e09c3a4b
commit 92b0c7f0b7
3 changed files with 34 additions and 11 deletions

View File

@ -1,3 +1,4 @@
import { t } from "../../services/i18n.js";
import NoteContextAwareWidget from "../note_context_aware_widget.js";
import noteAutocompleteService from "../../services/note_autocomplete.js";
import server from "../../services/server.js";
@ -11,11 +12,11 @@ import attributeService from "../../services/attributes.js";
import linkService from "../../services/link.js";
const HELP_TEXT = `
<p>To add label, just type e.g. <code>#rock</code> or if you want to add also value then e.g. <code>#year = 2020</code></p>
<p>${t("attribute_editor.help_text_body1")}</p>
<p>For relation, type <code>~author = @</code> which should bring up an autocomplete where you can look up the desired note.</p>
<p>${t("attribute_editor.help_text_body2")}</p>
<p>Alternatively you can add label and relation using the <code>+</code> button on the right side.</p>`;
<p>${t("attribute_editor.help_text_body3")}</p>`;
const TPL = `
<div style="position: relative; padding-top: 10px; padding-bottom: 10px">
@ -71,8 +72,8 @@ const TPL = `
<div class="attribute-list-editor" tabindex="200"></div>
<div class="bx bx-save save-attributes-button" title="Save attributes <enter>"></div>
<div class="bx bx-plus add-new-attribute-button" title="Add a new attribute"></div>
<div class="bx bx-save save-attributes-button" title="${t("attribute_editor.save_attributes")}"></div>
<div class="bx bx-plus add-new-attribute-button" title="${t("attribute_editor.add_a_new_attribute")}"></div>
<div class="attribute-errors" style="display: none;"></div>
</div>
@ -217,13 +218,13 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
y: e.pageY,
orientation: 'left',
items: [
{title: `Add new label <kbd data-command="addNewLabel"></kbd>`, command: "addNewLabel", uiIcon: "bx bx-hash"},
{title: `Add new relation <kbd data-command="addNewRelation"></kbd>`, command: "addNewRelation", uiIcon: "bx bx-transfer"},
{title: "----"},
{title: "Add new label definition", command: "addNewLabelDefinition", uiIcon: "bx bx-empty"},
{title: "Add new relation definition", command: "addNewRelationDefinition", uiIcon: "bx bx-empty"},
{ title: t("attribute_editor.add_new_label"), command: "addNewLabel", uiIcon: "bx bx-hash" },
{ title: t("attribute_editor.add_new_relation"), command: "addNewRelation", uiIcon: "bx bx-transfer" },
{ title: "----" },
{ title: t("attribute_editor.add_new_label_definition"), command: "addNewLabelDefinition", uiIcon: "bx bx-empty" },
{ title: t("attribute_editor.add_new_relation_definition"), command: "addNewRelationDefinition", uiIcon: "bx bx-empty" },
],
selectMenuItemHandler: ({command}) => this.handleAddNewAttributeCommand(command)
selectMenuItemHandler: ({ command }) => this.handleAddNewAttributeCommand(command)
});
}

View File

@ -390,5 +390,16 @@
"is_owned_by_note": "由此笔记所有",
"other_notes_with_name": "其它含有 {{attributeType}} 名为 \"{{attributeName}}\" 的的笔记",
"and_more": "... 以及另外 {{count}} 个"
},
"attribute_editor": {
"help_text_body1": "要添加标签,只需输入例如 <code>#rock</code> 或者如果您还想添加值,则例如 <code>#year = 2020</code>",
"help_text_body2": "对于关系,请输入 <code>~author = @</code>,这将显示一个自动完成列表,您可以查找所需的笔记。",
"help_text_body3": "您也可以使用右侧的 <code>+</code> 按钮添加标签和关系。</p>",
"save_attributes": "报错属性 <enter>",
"add_a_new_attribute": "添加新属性",
"add_new_label": "添加新标签 <kbd data-command=\"addNewLabel\"></kbd>",
"add_new_relation": "添加新关系 <kbd data-command=\"addNewRelation\"></kbd>",
"add_new_label_definition": "添加新标签定义",
"add_new_relation_definition": "添加新关系定义"
}
}

View File

@ -390,5 +390,16 @@
"is_owned_by_note": "is owned by note",
"other_notes_with_name": "Other notes with {{attributeType}} name \"{{attributeName}}\"",
"and_more": "... and {{count}} more."
},
"attribute_editor": {
"help_text_body1": "To add label, just type e.g. <code>#rock</code> or if you want to add also value then e.g. <code>#year = 2020</code>",
"help_text_body2": "For relation, type <code>~author = @</code> which should bring up an autocomplete where you can look up the desired note.",
"help_text_body3": "Alternatively you can add label and relation using the <code>+</code> button on the right side.",
"save_attributes": "Save attributes <enter>",
"add_a_new_attribute": "Add a new attribute",
"add_new_label": "Add new label <kbd data-command=\"addNewLabel\"></kbd>",
"add_new_relation": "Add new relation <kbd data-command=\"addNewRelation\"></kbd>",
"add_new_label_definition": "Add new label definition",
"add_new_relation_definition": "Add new relation definition"
}
}