New Notion-Translate for ZH-Ch

Truns Notion to local language

  1. // ==UserScript==
  2. // @name New Notion-Translate for ZH-Ch
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5.1
  5. // @description Truns Notion to local language
  6. // @author Venthanx
  7. // @match *://www.notion.so/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function I18N() {
  16. this.lang = 'en';
  17. }
  18.  
  19. I18N.prototype.install = function(langName, keymap){
  20. if (this[langName] === undefined) {
  21. this[langName] = keymap;
  22. }
  23. };
  24.  
  25. const I18n = new I18N();
  26.  
  27.  
  28. I18n.install('zh', {
  29.  
  30. // 左栏
  31. // -----------------
  32. // 个人工作区
  33. "Personal Plan": '个人套餐',
  34. 'Create work account': '创建工作账号',
  35. 'Add another account': '添加另一个账号',
  36. 'Log out all': '全部注销',
  37. "Get Windows app": '获取Windows应用',
  38. 'Join or create workspace': '加入(创建)工作区',
  39. 'Log out': '注销',
  40.  
  41. 'Close sidebar' : '收起边栏',
  42. //"Mobile App" : '移动端应用',
  43. //"Web Clipper" : '网页剪藏',
  44.  
  45. 'Quick Find': '快速查找',
  46. 'All Updates': '所有的更新',
  47. 'Inbox': '收集箱',
  48. 'Following': '关注中',
  49. 'All': '全部',
  50. 'Archived': '归档',
  51. 'Archive all': '全部归档',
  52. //'Mentions': '提到我的',
  53. //'Open notifications settings': '打开消息设置',
  54. // 消息
  55. //"created" : "创建",
  56. //"view" : "页面",
  57. //"property" : "属性",
  58. //"edited" : "编辑",
  59. //"in" : "在",
  60. //"Learn about page updates" : "学习如何修改页面",
  61. 'Settings & Members': '设置 & 成员',
  62. 'Add a page': '添加一个页面',
  63. 'Templates': '模板',
  64. 'Import': '导入',
  65. 'Trash': '垃圾桶',
  66. //'Share': '分享',
  67. //'Updates': '更新',
  68. //'Favorite': '收藏',
  69. 'New page': '新建页面',
  70. // -----------------
  71. //'All workspace members can access these pages': '所有在工作空间中的用户都能访问这个页面',
  72. 'Quickly add a page inside': '快速添加一个页面',
  73.  
  74. //顶部菜单
  75. // -----------------
  76. 'Share': '分享',
  77. 'Share or publish to the web': '分享/发布此页面',
  78. 'View all comments': '查看全部评论',
  79. 'View all updates': '查看全部更新',
  80. 'Pin this page in your sidebar': '收藏本页至边栏',
  81. //'Style, export, and more': '风格、导出、更多选项..',
  82.  
  83. //【...】
  84. 'Style': '字体风格',
  85. 'Small text': '更小的字体',
  86. 'Full width': '更宽的编辑区',
  87. 'Customize page': '自定义页面',
  88. 'Lock page': '锁定页面',
  89. 'Add to Favorites': '添加至收藏',
  90. 'Copy Link': '复制链接',
  91. 'Open in Windows app': '在客户端中打开',
  92. 'Undo': '撤销',
  93. 'Page history': '历史修改',
  94. 'Show deleted pages': '显示已经删除的页面',
  95. 'Delete': '删除',
  96. 'Import': '导入',
  97. 'Export': '导出',
  98. 'Connect Slack channel': '链接 Slack',
  99. 'Move to': '移动到',
  100. 'Word count: ': "字数统计 ",
  101. 'Duplicate': '创建副本',
  102. 'Turn into': '切换块格式',
  103. 'Turn into page in': '跳转链接',
  104. 'Copy link to block': '拷贝模块链接',
  105. 'Open in new tab': '新标签页打开',
  106. '': '',
  107.  
  108. // -----------------
  109. //快捷菜单【/】
  110. 'Babic blocks': '基础内容块',
  111. 'Text': '文本',
  112. 'Page': '页面',
  113. 'To-do list': '待办任务',
  114. 'Heading 1': 'H1',
  115. 'Heading 2': 'H2',
  116. 'Heading 3': 'H3',
  117. 'Bulleted list': '项目清单',
  118. 'Numbered list': '序列清单',
  119. 'Toggle list': '收展列表',
  120. 'Quote': '引用块',
  121. 'Divider': '分隔线',
  122. 'Link to page': '链接页面',
  123. 'Callout': '插图文本块',
  124.  
  125. 'Block equation': '公式块',
  126. 'Synced block': '同步块',
  127. 'Toggle heading 1': '收展列表级1',
  128. 'Toggle heading 2': '收展列表级2',
  129. 'Toggle heading 3': '收展列表级3',
  130.  
  131. 'Inline': '行内块',
  132. 'Mention a person': '@个人',
  133. 'Mention a page': '@页面',
  134. 'Date or reminder': '@时间',
  135. 'Inline equation': '插入公式',
  136.  
  137. 'Media': '媒体',
  138. 'Image': '图片',
  139. 'Web bookmark': '网页书签',
  140. 'Video': '视频',
  141. 'Audio': '音频',
  142. 'Code': '代码块',
  143. 'File': '文件',
  144.  
  145. 'List format': '序列格式',
  146. 'Default': '默认',
  147. 'Numbers': '数字 1.',
  148. 'Letters': '字母 a.',
  149. 'Roman numerals': '罗马数字 i.',
  150.  
  151.  
  152.  
  153. //'Delete, duplicate, and more': '删除,复制或是更多操作',
  154. // -----------------
  155. //"Filter...": "搜索...",
  156. //"people": "人物",
  157. //"animals and nature": "动物与自然",
  158. //"food and drink": "食物与饮品",
  159. //"activity": "活动",
  160. //"travel and places": "交通工具与地点",
  161. //"objects": "物品",
  162. //"symbols": "符号",
  163. //"flags": "标志",
  164. // -----------------
  165. //'Link': '链接',
  166. // -----------------
  167. //'Upload an Image': '上传图片',
  168. //"Choose an Image": "选择图片",
  169. //"Recommended size is 280 × 280 pixels": "推荐大小为280 x 280 像素",
  170. //"The maximum size per file is ": "文件最大大小为",
  171. // -----------------
  172. //"Paste an image link...": "输入图片链接",
  173. //"Submit": "提交",
  174. //"Works with any image from the web": "只要在网络上能访问到的图片都可以",
  175. // -----------------
  176. //'Remove': '移除',
  177.  
  178. // -----------------
  179. //'No Pages Inside': '没有更多页面',
  180. // -----------------
  181. //'Default View': '默认视图',
  182. // -----------------
  183. //数据库模块
  184. //表头选项
  185. 'Add a view': '新增视图',
  186. 'Copy link to view': '复制页面链接',
  187. 'Properties': '属性',
  188. 'Group': '分组',
  189. 'Filter': '过滤',
  190. 'Sort': '排序',
  191. 'Search': '搜索',
  192. 'New': '新增',
  193. 'Replicate page formats inside this database with templates.': '复制模板中的页面格式到数据库中',
  194. 'New template': '新的模版',
  195. 'Tags': '标签',
  196. 'Created': '创建时间',
  197. 'Hide all': '隐藏全部',
  198. 'Show all': '显示全部',
  199.  
  200.  
  201.  
  202. 'Group by': '分组依据',
  203. 'Learn about databases': '学习更多 Databases',
  204.  
  205. // 'Empty Page': '空页面',
  206. 'Add icon': '添加图标',
  207. 'Add cover': '添加封面',
  208. 'Add description': '添加描述',
  209. 'Add comment': '添加评论',
  210.  
  211. 'Edit': '编辑',
  212. // 块选项
  213. 'Hide': '隐藏',
  214. 'Create new page': '创建',
  215. 'Untitled': '未命名',
  216. 'Type a name...': '输入一个名字...',
  217.  
  218. 'Drag': '拖动',
  219. 'Click': '点击',
  220. 'to move': '拖动模块',
  221. 'to open menu': '打开菜单',
  222. 'to add a block below': '在下方添加一个编辑块',
  223. 'Rename, delete, and more...': '重命名,删除,及更多...',
  224. 'Change icon': '改变图标',
  225.  
  226. //'Turn Into': '换成',
  227.  
  228.  
  229.  
  230. 'Rename': '重命名',
  231. 'Edit property': '编辑属性',
  232. 'Comment': '评论',
  233. 'Color': '颜色',
  234. 'Copy link': '复制链接',
  235.  
  236.  
  237. // 设置
  238. // 设置 => 我的账户
  239. 'Me': '我',
  240. // -----------------
  241. 'My account': '我的账户',
  242. 'Changes to account settings will apply to all of your workspaces.': '帐户设置的更改将应用于您的所有工作区。',
  243. 'Learn more.': '了解更多',
  244. 'Photo': '相片',
  245. 'Upload Photo': '上传相片',
  246. 'Personal Info': '个人信息',
  247. 'Email': '邮箱',
  248. 'Change Email': '更改邮箱',
  249. 'Given Name': '名',
  250. 'Family Name': '姓',
  251. 'Password': '密码',
  252. 'You can set a permanent password if you don\'t want to use temporary login codes.': '如果您不想使用临时登录(不可用)码,则可以设置永久密码。',
  253. 'Change Password': '更改密码',
  254. 'Remove Password': '移除密码',
  255. 'Calendar': '日历',
  256. 'Danger Zone': '危险操作',
  257. 'Delete My Account': '删除我的账户',
  258. 'Update': '更新',
  259. 'Cancel': '取消',
  260. // -----------------
  261. // 设置 => 通知
  262. 'My notifications & settings': '通知',
  263. 'My notifications': '我的通知',
  264. 'Learn about mobile and desktop notifications.': '了解有关手机和桌面通知的消息。',
  265. 'Mobile push notifications': '向手机推送通知',
  266. 'Receive push notifications on mentions and comments via your mobile app.': '立即通过您的移动应用接收有关提及和评论的推送通知。',
  267. 'Email notifications': '邮件通知',
  268. 'Receive email updates on mentions, comments, and edit digests for all the pages you have followed.': '接收有关您关注的所有页面的提及,评论和编辑摘要的电子邮件更新。',
  269. // -----------------
  270. 'My connected apps': '已关联的应用',
  271. 'Learn more about embedding content in Notion.': '了解更多',
  272. 'Connect': '连接',
  273. 'Find and embed your files': '查找和嵌入你的文件',
  274. 'Import notebooks': '导入笔记',
  275. 'Import your boards': '导入你的看板',
  276. 'Import tasks from boards and lists': '从看板和列表导入任务',
  277. // -----------------
  278. 'Language & region': '语言与地区',
  279. 'Language': '语言',
  280. 'Change the language used in the user interface.': '更改用户界面中使用的语言。',
  281. 'Start week on Monday': '一周从星期一开始',
  282. 'This will change how all calendars in your app look.': '这将会更改您应用中所有日历的外观。',
  283. // -----------------
  284. 'Earn credit': '获取奖励',
  285. 'Learn how to earn and apply credits.': '学习更多',
  286. "Credit Balance": "获取奖励",
  287. 'Your current credit balance is': '已获取奖励为',
  288. 'That\\\'s equivalent to': '这相当于',
  289. 'month': '个月',
  290. 'of free Notion.': '的免费使用',
  291. 'Upgrade for free': '免费升级套餐',
  292. 'Invite Friends and Earn Credit': '邀请和奖励',
  293. 'You’ll receive': '你将获得',
  294. 'in Notion credit when the person you invite signs up for a Notion account, and they’ll also get': '在Notion中,并且你的朋友也会获取',
  295. 'in credits to get started.': '的奖励',
  296. 'Enter email address...': '输入邮箱地址...',
  297. 'Invite': '邀请',
  298. 'Other Ways to Earn Credit': '其他方式的奖励',
  299. 'Log in on the Web': '首次登陆Web端',
  300. 'Sign in to Notion from any web browser': '使用任意浏览器登陆Notion',
  301. 'Log in on the Desktop App': '首次登陆客户端',
  302. 'Download the desktop app and sign in': '下载客户端并登陆账户',
  303. 'Log in on the Mobile App': '首次登陆移动端',
  304. 'Download the mobile app and sign in': '下载移动端并登陆账户',
  305. 'Import from Evernote': '从Evernote国际版导入',
  306. 'Import your notes and notebooks': '导入你的笔记和笔记本',
  307. 'Use the Web Clipper': '首次使用剪藏',
  308. 'Download the Chrome Extension and save a link': '下载Chrome插件并保存链接',
  309. 'Use the iOS or Android System Share Menu': '使用移动设备分享',
  310. 'Use the share menu to save a link into Notion': '使用手机系统分享链接至Notion',
  311. 'Total credit earned': '获取奖励总额',
  312. // -----------------
  313. 'Workspace': '工作空间',
  314. // -----------------
  315. 'Settings': '设置',
  316. 'Name': '名称',
  317. 'You can use your name or the name of your team. Keep it simple.': '您可以使用您的名字或团队的名字,来保持简单化。',
  318. 'Icon': '图标',
  319. 'Upload an image or pick an emoji. It will show up in your sidebar and notifications.': '上传图片或选择表情符号。 它将显示在侧边栏和通知中。',
  320. 'Domain': '域名',
  321. 'Share the link ': '分享这个链接 ',
  322. ' to add anyone with an allowed email domain to your workspace.': ' 来添加任何来自该域下拥有邮箱账号的用户到你的工作空间',
  323. 'Allowed Email Domains': '允许的电子邮箱域',
  324. 'Anyone with email addresses at these domains can automatically join your workspace.': '在这些域中拥有电子邮件地址的任何人都可以自动加入您的工作区。',
  325. 'Export Content': '导出',
  326. 'Export All Workspace Content': '导出整个工作区',
  327. 'Learn about exporting workspaces.': '了解更多关于导出工作空间',
  328. 'Export Members': '导出用户',
  329. 'Export Members as CSV': '导出用户表为CSV格式',
  330. 'Learn about exporting members.': '了解更多关于导出用户',
  331. 'Export Members': '导出用户',
  332. 'Danger Zone': '危险操作',
  333. 'Delete Entire Workspace': '删除整个工作区',
  334. 'Learn about deleting workspaces.': '了解更多关于删除工作区',
  335. // -----------------
  336. "Member": '成员',
  337. "Members": '所有成员',
  338. "Groups": '分组',
  339. "Manage members here, or": '在此管理成员,或是',
  340. "set up a domain": '设置一个域名',
  341. ", so everyone with allowed email domain can join the workspace automatically.": '如果电子邮件在设置的域名下则会自动加入该工作空间',
  342. "Add a Member": '添加成员',
  343. "User": '用户',
  344. "Access Level": '访问级别',
  345. "Admin": '管理员',
  346. "Can change workspace settings and invite new members to the workspace.": '可以更改工作空间设置并邀请新成员加入工作空间。',
  347. "Cannot change workspace settings or invite new members to the workspace.": '无法更改工作空间设置或邀请新成员加入工作空间。',
  348. "Leave Team": '退出团队',
  349. "Guests (": '访客 (',
  350. "Convert to ": '转换为',
  351. "This guest can access these pages": '他可以访问这些页面',
  352. //"Page": '个页面',
  353. // -----------------
  354. 'Upgrade': '升级',
  355. 'Plans': '方案',
  356. 'Free': '免费',
  357. 'Personal': '个人',
  358. 'Team': '团队',
  359. 'Enterprise': '企业',
  360. 'Usage': '使用对象',
  361. 'Guests': '访客',
  362. 'Blocks': '块数量',
  363. 'File uploads': '上传限制',
  364. 'Version history': '版本历史',
  365. 'Features': '功能',
  366. 'Web, desktop, & mobile apps': 'Web端,客户端以及移动端使用',
  367. '40+ block types & embeds': '40多种嵌入式块类型',
  368. '50+ designer templates': '50多个精心设计的模版',
  369. 'Databases with 5 views': '具有5个视图的数据库',
  370. 'Admin & security features': '管理和安全功能',
  371. 'Admin tools': '管理员工具',
  372. 'Advanced permissions': '高级权限控制',
  373. 'Bulk PDF export': '批量导出PDF',
  374. 'Access new features early': '尽早享受新功能',
  375. 'Support': '升级',
  376. 'Priority support': '升级',
  377. 'Dedicated manager': '升级',
  378. 'Custom contract & invoicing': '升级',
  379. 'Current Plan': '当前计划',
  380. 'Upgrade': '升级',
  381. 'Security & SAML': '安全 & SAML',
  382. 'Dark Mode': '夜间模式',
  383. // 新建页面
  384. 'Open as Page': '作为页面打开',
  385. 'Navigate to this page': '导航到这个页面',
  386. 'Add to': '添加到',
  387. 'Press Enter': '按下 Enter 键',
  388. ' to continue with an empty page': '以空白页继续',
  389. ', or pick a template': ',或者选择一个模板',
  390. ' (↑↓ to select)': ' (↑↓ 键选择)',
  391. 'Empty With Icon': '空白有图标',
  392. 'Empty': '空白',
  393. 'Database': '数据库',
  394. 'Table': '表格',
  395. 'Board': '看板',
  396. 'List': '列表',
  397. 'Calendar': '日历',
  398. 'Gallery': '图库',
  399. 'Timeline': '时间线'
  400. });
  401.  
  402. const NotionApp = window.document.getElementById('notion-app');
  403.  
  404. function getTextNode(node) {
  405. const sentences = [];
  406.  
  407. const _getTextNode = function(node) {
  408. for (let childNode of node.childNodes) {
  409. if (childNode instanceof window.Text) {
  410. if (childNode.data.replace(/[' ']*/, '')) {
  411. sentences.push(childNode);
  412. }
  413. } else if (childNode.placeholder) {
  414.  
  415. }
  416. _getTextNode(childNode);
  417. }
  418. };
  419. _getTextNode(node);
  420. return sentences;
  421. }
  422.  
  423. function translate(node) {
  424. const sentences = getTextNode(node);
  425. for (let text of sentences) {
  426. const string = text.data;
  427. if (I18n.zh[string]) {
  428. text.parentNode.replaceChild(new window.Text(I18n.zh[string]), text);
  429. }
  430. }
  431. }
  432.  
  433. setTimeout(() => {
  434. window.requestIdleCallback(() => {
  435. translate(NotionApp);
  436.  
  437. const observer = new MutationObserver(function(mutationsList) {
  438. return window.requestIdleCallback(function() {
  439. mutationsList = mutationsList.filter(MutationRecord => {
  440. return MutationRecord.addedNodes.length !== 0;
  441. }).map(MutationRecord => {
  442. return MutationRecord.addedNodes;
  443. });
  444.  
  445. for (let nodeList of mutationsList) {
  446. for (let node of nodeList) {
  447. translate(node);
  448. }
  449. }
  450. });
  451. });
  452.  
  453. observer.observe(NotionApp, {
  454. childList: true,
  455. subtree: true
  456. });
  457. });
  458. });
  459. })();
  460.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址