mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-30 00:48:36 +08:00
initialise the NNon value and add i18n
This commit is contained in:
@@ -7,13 +7,19 @@ export const NoticeMsg: {[key: string]:any} = {
|
|||||||
"config-secrets-notion-api": "Please set up the notion API in the settings tab.",
|
"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.",
|
"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.",
|
"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."
|
||||||
},
|
},
|
||||||
"zh": {
|
"zh": {
|
||||||
"notion-logo": "分享到NotionNext",
|
"notion-logo": "分享到NotionNext",
|
||||||
"sync-success": "同步到NotionNext成功:\n",
|
"sync-success": "同步到NotionNext成功:\n",
|
||||||
"sync-fail": "同步到NotionNext失败: \n",
|
"sync-fail": "同步到NotionNext失败: \n",
|
||||||
"open-file": "请打开需要同步的文件",
|
"open-file": "请打开需要同步的文件",
|
||||||
|
"config-secrets-notion-api": "请在插件设置中添加notion API",
|
||||||
|
"config-secrets-database-id": "请在插件设置中添加database id",
|
||||||
"set-tags-fail": "设置标签失败,请检查文件的frontmatter,或者在插件设置中关闭设置tags开关",
|
"set-tags-fail": "设置标签失败,请检查文件的frontmatter,或者在插件设置中关闭设置tags开关",
|
||||||
|
"NNonMissing": "未设置'NNon'属性,请在插件设置中选择NotionNext数据库。",
|
||||||
|
"set-api-id": "请在插件设置中设置notion API和database ID"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
28
src/i18n.ts
Normal file
28
src/i18n.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
export const i18n: { [key: string]: any } = {
|
||||||
|
"en": {
|
||||||
|
NotionNextVersion: "NotionNext Version Database",
|
||||||
|
NotionNextVersionDesc: "Turn on this option if you are using NotionNext",
|
||||||
|
NotionNextSetting: "NotionNext Database Settings",
|
||||||
|
NotionAPI: "Notion API Token",
|
||||||
|
NotionAPIDesc: "It's a secret",
|
||||||
|
NotionID: "Database ID",
|
||||||
|
BannerUrl: "Banner url(optional)",
|
||||||
|
BannerUrlDesc: "page banner url(optional), default is empty, if you want to show a banner, please enter the url(like:https://raw.githubusercontent.com/EasyChris/obsidian-to-notion/ae7a9ac6cf427f3ca338a409ce6967ced9506f12/doc/2.png)",
|
||||||
|
NotionUser: "Notion ID(username, optional)",
|
||||||
|
NotionGeneralSetting: "General Notion Database Settings",
|
||||||
|
NotYetFinish: "Not finished. This function will be available in the next version",
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
NotionNextVersion: "NotionNext 版本数据库",
|
||||||
|
NotionNextVersionDesc: "如果你使用的是NotionNext,请打开此选项",
|
||||||
|
NotionNextSetting: "NotionNext 数据库参数设置",
|
||||||
|
NotionAPI: "Notion API 令牌",
|
||||||
|
NotionAPIDesc: "显示为密码",
|
||||||
|
NotionID: "数据库 ID",
|
||||||
|
BannerUrl: "封面图片地址(可选)",
|
||||||
|
BannerUrlDesc: "页面封面图片地址(可选),默认为空,如果你想显示封面图片,请输入图片地址(例如:https://raw.githubusercontent.com/EasyChris/obsidian-to-notion/ae7a9ac6cf427f3ca338a409ce6967ced9506f12/doc/2.png)",
|
||||||
|
NotionUser: "Notion ID(用户名,可选)",
|
||||||
|
NotionGeneralSetting: "普通 Notion 数据库设置",
|
||||||
|
NotYetFinish: "未完成。此功能将在之后版本中提供",
|
||||||
|
},
|
||||||
|
}
|
||||||
25
src/main.ts
25
src/main.ts
@@ -19,7 +19,7 @@ interface PluginSettings {
|
|||||||
const langConfig = NoticeMConfig(window.localStorage.getItem('language') || 'en')
|
const langConfig = NoticeMConfig(window.localStorage.getItem('language') || 'en')
|
||||||
|
|
||||||
const DEFAULT_SETTINGS: PluginSettings = {
|
const DEFAULT_SETTINGS: PluginSettings = {
|
||||||
NNon: true,
|
NNon: undefined,
|
||||||
notionAPI: "",
|
notionAPI: "",
|
||||||
databaseID: "",
|
databaseID: "",
|
||||||
bannerUrl: "",
|
bannerUrl: "",
|
||||||
@@ -65,13 +65,22 @@ export default class ObsidianSyncNotionPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async upload() {
|
async upload() {
|
||||||
const {NNon, notionAPI, databaseID} = this.settings;
|
const { notionAPI, databaseID, NNon} = this.settings;
|
||||||
if (notionAPI === "" || databaseID === "") {
|
|
||||||
new Notice(
|
// Check if NNon exists
|
||||||
"Please set up the notion API and database ID in the settings tab."
|
if (NNon === undefined) {
|
||||||
);
|
const NNonmessage = NoticeMConfig(window.localStorage.getItem('language') || 'en')["NNonMissing"];
|
||||||
|
new Notice(NNonmessage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the user has set up the Notion API and database ID
|
||||||
|
if (notionAPI === "" || databaseID === "") {
|
||||||
|
const setAPIMessage = NoticeMConfig(window.localStorage.getItem('language') || 'en')["set-api-id"];
|
||||||
|
new Notice(setAPIMessage);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const {markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime} = await this.getNowFileMarkdownContent(this.app);
|
const {markDownData, nowFile, emoji, cover, tags, type, slug, stats, category, summary, paword, favicon, datetime} = await this.getNowFileMarkdownContent(this.app);
|
||||||
|
|
||||||
|
|
||||||
@@ -254,9 +263,7 @@ class ObsidianSettingTab extends PluginSettingTab {
|
|||||||
containerEl.createEl('h2', {text: 'General Notion Database Settings'});
|
containerEl.createEl('h2', {text: 'General Notion Database Settings'});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName("Not finished")
|
.setName("Not finished. This function will be available in the next version")
|
||||||
.setDesc("This functio will be available in the next version");
|
|
||||||
|
|
||||||
|
|
||||||
// new Setting(containerEl)
|
// new Setting(containerEl)
|
||||||
// .setName("Convert tags(optional)")
|
// .setName("Convert tags(optional)")
|
||||||
|
|||||||
Reference in New Issue
Block a user