mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
rebuild the locale file and add tag button to control tag syncing function
This commit is contained in:
104
src/lang/I18n.ts
104
src/lang/I18n.ts
@@ -1,103 +1,9 @@
|
||||
import {en} from "./en";
|
||||
import {zh} from "./zh";
|
||||
|
||||
export const I18n: { [key: string]: any } = {
|
||||
en: {
|
||||
ribbonIcon: "Share to NotionNext",
|
||||
GeneralSetting: "General information Settings",
|
||||
CommandID: "share-to-notionnext",
|
||||
CommandName: "Share to NotionNext Database",
|
||||
CommandIDGeneral: "share-to-notion",
|
||||
CommandNameGeneral: "Share to Notion General Database",
|
||||
NotionNextButton: "NotionNext Sync",
|
||||
NotionNextButtonDesc: "Open this option, Sync to NotionNext command will be displayed in the command palette (default: ON)",
|
||||
NotionNextSettingHeader: "NotionNext Database Settings",
|
||||
NotionAPI: "Notion API Token",
|
||||
NotionAPIDesc: "Generate from https://www.notion.so/my-integrations",
|
||||
NotionAPIText: "Enter your Notion API Token",
|
||||
DatabaseID: "Database ID",
|
||||
DatabaseIDText: "Enter your Database ID",
|
||||
BannerUrl: "Banner url (optional)",
|
||||
BannerUrlDesc:
|
||||
"Default is empty, if you want to show a banner, please enter the url (like: https://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png)",
|
||||
BannerUrlText: "Enter your banner url",
|
||||
NotionUser: "Notion ID (username, optional)",
|
||||
NotionUserDesc:
|
||||
"Collect from share link likes:https://username.notion.site. Your notion id is [username]",
|
||||
NotionUserText: "Enter your notion ID",
|
||||
NotionGeneralSettingHeader: "General Notion Database Settings",
|
||||
NotionGeneralButton: "Notion General Sync",
|
||||
NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette (default: ON)",
|
||||
NotionCustomTitle: "Customise title property",
|
||||
NotionCustomTitleDesc: "Modify the column name of the Notion database (default: OFF)",
|
||||
NotionCustomTitleName: "Preferred title name",
|
||||
NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database (default: title)",
|
||||
NotionCustomTitleText: "Enter the name",
|
||||
NotYetFinish:
|
||||
"Not finished. This function will be available in the next version",
|
||||
PlaceHolder: "Enter database Name",
|
||||
"notion-logo": "Share to NotionNext",
|
||||
"sync-success": "Sync to NotionNext success: \n",
|
||||
"sync-fail": "Sync to NotionNext fail: \n",
|
||||
"open-notion": "Please open the file that needs to be synchronized",
|
||||
"config-secrets-notion-api":
|
||||
"Please set up the notion API in the settings tab.",
|
||||
"config-secrets-database-id":
|
||||
"Please set up the database id in the settings tab.",
|
||||
"set-tags-fail":
|
||||
"Set tags fail,please check the frontmatter of the file or close the tag switch in the settings tab.",
|
||||
NNonMissing:
|
||||
"The 'NNon' property is missing in the settings. Please set it up.",
|
||||
"set-api-id":
|
||||
"Please set up the notion API and database ID in the settings tab.",
|
||||
NotionCustomSettingHeader: "Notion Custom Database Settings",
|
||||
NotionCustomButton: "Notion Customised command switch",
|
||||
NotionCustomButtonDesc: "Open this option, Sync to Notion Customised Database command will be displayed in the command palette",
|
||||
},
|
||||
zh: {
|
||||
ribbonIcon: "分享到 NotionNext",
|
||||
GeneralSetting: "通用设置",
|
||||
CommandID: "share-to-notionnext",
|
||||
CommandName: "分享到 NotionNext",
|
||||
CommandIDGeneral: "share-to-notion",
|
||||
CommandNameGeneral: "分享到 Notion 普通数据库",
|
||||
NotionNextButton: "NotionNext 同步",
|
||||
NotionNextButtonDesc: "打开此选项,NotionNext 同步将显示在命令面板中(默认:开)",
|
||||
NotionNextSettingHeader: "NotionNext 数据库参数设置",
|
||||
NotionAPI: "Notion API 令牌",
|
||||
NotionAPIDesc: "从 https://www.notion.so/my-integrations 生成",
|
||||
NotionAPIText: "输入你的 Notion API 令牌",
|
||||
DatabaseID: "数据库 ID",
|
||||
DatabaseIDText: "输入你的数据库 ID",
|
||||
BannerUrl: "封面图片地址(可选)",
|
||||
BannerUrlDesc:
|
||||
"默认为空,如果你想显示封面图片,请输入图片地址(例如:https://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png)",
|
||||
BannerUrlText: "输入你的封面图片地址",
|
||||
NotionUser: "Notion ID(用户名,可选)",
|
||||
NotionUserDesc:
|
||||
"数据库分享链接类似:https://username.notion.site/。你的 Notion ID 是 [username]",
|
||||
NotionUserText: "输入你的 Notion ID",
|
||||
NotionGeneralSettingHeader: "普通 Notion 数据库设置",
|
||||
NotionGeneralButton: "普通数据库同步",
|
||||
NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中(默认:开)",
|
||||
NotionCustomTitle: "修改 Notion 数据库表头开关",
|
||||
NotionCustomTitleDesc: "自定义Notion 数据库第一列表头名(默认:关)",
|
||||
NotionCustomTitleName: "想要修改的表头名",
|
||||
NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名(默认:title)",
|
||||
NotionCustomTitleText: "输入表头名",
|
||||
NotYetFinish: "未完成。此功能将在之后版本中提供",
|
||||
PlaceHolder: "输入数据库名称",
|
||||
"notion-logo": "分享到NotionNext",
|
||||
"sync-success": "同步到NotionNext成功:\n",
|
||||
"sync-fail": "同步到NotionNext失败: \n",
|
||||
"open-file": "请打开需要同步的文件",
|
||||
"config-secrets-notion-api": "请在插件设置中添加notion API",
|
||||
"config-secrets-database-id": "请在插件设置中添加database id",
|
||||
"set-tags-fail":
|
||||
"设置标签失败,请检查文件的frontmatter,或者在插件设置中关闭设置tags开关",
|
||||
NNonMissing: "未设置'NNon'属性,请在插件设置中选择NotionNext数据库。",
|
||||
"set-api-id": "请在插件设置中设置notion API和database ID",
|
||||
NotionCustomSettingHeader: "Notion 自定义数据库设置",
|
||||
NotionCustomButton: "Notion 自定义数据库同步命令开关",
|
||||
NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中",
|
||||
},
|
||||
en,
|
||||
zh,
|
||||
};
|
||||
|
||||
export const I18nConfig = (lang: any): any => {
|
||||
|
||||
54
src/lang/en.ts
Normal file
54
src/lang/en.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
export const en = {
|
||||
ribbonIcon: "Share to NotionNext",
|
||||
GeneralSetting: "General information Settings",
|
||||
CommandID: "share-to-notionnext",
|
||||
CommandName: "Share to NotionNext Database",
|
||||
CommandIDGeneral: "share-to-notion",
|
||||
CommandNameGeneral: "Share to Notion General Database",
|
||||
NotionNextButton: "NotionNext Sync",
|
||||
NotionNextButtonDesc: "Open this option, Sync to NotionNext command will be displayed in the command palette (default: ON)",
|
||||
NotionNextSettingHeader: "NotionNext Database Settings",
|
||||
NotionAPI: "Notion API Token",
|
||||
NotionAPIDesc: "Generate from https://www.notion.so/my-integrations",
|
||||
NotionAPIText: "Enter your Notion API Token",
|
||||
DatabaseID: "Database ID",
|
||||
DatabaseIDText: "Enter your Database ID",
|
||||
BannerUrl: "Banner url (optional)",
|
||||
BannerUrlDesc:
|
||||
"Default is empty, if you want to show a banner, please enter the url (like: https://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png)",
|
||||
BannerUrlText: "Enter your banner url",
|
||||
NotionUser: "Notion ID (username, optional)",
|
||||
NotionUserDesc:
|
||||
"Collect from share link likes:https://username.notion.site. Your notion id is [username]",
|
||||
NotionUserText: "Enter your notion ID",
|
||||
NotionGeneralSettingHeader: "General Notion Database Settings",
|
||||
NotionGeneralButton: "Notion General Sync",
|
||||
NotionGeneralButtonDesc: "Open this option, Sync to Notion General Database command will be displayed in the command palette (default: ON)",
|
||||
NotionTagButton: "Notion Tags Sync",
|
||||
NotionTagButtonDesc: "Sync Tags to Notion General Database (default: ON)",
|
||||
NotionCustomTitle: "Customise title property",
|
||||
NotionCustomTitleDesc: "Modify the column name of the Notion database (default: OFF)",
|
||||
NotionCustomTitleName: "Preferred title name",
|
||||
NotionCustomTitleNameDesc: "Enter the preferred title name for the first column of the Notion database (default: title)",
|
||||
NotionCustomTitleText: "Enter the name",
|
||||
NotYetFinish:
|
||||
"Not finished. This function will be available in the next version",
|
||||
PlaceHolder: "Enter database Name",
|
||||
"notion-logo": "Share to NotionNext",
|
||||
"sync-success": "Sync to NotionNext success: \n",
|
||||
"sync-fail": "Sync to NotionNext fail: \n",
|
||||
"open-notion": "Please open the file that needs to be synchronized",
|
||||
"config-secrets-notion-api":
|
||||
"Please set up the notion API in the settings tab.",
|
||||
"config-secrets-database-id":
|
||||
"Please set up the database id in the settings tab.",
|
||||
"set-tags-fail":
|
||||
"Set tags fail,please check the frontmatter of the file or close the tag switch in the settings tab.",
|
||||
NNonMissing:
|
||||
"The 'NNon' property is missing in the settings. Please set it up.",
|
||||
"set-api-id":
|
||||
"Please set up the notion API and database ID in the settings tab.",
|
||||
NotionCustomSettingHeader: "Notion Custom Database Settings",
|
||||
NotionCustomButton: "Notion Customised command switch",
|
||||
NotionCustomButtonDesc: "Open this option, Sync to Notion Customised Database command will be displayed in the command palette",
|
||||
}
|
||||
49
src/lang/zh.ts
Normal file
49
src/lang/zh.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
export const zh = {
|
||||
ribbonIcon: "分享到 NotionNext",
|
||||
GeneralSetting: "通用设置",
|
||||
CommandID: "share-to-notionnext",
|
||||
CommandName: "分享到 NotionNext",
|
||||
CommandIDGeneral: "share-to-notion",
|
||||
CommandNameGeneral: "分享到 Notion 普通数据库",
|
||||
NotionNextButton: "NotionNext 同步",
|
||||
NotionNextButtonDesc: "打开此选项,NotionNext 同步将显示在命令面板中(默认:开)",
|
||||
NotionNextSettingHeader: "NotionNext 数据库参数设置",
|
||||
NotionAPI: "Notion API 令牌",
|
||||
NotionAPIDesc: "从 https://www.notion.so/my-integrations 生成",
|
||||
NotionAPIText: "输入你的 Notion API 令牌",
|
||||
DatabaseID: "数据库 ID",
|
||||
DatabaseIDText: "输入你的数据库 ID",
|
||||
BannerUrl: "封面图片地址(可选)",
|
||||
BannerUrlDesc:
|
||||
"默认为空,如果你想显示封面图片,请输入图片地址(例如:https://minioapi.pjx.ac.cn/img1/2023/11/b7b40a0724e93b7d7ab494bb3b8a2da8.png)",
|
||||
BannerUrlText: "输入你的封面图片地址",
|
||||
NotionUser: "Notion ID(用户名,可选)",
|
||||
NotionUserDesc:
|
||||
"数据库分享链接类似:https://username.notion.site/。你的 Notion ID 是 [username]",
|
||||
NotionUserText: "输入你的 Notion ID",
|
||||
NotionGeneralSettingHeader: "普通 Notion 数据库设置",
|
||||
NotionGeneralButton: "普通数据库同步",
|
||||
NotionGeneralButtonDesc: "打开此选项,同步到普通数据库命令将显示在命令面板中(默认:开)",
|
||||
NotionTagButton: "标签同步开关",
|
||||
NotionTagButtonDesc: "将标签同步到普通数据库(默认:开)",
|
||||
NotionCustomTitle: "修改 Notion 数据库表头开关",
|
||||
NotionCustomTitleDesc: "自定义Notion 数据库第一列表头名(默认:关)",
|
||||
NotionCustomTitleName: "想要修改的表头名",
|
||||
NotionCustomTitleNameDesc: "输入你想要修改的notion数据库的表头名(默认:title)",
|
||||
NotionCustomTitleText: "输入表头名",
|
||||
NotYetFinish: "未完成。此功能将在之后版本中提供",
|
||||
PlaceHolder: "输入数据库名称",
|
||||
"notion-logo": "分享到NotionNext",
|
||||
"sync-success": "同步到NotionNext成功:\n",
|
||||
"sync-fail": "同步到NotionNext失败: \n",
|
||||
"open-file": "请打开需要同步的文件",
|
||||
"config-secrets-notion-api": "请在插件设置中添加notion API",
|
||||
"config-secrets-database-id": "请在插件设置中添加database id",
|
||||
"set-tags-fail":
|
||||
"设置标签失败,请检查文件的frontmatter,或者在插件设置中关闭设置tags开关",
|
||||
NNonMissing: "未设置'NNon'属性,请在插件设置中选择NotionNext数据库。",
|
||||
"set-api-id": "请在插件设置中设置notion API和database ID",
|
||||
NotionCustomSettingHeader: "Notion 自定义数据库设置",
|
||||
NotionCustomButton: "Notion 自定义数据库同步命令开关",
|
||||
NotionCustomButtonDesc: "打开此选项,同步到自定义数据库命令将显示在命令面板中",
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export interface PluginSettings {
|
||||
notionUser: string;
|
||||
proxy: string;
|
||||
GeneralButton: boolean;
|
||||
tagButton: boolean;
|
||||
CustomTitleButton: boolean;
|
||||
CustomTitleName: string;
|
||||
notionAPIGeneral: string;
|
||||
@@ -28,6 +29,7 @@ export const DEFAULT_SETTINGS: PluginSettings = {
|
||||
notionUser: "",
|
||||
proxy: "",
|
||||
GeneralButton: true,
|
||||
tagButton: true,
|
||||
CustomTitleButton: false,
|
||||
CustomTitleName: "",
|
||||
notionAPIGeneral: "",
|
||||
@@ -101,6 +103,7 @@ export class ObsidianSettingTab extends PluginSettingTab {
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.GeneralButton = value;
|
||||
|
||||
this.updateSettingEl(tagButtonEl, value)
|
||||
this.updateSettingEl(CustomTitleEl, value)
|
||||
// name should follow the result of the title button
|
||||
if (value) {
|
||||
@@ -119,6 +122,11 @@ export class ObsidianSettingTab extends PluginSettingTab {
|
||||
})
|
||||
);
|
||||
|
||||
// add the tagButton to control whether to add tags to the general database
|
||||
const tagButtonEl = this.createStyleDiv('tag-button', (this.plugin.settings.GeneralButton && this.plugin.settings.CustomTitleButton));
|
||||
this.createSettingEl(tagButtonEl, i18nConfig.NotionTagButton, i18nConfig.NotionTagButtonDesc, 'toggle', i18nConfig.NotionCustomTitleText, this.plugin.settings.tagButton, 'tagButton')
|
||||
|
||||
// Custom Title Button
|
||||
const CustomTitleEl = this.createStyleDiv('custom-title', this.plugin.settings.GeneralButton);
|
||||
new Setting(CustomTitleEl)
|
||||
.setName(i18nConfig.NotionCustomTitle)
|
||||
@@ -136,8 +144,8 @@ export class ObsidianSettingTab extends PluginSettingTab {
|
||||
})
|
||||
);
|
||||
|
||||
// Custom Title Name
|
||||
const CustomNameEl = this.createStyleDiv('custom-name', (this.plugin.settings.CustomTitleButton && this.plugin.settings.GeneralButton));
|
||||
|
||||
this.createSettingEl(CustomNameEl, i18nConfig.NotionCustomTitleName, i18nConfig.NotionCustomTitleNameDesc, 'text', i18nConfig.NotionCustomTitleText, this.plugin.settings.CustomTitleName, 'CustomTitleName')
|
||||
|
||||
// new Setting(containerEl)
|
||||
|
||||
@@ -59,14 +59,13 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
|
||||
},
|
||||
],
|
||||
},
|
||||
tags: {
|
||||
multi_select:
|
||||
tags && true
|
||||
? tags.map((tag) => {
|
||||
return { name: tag };
|
||||
})
|
||||
: [],
|
||||
},
|
||||
...(this.plugin.settings.tagsButton
|
||||
? {
|
||||
tags: {
|
||||
multi_select: tags && true ? tags.map((tag) => ({ name: tag })) : [],
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
children: childArr,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user