// ==UserScript==
// @name Notion-繁體中文化
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @license MIT
// @description 轉換Notion為繁體中文化
// @author dasu88
// @match *://www.notion.so/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
function I18N() {
this.lang = 'en';
}
I18N.prototype.install = function (langName, keymap) {
if (this[langName] === undefined) {
this[langName] = keymap;
}
};
const I18n = new I18N();
I18n.install('zh', {
'Free Plan': '免費套餐',
"Personal (Education) Plan": '個人(教育)套餐',
'Create or Join Workspace': '建立或加入工作區',
"Windows App": 'Windows應用',
"Mobile App": '移動端應用',
"Web Clipper": '網頁剪裁',
'Log Out (': '登出',
'Quick Find': '快速查詢',
'All Updates': '所有的更新',
'Followed': '已關注',
'Mentions': '提到我的',
'Open notifications settings': '打開訊息設定',
"created": "建立",
"view": "頁面",
"property": "屬性",
"edited": "編輯",
"in": "在",
"Learn about page updates": "學習如何修改頁面",
'Settings & Members': '設定 & 成員',
'Share': '分享',
'Updates': '更新',
'Favorite': '收藏',
'Templates': '模板',
'Import': '匯入',
'Trash': '垃圾桶',
'New Page': '新建頁面',
'Add a Page': '新增一個頁面',
'All workspace members can access these pages': '所有在工作空間中的使用者都能訪問這個頁面',
'Quickly add a page inside': '快速新增一個頁面',
'Delete, duplicate, and more': '刪除,複製或是更多操作',
"Filter...": "篩選...",
"people": "人物",
"animals and nature": "動物與自然",
"food and drink": "食物與飲品",
"activity": "活動",
"travel and places": "交通工具與地點",
"objects": "物品",
"symbols": "符號",
"flags": "標誌",
'Link': '鏈接',
'Upload an Image': '上傳圖片',
"Choose an Image": "選擇圖片",
"Recommended size is 280 × 280 pixels": "推薦大小為280 x 280 像素",
"The maximum size per file is ": "檔案最大大小為",
"Paste an image link...": "輸入圖片鏈接",
"Submit": "提交",
"Works with any image from the web": "符合任何在網路上能訪問到的圖片",
'Remove': '移除',
'No Pages Inside': '沒有更多頁面',
'Default View': '預設檢視',
'Copy Link to View': '複製頁面鏈接',
'Properties': '屬性',
'Group by ': '基於',
'Filter': '過濾',
'Sort': '排序',
'Search': '搜索',
'New': '新增',
'Empty Page': '空頁面',
'New Template': '新的模版',
'Edit': '編輯',
'Hide': '隱藏',
'Create new page': '建立',
'Untitled': '未命名',
'Type a name...': '輸入一個名字...',
'Drag': '拖動',
'Add Icon': '新增圖示',
'Add Cover': '新增封面',
'Add Discussion': '新增議題',
'Drag': '拖動',
'Click': '點選',
'to move': '來移動行',
'to open menu': '打開選單',
'to add a block below': '在下方新增一個編輯區塊',
'Rename, delete, and more...': '重新命名,刪除,及更多...',
'Change icon': '改變圖示',
'Delete': '刪除',
'Duplicate': '重複',
'Turn Into': '換成',
'Style': '風格',
'Small Text': '更小的字型',
'Full Width': '更寬的編輯區',
'Page Lock': '鎖定頁面',
'Add to Favorites': '新增至收藏',
'Open in Windows App': '在客戶端中打開',
'Undo': '撤銷',
'Page History': '歷史修改',
'Show Deleted Pages': '顯示已經刪除的頁面',
'Copy Link': '複製鏈接',
'Rename': '重新命名',
'Move To': '移動到',
'Word Count: ': "字數統計",
'Edit Property': '編輯屬性',
'Comment': '評論',
'Color': '顏色',
'Me': '我',
'My Account': '我的帳號',
'Changes to account settings will apply to all of your workspaces.': '帳戶設定的更改將應用於您的所有工作區。',
'Learn more.': '瞭解更多',
'Photo': '相片',
'Upload Photo': '上傳相片',
'Personal Info': '個人資訊',
'Email': '信箱',
'Change Email': '更改信箱',
'Given Name': '名',
'Family Name': '姓',
'Password': '密碼',
'You can set a permanent password if you don\'t want to use temporary login codes.': '如果您不想使用臨時登錄碼,則可以設定永久密碼。',
'Change Password': '更改密碼',
'Remove Password': '移除密碼',
'Calendar': '日曆',
'Start week on Monday': '一週從星期一開始',
'This will change how all calendars in your app look.': '這將會更改您應用中所有日曆的外觀。',
'Danger Zone': '危險操作',
'Delete My Account': '刪除我的帳號',
'Update': '更新',
'Cancel': '取消',
'My Notifications': '通知',
'Learn about mobile and desktop notifications.': '瞭解有關手機和桌面通知的訊息。',
'Mobile Push Notifications': '向手機推送通知',
'Receive push notifications on mentions and comments immediately via your mobile apps.': '立即通過您的移動應用接收有關提及和評論的推送通知。',
'Email Notifications': '郵件通知',
'Receive email updates on mentions, comments, and edit digests for all the pages you have followed.': '接收有關您關注的所有頁面的提及,評論和編輯摘要的電子郵件更新。',
'My Connected Apps': '已關聯的應用',
'Learn more about embedding content in Notion.': '瞭解更多',
'Connect': '連線',
'Find and embed your files': '查詢和嵌入你的檔案',
'Import notebooks': '匯入筆記',
'Import your boards': '匯入你的看板',
'Import tasks from boards and lists': '從看板和列表匯入任務',
'Earn Credit': '獲取獎勵',
'Learn how to earn and apply credits.': '學習更多',
"Credit Balance": "獲取獎勵",
'Your current credit balance is': '已獲取獎勵為',
'That\\\'s equivalent to': '這相當於',
'month': '個月',
'of free Notion.': '的免費使用',
'Upgrade for free': '免費升級套餐',
'Invite Friends and Earn Credit': '邀請和獎勵',
'You』ll receive': '你將獲得',
'in Notion credit when the person you invite signs up for a Notion account, and they』ll also get': '在Notion中,並且你的朋友也會獲取',
'in credits to get started.': '的獎勵',
'Enter email address...': '輸入信箱地址...',
'Invite': '邀請',
'Other Ways to Earn Credit': '其他方式的獎勵',
'Log in on the Web': '首次登入Web端',
'Sign in to Notion from any web browser': '使用任意瀏覽器登入Notion',
'Log in on the Desktop App': '首次登入客戶端',
'Download the desktop app and sign in': '下載客戶端並登入帳號',
'Log in on the Mobile App': '首次登入移動端',
'Download the mobile app and sign in': '下載移動端並登入帳號',
'Import from Evernote': '從Evernote國際版匯入',
'Import your notes and notebooks': '匯入你的筆記和筆記本',
'Use the Web Clipper': '首次使用剪裁',
'Download the Chrome Extension and save a link': '下載Chrome外掛並儲存鏈接',
'Use the iOS or Android System Share Menu': '使用移動裝置分享',
'Use the share menu to save a link into Notion': '使用手機系統分享鏈接至Notion',
'Total credit earned': '獲取獎勵總額',
'Workspace': '工作空間',
'Settings': '設定',
'Name': '名稱',
'You can use your name or the name of your team. Keep it simple.': '您可以使用您的名字或團隊的名字,來保持簡單化。',
'Icon': '圖示',
'Upload an image or pick an emoji. It will show up in your sidebar and notifications.': '上傳圖片或選擇表情符號。 它將顯示在側邊欄和通知中。',
'Domain': '域名',
'Share the link ': '分享這個鏈接 ',
' to add anyone with an allowed email domain to your workspace.': ' 來新增任何來自該域下擁有信箱賬號的使用者到你的工作空間',
'Allowed Email Domains': '允許的電子信箱域',
'Anyone with email addresses at these domains can automatically join your workspace.': '在這些域中擁有電子郵件地址的任何人都可以自動加入您的工作區。',
'Export Content': '導出',
'Export All Workspace Content': '導出整個工作區',
'Learn about exporting workspaces.': '瞭解更多關於導出工作空間',
'Export Members': '導出使用者',
'Export Members as CSV': '導出使用者表為CSV格式',
'Learn about exporting members.': '瞭解更多關於導出使用者',
'Export Members': '導出使用者',
'Danger Zone': '危險操作',
'Delete Entire Workspace': '刪除整個工作區',
'Learn about deleting workspaces.': '瞭解更多關於刪除工作區',
"Member": '成員',
"Members": '所有成員',
"Groups": '分組',
"Manage members here, or": '在此管理成員,或是',
"set up a domain": '設定一個域名',
", so everyone with allowed email domain can join the workspace automatically.": '如果電子郵件在設定的域名下則會自動加入該工作空間',
"Add a Member": '新增成員',
"User": '使用者',
"Access Level": '訪問級別',
"Admin": '管理員',
"Can change workspace settings and invite new members to the workspace.": '可以更改工作空間設定並邀請新成員加入工作空間。',
"Cannot change workspace settings or invite new members to the workspace.": '無法更改工作空間設定或邀請新成員加入工作空間。',
"Leave Team": '退出團隊',
"Guests (": '訪客 (',
"Convert to ": '轉換為',
"This guest can access these pages": '他可以訪問這些頁面',
"Page": '個頁面',
'Upgrade': '升級',
'Plans': '方案',
'Free': '免費',
'Personal': '個人',
'Team': '團隊',
'Enterprise': '企業',
'Usage': '使用對像',
'Guests': '訪客',
'Blocks': '區塊數量',
'File uploads': '上傳限制',
'Version history': '版本歷史',
'Features': '功能',
'Web, desktop, & mobile apps': 'Web端,客戶端以及移動端使用',
'40+ block types & embeds': '40多種嵌入式區塊型別',
'50+ designer templates': '50多個精心設計的模版',
'Databases with 5 views': '具有5個檢視的資料庫',
'Admin & security features': '管理和安全功能',
'Admin tools': '管理員工具',
'Advanced permissions': '高級許可權控制',
'Bulk PDF export': '批量導出PDF',
'Access new features early': '儘早享受新功能',
'Support': '升級',
'Priority support': '升級',
'Dedicated manager': '升級',
'Custom contract & invoicing': '升級',
'Current Plan': '目前計劃',
'Upgrade': '升級',
'Security & SAML': '安全 & SAML',
'Dark Mode': '夜間模式',
'Open as Page': '作為頁面打開',
'Navigate to this page': '導航到這個頁面',
'Add to': '新增到',
'Press Enter': '按下 Enter 鍵',
' to continue with an empty page': '以空白頁繼續',
', or pick a template': ',或者選擇一個模板',
' (↑↓ to select)': ' (↑↓ 鍵選擇)',
'Press Enter to continue with an empty page, or pick a template': '按下 Enter 鍵產生一個空白頁面或選擇一個模板',
'Empty With Icon': '空白有圖示',
'Empty with icon': '空白有圖示',
'Empty': '空白',
'Database': '資料庫',
'Table': '表格',
'Board': '看板',
'List': '列表',
'Calendar': '日曆',
'Gallery': '相簿',
'Language & region': '語言與地區',
'My account': '我的帳號',
'Account': '帳號',
'Upload photo': '上傳照片',
'Personal info': '個人資訊',
'Change email': '更換信箱',
'Log out of all devices': '從所有裝置登出',
'You will be logged out of all other active sessions besides this one and will have to log back in.': '您將立即登出其他所有上線裝置,並且必須重新登入。',
'Log out': '登出',
'Danger zone': '危險區域',
'Delete my account': '刪除我的帳號',
'Set a password': '設定密碼',
'My notifications': '我的通知',
'Notifications': '通知',
'Mobile push notifications': '行動裝置推送通知',
'Receive push notifications on mentions and comments via your mobile app.': '通過您的行動應用接收有關提及和評論的推送通知。',
'Email notifications': '郵件通知',
'Always send email notifications': '一律發送電子郵件通知',
'Receive updates by email, even when you’re active on the app.': '即使您正在使用該應用,也可以通過電子郵件接收更新。',
'Learn about mobile and desktop notifications': '了解關於行動裝置和桌面應用程式通知',
'My notifications & settings': '我的通知與設定',
'My connected apps': '我的連結 apps',
'Earn credit': '賺取信用',
'Billing': '計費',
'Security & identity': '安全性與身份',
'Integrations': '集成商',
'Members': '成員',
'Add members': '新增成員',
'Share with unlimited members': '與無限會員分享',
'Calendar view': '日曆檢視',
'Group': '群組',
'Groups for': '群組為',
'Group by': '群組依據',
'Connected apps': '連結 apps',
'Learn more about embedding content in Notion': '了解更多關於在Notion中嵌入內容的訊息。',
'Choose a language you\'d like to use with Notion.': '選擇您要使用的語言。',
'Workspace settings': '工作區設定',
'Export members': '導出成員',
'Members': '成員',
'Manage members here.': '管理成員',
'Learn about adding members to your workspace': '了解更多關於在工作區新增成員的資訊。',
'Filter by email or name': '依信箱或名稱篩選',
'Access level': '存取層級',
'Dark mode': '夜間模式',
'Add a view': '建立檢視',
'Copy link to view': '複製連結至檢視',
'New page': '新頁面',
'Add a page': '增加一頁',
'Add a property': '增加屬性',
'View name': '檢視名稱',
'Table with types to store and view any kind of structured data': '表格類形,用於儲存和查看任何類型的結構化資料。',
'Kanban board, great for project planning and bug tracking': '看板類形,非常適合項目規畫和錯誤追蹤。',
'Month view, for event planning and scheduling': '月檢視,適用於活動計劃和安排',
'Grid of cards, use for mood boards, index cards, and recipes': '圖片網格,適用於心情看板、索引卡和選單。',
'Learn how to use database views': '了解如何使用資料庫檢視',
'A simplified page view, great for bookmarks and notes': '簡化的頁面檢視,非常適合書籤和筆記。',
'Create': '建立',
'Learn about databases': '了解關於資料庫',
'New template': '新建模板',
'Templates for': '模版 針對',
'Replicate page formats inside this database with templates.': '在此資料庫中使用模板複製頁面格式。',
'Untitled': '未命名',
'Press Enter to continue with an empty page, or pick a template': '按下 Enter 鍵產生一個空白頁面或選擇一個模板',
'to select': '鍵選擇',
'Empty with icon': '空白包含圖示',
'Use this template': '使用這個模板',
'Design': '設計',
'Roadmap': '地圖',
'User Research Database': '使用者研究資料庫',
'Design Tasks': '設計任務',
'Meeting Notes': '會議筆記',
'Design System': '設計系統',
'Education': '教育',
'Class Notes': '經典筆記',
'Job Applications': '工作申請',
'Grade Calculator': '成績計算',
'Club Homepage': '俱樂部首頁',
'Reading List': '閱讀清單',
'Thesis Planning': '論文規劃',
'Cornell Notes System': '康奈爾筆記系統',
'Personal CRM': '個人CRM',
'Roommate Space': '室友空間',
'Simple Budget': '簡單預算',
'Syllabus': '教學大綱',
'Classroom Home': '教室首頁',
'Lesson Plans': '課程計劃',
'Course Schedule': '課程安排',
'Class Directory': '班級目錄',
'Engineering': '工程類',
'Human resources': '人力資源',
'Marketing': '市場營銷',
'Product management': '專案管理',
'Sales': '銷售類',
'Small text': '小型文字',
'Full width': '最大寬度',
'Page lock': '頁面鎖定',
'Copy link': '複製鏈結',
'Open in Windows app': '以 Windows 應用程式開啟',
'Show deleted pages': '顯示刪除頁面',
'Export': '匯出',
'Move to': '移動至',
'Share or publish to the web': '分享或發佈至網站',
'View past changes to this page': '查看本頁面過去的更改紀錄',
'Show this page in your sidebar': '在側欄中顯示此頁面',
'Learn about importing': '了解關於匯入',
'All pages': '所有頁面',
'In current page': '在目前頁面',
'This pages is in Trash.': '此頁面於垃圾桶內',
'Restore page': '還原頁面',
'Delete permanently': '永久刪除',
'Add view': '新增檢視',
'Add icon': '新增圖示',
'Add cover': '新增封面',
'Add description': '新增描述',
'Layout': '版面',
'Lock database': '鎖定資料庫',
'Duplicate view': '重製檢視',
'Delete view': '刪除檢視',
'Calculate': '計算',
'None': '無',
'Count all': '計算全部',
'Count values': '計算值',
'Count unique values': '計算唯一值',
'Count empty': '計算空白',
'Count not empty': '計算非空白',
'Percent empty': '空置百分比',
'Percent not empty': '百分比不為空',
'Earliest date': '最早日期',
'Latest date': '最晚日期',
'Date range': '日期區間',
'Count': '筆數',
'View options': '檢視選項',
'Search for a view...': '搜尋屬性條件-檢視',
'Date': '日期',
'Tags': '標籤',
'Deleted properties': '刪除屬性',
'Learn about properties': '了解關於屬性設定',
'New property': '新增屬性',
'Hide all': '全部隱藏',
'more': '更多',
'Shown in table': '依表格顯示',
'Add a comment...': '新增評論...',
'RECENT PAGES': '最近開啟頁面',
'Clear': '清除',
'Select': '選擇',
'Open': '開啟',
'Open in a new tab': '在新頁籤開啟',
'Members': '會員',
'Try it free': '免費試用',
'Learn more': '學習更多',
'Try Notion for Teams for a collaborative workspace, unlimited team members, and advanced permissions.': '試用 Notion for Teams 以獲得協作工作區、無限的團隊成員和高級權限。',
'My settings': '我的設定',
'Appearance': '外觀',
'Customize how Notion looks on your device.': '自訂Notion的外觀',
'Open on start': '啟動時開啟',
'Choose what to show when Notion starts or when you switch workspaces.': '選擇啟動Notion或切換工作區時的顯示畫面',
'Cookie settings': 'Cookie 設定',
'Customize cookies. See Cookie Notice for details.': '自訂Cookie',
'Language': '語言',
'Change the language used in the user interface.': '更改要使用的語言界面'
});
const NotionApp = window.document.getElementById('notion-app');
function getTextNode(node) {
const sentences = [];
const _getTextNode = function (node) {
for (let childNode of node.childNodes) {
if (childNode instanceof window.Text) {
if (childNode.data.replace(/[' ']*/, '')) {
sentences.push(childNode);
}
} else if (childNode.placeholder) {
}
_getTextNode(childNode);
}
};
_getTextNode(node);
return sentences;
}
function translate(node) {
const sentences = getTextNode(node);
for (let text of sentences) {
const string = text.data;
if (I18n.zh[string]) {
text.parentNode.replaceChild(new window.Text(I18n.zh[string]), text);
}
}
}
setTimeout(() => {
window.requestIdleCallback(() => {
translate(NotionApp);
const observer = new MutationObserver(function (mutationsList) {
return window.requestIdleCallback(function () {
mutationsList = mutationsList.filter(MutationRecord => {
return MutationRecord.addedNodes.length !== 0;
}).map(MutationRecord => {
return MutationRecord.addedNodes;
});
for (let nodeList of mutationsList) {
for (let node of nodeList) {
translate(node);
}
}
});
});
observer.observe(NotionApp, {
childList: true,
subtree: true
});
});
});
})();