From 3ff361495e51b09dcb55c0c04f9523dab85aae5b Mon Sep 17 00:00:00 2001 From: Nriver <6752679+Nriver@users.noreply.github.com> Date: Tue, 30 Jul 2024 10:06:54 +0800 Subject: [PATCH] add translation for bulk action of relation --- .../bulk_actions/relation/add_relation.js | 17 +++++----- .../bulk_actions/relation/delete_relation.js | 11 +++--- .../bulk_actions/relation/rename_relation.js | 17 +++++----- .../relation/update_relation_target.js | 21 ++++++------ src/public/translations/cn/translation.json | 34 ++++++++++++++++++- src/public/translations/en/translation.json | 34 ++++++++++++++++++- 6 files changed, 101 insertions(+), 33 deletions(-) diff --git a/src/public/app/widgets/bulk_actions/relation/add_relation.js b/src/public/app/widgets/bulk_actions/relation/add_relation.js index 846aa870e..de8240c7d 100644 --- a/src/public/app/widgets/bulk_actions/relation/add_relation.js +++ b/src/public/app/widgets/bulk_actions/relation/add_relation.js @@ -1,24 +1,25 @@ import SpacedUpdate from "../../../services/spaced_update.js"; import AbstractBulkAction from "../abstract_bulk_action.js"; import noteAutocompleteService from "../../../services/note_autocomplete.js"; +import { t } from "../../../services/i18n.js"; const TPL = `
-
Add relation
+
${t('add_relation.add_relation')}
+ title="${t('add_relation.allowed_characters')}"/> -
to
+
${t('add_relation.to')}
- +
@@ -26,7 +27,7 @@ const TPL = ` @@ -36,7 +37,7 @@ const TPL = ` export default class AddRelationBulkAction extends AbstractBulkAction { static get actionName() { return "addRelation"; } - static get actionTitle() { return "Add relation"; } + static get actionTitle() { return t('add_relation.add_relation'); } doRender() { const $action = $(TPL); @@ -55,7 +56,7 @@ export default class AddRelationBulkAction extends AbstractBulkAction { relationName: $relationName.val(), targetNoteId: $targetNote.getSelectedNoteId() }); - }, 1000) + }, 1000); $relationName.on('input', () => spacedUpdate.scheduleUpdate()); $targetNote.on('input', () => spacedUpdate.scheduleUpdate()); diff --git a/src/public/app/widgets/bulk_actions/relation/delete_relation.js b/src/public/app/widgets/bulk_actions/relation/delete_relation.js index 86cd99c50..f382841a8 100644 --- a/src/public/app/widgets/bulk_actions/relation/delete_relation.js +++ b/src/public/app/widgets/bulk_actions/relation/delete_relation.js @@ -1,18 +1,19 @@ import SpacedUpdate from "../../../services/spaced_update.js"; import AbstractBulkAction from "../abstract_bulk_action.js"; +import { t } from "../../../services/i18n.js"; const TPL = ` - Delete relation: + ${t('delete_relation.delete_relation')}
+ placeholder="${t('delete_relation.relation_name')}" + title="${t('delete_relation.allowed_characters')}"/>
@@ -22,7 +23,7 @@ const TPL = ` export default class DeleteRelationBulkAction extends AbstractBulkAction { static get actionName() { return "deleteRelation"; } - static get actionTitle() { return "Delete relation"; } + static get actionTitle() { return t('delete_relation.delete_relation'); } doRender() { const $action = $(TPL); @@ -31,7 +32,7 @@ export default class DeleteRelationBulkAction extends AbstractBulkAction { const spacedUpdate = new SpacedUpdate(async () => { await this.saveAction({ relationName: $relationName.val() }); - }, 1000) + }, 1000); $relationName.on('input', () => spacedUpdate.scheduleUpdate()); diff --git a/src/public/app/widgets/bulk_actions/relation/rename_relation.js b/src/public/app/widgets/bulk_actions/relation/rename_relation.js index 9d5c674cf..a2b3e9886 100644 --- a/src/public/app/widgets/bulk_actions/relation/rename_relation.js +++ b/src/public/app/widgets/bulk_actions/relation/rename_relation.js @@ -1,25 +1,26 @@ import SpacedUpdate from "../../../services/spaced_update.js"; import AbstractBulkAction from "../abstract_bulk_action.js"; +import { t } from "../../../services/i18n.js"; const TPL = `
-
Rename relation from:
+
${t('rename_relation.rename_relation_from')}
+ title="${t('rename_relation.allowed_characters')}"/> -
To:
+
${t('rename_relation.to')}
+ title="${t('rename_relation.allowed_characters')}"/>
@@ -29,7 +30,7 @@ const TPL = ` export default class RenameRelationBulkAction extends AbstractBulkAction { static get actionName() { return "renameRelation"; } - static get actionTitle() { return "Rename relation"; } + static get actionTitle() { return t('rename_relation.rename_relation'); } doRender() { const $action = $(TPL); @@ -45,7 +46,7 @@ export default class RenameRelationBulkAction extends AbstractBulkAction { oldRelationName: $oldRelationName.val(), newRelationName: $newRelationName.val() }); - }, 1000) + }, 1000); $oldRelationName.on('input', () => spacedUpdate.scheduleUpdate()); $newRelationName.on('input', () => spacedUpdate.scheduleUpdate()); diff --git a/src/public/app/widgets/bulk_actions/relation/update_relation_target.js b/src/public/app/widgets/bulk_actions/relation/update_relation_target.js index 5c4b98d73..019bfdd5c 100644 --- a/src/public/app/widgets/bulk_actions/relation/update_relation_target.js +++ b/src/public/app/widgets/bulk_actions/relation/update_relation_target.js @@ -1,24 +1,25 @@ import SpacedUpdate from "../../../services/spaced_update.js"; import AbstractBulkAction from "../abstract_bulk_action.js"; import noteAutocompleteService from "../../../services/note_autocomplete.js"; +import { t } from "../../../services/i18n.js"; const TPL = `
-
Update relation
+
${t('update_relation_target.update_relation')}
+ title="${t('update_relation_target.allowed_characters')}"/> -
to
+
${t('update_relation_target.to')}
- +
@@ -26,11 +27,11 @@ const TPL = ` @@ -41,7 +42,7 @@ const TPL = ` export default class UpdateRelationTargetBulkAction extends AbstractBulkAction { static get actionName() { return "updateRelationTarget"; } - static get actionTitle() { return "Update relation target"; } + static get actionTitle() { return t('update_relation_target.update_relation_target'); } doRender() { const $action = $(TPL); @@ -60,7 +61,7 @@ export default class UpdateRelationTargetBulkAction extends AbstractBulkAction { relationName: $relationName.val(), targetNoteId: $targetNote.getSelectedNoteId() }); - }, 1000) + }, 1000); $relationName.on('input', () => spacedUpdate.scheduleUpdate()); $targetNote.on('input', () => spacedUpdate.scheduleUpdate()); diff --git a/src/public/translations/cn/translation.json b/src/public/translations/cn/translation.json index 1e083d9e8..3fe64ac00 100644 --- a/src/public/translations/cn/translation.json +++ b/src/public/translations/cn/translation.json @@ -428,6 +428,7 @@ "label_name_title": "允许使用字母、数字、下划线和冒号。" }, "rename_label": { + "rename_label": "重命名标签", "rename_label_from": "重命名标签从", "old_name_placeholder": "旧名称", "to": "改为", @@ -463,7 +464,7 @@ "nothing_will_happen": "如果笔记无法移动到目标笔记(即这会创建一个树循环),则不会发生任何事情" }, "rename_note": { - "rename_note_title_to": "重命名笔记标题为:", + "rename_note_title_to": "重命名笔记标题为", "new_note_title": "新笔记标题", "click_help_icon": "点击右侧的帮助图标查看所有选项", "evaluated_as_js_string": "给定的值被评估为JavaScript字符串,因此可以通过注入的note变量(正在重命名的笔记)丰富动态内容。 例如:", @@ -471,5 +472,36 @@ "example_new_title": "NEW: ${note.title} - 匹配的笔记标题以“NEW: ”为前缀", "example_date_prefix": "${note.dateCreatedObj.format('MM-DD:')}: ${note.title} - 匹配的笔记以笔记的创建月份-日期为前缀", "api_docs": "有关详细信息,请参阅笔记及其dateCreatedObj / utcDateCreatedObj 属性的API文档。" + }, + "add_relation": { + "add_relation": "添加关系", + "relation_name": "关系名称", + "allowed_characters": "允许的字符为字母数字、下划线和冒号。", + "to": "到", + "target_note": "目标笔记", + "create_relation_on_all_matched_notes": "在所有匹配的笔记上创建指定的关系。" + }, + "delete_relation": { + "delete_relation": "删除关系", + "relation_name": "关系名称", + "allowed_characters": "允许的字符为字母数字、下划线和冒号。" + }, + "rename_relation": { + "rename_relation_from": "重命名关系,从", + "old_name": "旧名称", + "to": "改为", + "new_name": "新名称", + "allowed_characters": "允许的字符为字母数字、下划线和冒号。" + }, + "update_relation_target": { + "update_relation": "更新关系", + "relation_name": "关系名称", + "allowed_characters": "允许的字符为字母数字、下划线和冒号。", + "to": "到", + "target_note": "目标笔记", + "on_all_matched_notes": "在所有匹配的笔记上", + "create_given_relation": "如果笔记还没有关系,则创建给定关系", + "change_target_note": "或更改现有关系的目标笔记", + "update_relation_target": "更新关系目标" } } diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index b72ca5f8f..1bf413ef8 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -428,6 +428,7 @@ "label_name_title": "Alphanumeric characters, underscore and colon are allowed characters." }, "rename_label": { + "rename_label": "Rename label", "rename_label_from": "Rename label from", "old_name_placeholder": "old name", "to": "To", @@ -463,7 +464,7 @@ "nothing_will_happen": "nothing will happen if note cannot be moved to the target note (i.e. this would create a tree cycle)" }, "rename_note": { - "rename_note_title_to": "Rename note title to:", + "rename_note_title_to": "Rename note title to", "new_note_title": "new note title", "click_help_icon": "Click help icon on the right to see all the options", "evaluated_as_js_string": "The given value is evaluated as JavaScript string and thus can be enriched with dynamic content via the injected note variable (note being renamed). Examples:", @@ -471,5 +472,36 @@ "example_new_title": "NEW: ${note.title} - matched notes titles are prefixed with 'NEW: '", "example_date_prefix": "${note.dateCreatedObj.format('MM-DD:')}: ${note.title} - matched notes are prefixed with note's creation month-date", "api_docs": "See API docs for note and its dateCreatedObj / utcDateCreatedObj properties for details." + }, + "add_relation": { + "add_relation": "Add relation", + "relation_name": "relation name", + "allowed_characters": "Alphanumeric characters, underscore and colon are allowed characters.", + "to": "to", + "target_note": "target note", + "create_relation_on_all_matched_notes": "On all matched notes create given relation." + }, + "delete_relation": { + "delete_relation": "Delete relation", + "relation_name": "relation name", + "allowed_characters": "Alphanumeric characters, underscore and colon are allowed characters." + }, + "rename_relation": { + "rename_relation_from": "Rename relation from", + "old_name": "old name", + "to": "To", + "new_name": "new name", + "allowed_characters": "Alphanumeric characters, underscore and colon are allowed characters." + }, + "update_relation_target": { + "update_relation": "Update relation", + "relation_name": "relation name", + "allowed_characters": "Alphanumeric characters, underscore and colon are allowed characters.", + "to": "to", + "target_note": "target note", + "on_all_matched_notes": "On all matched notes", + "create_given_relation": "create given relation if note doesn't have one yet", + "change_target_note": "or change target note of the existing relation", + "update_relation_target": "Update relation target" } }