Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化文档、添加MacOS一键执行脚本,已包含以下所有大佬的PR。 #104

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ notion-zh_CN 是对notion的汉化脚本。
Notion 已经有了中文语料,让用户能够提前使用中文语料

# 更新日志:
- 2.4.17 notion2.1.23更新,插件重构翻译逻辑`window.LOCALE_SETUP={locale: "ja-JP", messages: {…}, routes: {…}}`
- 2.4.13 日常语料更新 + 安卓版本更新 + 繁体中文补充
- 2.4.2 **翻译开始跟随着官方中文词条啦!!!!!**
- 2.4.1 支持 ios / macos user script
- 2.3.1 权衡后,安卓版本使用新的 runtime 注入方式,实现全部的(包括键盘都能够汉化的方式)但有首页白屏事件较长的问题。
Expand All @@ -39,6 +41,8 @@ Notion 已经有了中文语料,让用户能够提前使用中文语料

# 如何使用?

网页端 以及 windows 端,能够**100% 汉化**,指的是**时间显示也有国际化的能力**,点击所有更新的时间轴中就能看出来,点击?悬浮按钮也能看到。

## 网页端
1. ### 安装油猴插件
此处提供搜索到知乎的一篇教程:https://zhuanlan.zhihu.com/p/128453110
Expand All @@ -50,32 +54,30 @@ Notion 已经有了中文语料,让用户能够提前使用中文语料
https://www.notion.so

## 桌面端
**手动注入:**

### windows
#### 手动注入
1. (自**2.0.4**版本后,任意语言都等价于中文了)
2. notion 安装目录:`C:\Users\用户名\AppData\Local\Programs\Notion\`
3. 打开`C:\Users\用户名\AppData\Local\Programs\Notion\resources\app\renderer`文件夹
4. 下载 `notion-zh_CN.js` 到上述文件夹(renderer)
5. 打开 `preload.js`
6. 在最后一行加上
6. 在最后一行添加
```js
//# sourceMappingURL=preload.js.map
require("./notion-zh_CN") // 添加该行
require("./notion-zh_CN") // 添加该行
```
7. 重启

- 上述操作也可以使用 PowerShell 命令来完成。
#### 自动导入
上述操作也可以使用 PowerShell 命令来完成。
命令执行完成后,在 Notion 中使用 <kbd>CTRL</kbd>+<kbd>R</kbd> 可以热更新界面。
```powershell
Invoke-WebRequest -Uri "https://github.com/Reamd7/notion-zh_CN/releases/latest/download/notion-zh_CN.js" -OutFile "$HOME\AppData\Local\Programs\Notion\resources\app\renderer\notion-zh_CN.js"
Add-Content "$HOME\AppData\Local\Programs\Notion\resources\app\renderer\preload.js" 'require("./notion-zh_CN")'
```

### Mac

网页端 以及 windows 端,能够**100% 汉化**,指的是**时间显示也有国际化的能力**,点击所有更新的时间轴中就能看出来,点击?悬浮按钮也能看到。

#### 手动注入
1. 打开Finder,应用程序,右键`notion.app`,显示应用包内容
2. (自2.0.4版本后,任意语言都等价于中文了)
3. 打开 Notion.app\Contents\Resources\app\renderer\
Expand All @@ -84,29 +86,37 @@ Notion 已经有了中文语料,让用户能够提前使用中文语料
6. 在最后一行加上
```js
//# sourceMappingURL=preload.js.map
require("./notion-zh_CN") // 添加该行
require("./notion-zh_CN") // 添加该行
```
7. 重启

只是 同样打开 Notion.app\Contents\Resources\app\renderer\ 即可。。(安装包显示有同样目录结构)

#### 自动导入
终端输入以下代码即可
```bash
curl -o- -L https://github.com/Reamd7/notion-zh_CN/raw/main/update.sh | bash -s
```
若响应时间过长则可以选择以下命令使用gitee仓库
```bash
curl -o- -L https://gitee.com/hubzyy/notion-zh_CN/raw/main/update.sh | bash -s
```

## cloudflare worker

> 不建议使用。不希望推广。有风险。你需要知道你在干什么。

1. 首页:https://workers.cloudflare.com

2. 注册,登陆,`Start building`,取一个子域名,`Create a Worker`。

2. 注册,登录,`Start building`,取一个子域名,`Create a Worker`。
3. 复制 [worker.js](https://github.com/Reamd7/notion-zh_CN/blob/main/worker.js) 到左侧代码框,修改
```js
const BaseUrl = "xxxx.子域名.workers.dev" // 修改为自己的子域名
```

4. `Save and deploy`。如果正常,右侧应显示提示框:
Mismatch between origin and baseUrl (dev).
好的(这里就证明汉化成功了)
5. 以后可直接访问 `https://xxxx.子域名.workers.dev`。

6. 以后可直接访问 `https://xxxx.子域名.workers.dev`。

## 安卓端

Expand All @@ -115,10 +125,14 @@ Notion 已经有了中文语料,让用户能够提前使用中文语料
# 大家可以做什么?

1. **优化汉化语言**。都是机器翻译,看到不通畅的句子欢迎提issue/pr直接改了 (修改 **`json/zh.json`** 文件,了解之前,先找到原有的英文,韩文对照一下再更新翻译。)
2. **修复bug和改进功能**。如果你发现了任何bug或者有任何改进的意见,请在issue中提出。如果你有能力修复bug或者改进功能,请提交PR。
3. **测试和反馈**。我们需要您的帮助来测试汉化后的软件是否正常工作。如果您在使用过程中发现了任何问题,请在issue中提出。
4. **分享和推广**。如果您认为这个汉化项目很棒,请分享给你的朋友们。您可以在社交媒体上分享这个项目,也可以在其他社区中推广这个项目。
5. **贡献代码**。如果您是一名开发者,欢迎加入我们的开发团队。您可以在github上提交PR,或者联系我们加入开发团队。

# 呼吁:
提高付费率,支持你所支持的软让他发展更好,这样国内市场才会更受重视,而不是只是白嫖,买淘宝,搞教育账户
我们鼓励提高付费率,以支持您钟爱的软件发展壮大。这将使国内市场受到更多重视,而不仅仅是依赖免费使用、购买淘宝或使用教育账户。珍惜您所支持的产品,共同助力其不断进步

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=Reamd7/notion-zh_CN&type=Date)](https://star-history.com/#Reamd7/notion-zh_CN&Date)
[![Star History Chart](https://api.star-history.com/svg?repos=Reamd7/notion-zh_CN&type=Date)](https://star-history.com/#Reamd7/notion-zh_CN&Date)
2 changes: 1 addition & 1 deletion json/cacheZh.json
Original file line number Diff line number Diff line change
Expand Up @@ -10963,7 +10963,7 @@
"spaceSubscriptionBilling.apply.label": "使用",
"spaceSubscriptionBilling.applyCreditButton.label": "使用积分",
"spaceSubscriptionBilling.changePaymentMethod.changeCardButton.label": "更换卡片",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已退款",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已入账",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due": "已到期",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed": "失败",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid": "已付费",
Expand Down
2 changes: 1 addition & 1 deletion json/cacheZh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -10977,7 +10977,7 @@
"spaceSubscriptionBilling.apply.label": "套用",
"spaceSubscriptionBilling.applyCreditButton.label": "使用點數",
"spaceSubscriptionBilling.changePaymentMethod.changeCardButton.label": "變更卡片",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已退款",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已入账",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due": "已到期",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed": "失敗",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid": "已付費",
Expand Down
2 changes: 1 addition & 1 deletion json/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -11035,7 +11035,7 @@
"spaceSubscriptionBilling.apply.label": "使用",
"spaceSubscriptionBilling.applyCreditButton.label": "使用积分",
"spaceSubscriptionBilling.changePaymentMethod.changeCardButton.label": "更换卡片",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已退款",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已入账",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due": "已到期",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed": "失败",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid": "已付费",
Expand Down
2 changes: 1 addition & 1 deletion json/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -11035,7 +11035,7 @@
"spaceSubscriptionBilling.apply.label": "套用",
"spaceSubscriptionBilling.applyCreditButton.label": "使用點數",
"spaceSubscriptionBilling.changePaymentMethod.changeCardButton.label": "變更卡片",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已退款",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已入账",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due": "已到期",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed": "失敗",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid": "已付費",
Expand Down
29 changes: 12 additions & 17 deletions notion-zh_CN.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Notion-zh_CN notion的汉化脚本
// @namespace http://tampermonkey.net/
// @version 2.4.16
// @version 2.4.17
// @description notion的100%汉化脚本,基于官方中文+机器翻译韩文,支持app版本以及网页油猴,地址:https://github.com/reamd7/notion-zh_CN
// @author reamd7
// @match *://www.notion.so/*
Expand All @@ -26,11 +26,7 @@
document.getElementById("notion-app").remove();
}

const script = document.createElement("script");
script.id = "messages";
script.type = "application/json";
script.setAttribute("data-locale", lang);
script.text = JSON.stringify({
const translateText = JSON.stringify({
"AIWaitlist.demoButton.label.web": "观看 1 分钟演示",
"AIWaitlist.invite.copiedText.label.web": "已复制",
"AIWaitlist.invite.copyButton.label.web": "复制",
Expand Down Expand Up @@ -14846,7 +14842,7 @@
"spaceSubscriptionBilling.applyCreditButton.label": "使用积分",
"spaceSubscriptionBilling.changePaymentMethod.changeCardButton.label":
"更换卡片",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已退款",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已入账",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due": "已到期",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed": "失败",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid": "已付费",
Expand Down Expand Up @@ -17230,13 +17226,14 @@
"无法将工作区转移到没有关联 Notion 帐户的邮箱地址。",
"workspaceTransferErrors.reattemptWrongUser.errorMessages":
"不允许重新尝试转移到不同的用户帐户。",
});
})

const routes = document.createElement("script");
routes.id = "routes";
routes.type = "application/json";
routes.setAttribute("data-locale", lang);
routes.text = JSON.stringify({});
const script = document.createElement("script");
script.id = "messages";
script.type = "text/javascript";
script.defer = "defer";
script.setAttribute("data-locale", lang);
script.text = `window.LOCALE_SETUP={locale: "zh-CN", messages: ${translateText}, routes: {}}`

function insertMoment() {
try {
Expand Down Expand Up @@ -17274,7 +17271,7 @@
JSON.stringify(preferredLocale)
); // search window.document.querySelector("#messages") 请阅读
}
} catch (e) {}
} catch (e) { }

if (isElectron) {
var observer = new MutationObserver(function (callback) {
Expand All @@ -17284,7 +17281,6 @@
}).length > 0
) {
document.head.insertAdjacentElement("afterbegin", script);
document.head.insertAdjacentElement("afterbegin", routes);
observer.disconnect();
}
});
Expand All @@ -17298,7 +17294,6 @@
function insert() {
try {
document.body.appendChild(script);
document.body.appendChild(routes);
} catch (e) {
requestAnimationFrame(() => {
insert();
Expand All @@ -17324,7 +17319,7 @@
});
if (!window.__console || !window.__console.push) {
window.__console = {
push: (msg) => {},
push: (msg) => { },
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion notion-zh_TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -14877,7 +14877,7 @@
"spaceSubscriptionBilling.applyCreditButton.label": "使用點數",
"spaceSubscriptionBilling.changePaymentMethod.changeCardButton.label":
"變更卡片",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已退款",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited": "已入账",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due": "已到期",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed": "失敗",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid": "已付費",
Expand Down
2 changes: 1 addition & 1 deletion runtime2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6300,7 +6300,7 @@
"spaceSubscriptionBilling.changeVATIDModal.title": "更改 VAT ID",
"spaceSubscriptionBilling.changeYourAddressModal.title": "更改地址",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.credited":
"已退款",
"已入账",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.due": "已到期",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.failed": "失败",
"spaceSubscriptionBilling.invoicesSection.invoiceStatus.paid": "已付费",
Expand Down