Skip to content

Commit a0d6417

Browse files
maxzhang666CodFrm
andauthored
🌐 Update i18n README.md (#487)
* Update i18n README.md * Update README.md * 🌐 Adjust locales Readme --------- Co-authored-by: 王一之 <yz@ggnb.top>
1 parent 505e112 commit a0d6417

1 file changed

Lines changed: 48 additions & 3 deletions

File tree

src/locales/README.md

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
# i18n Solution
2+
3+
The i18n implementation uses [i18next](https://www.i18next.com/). We chose this over `chrome.i18n` because the latter
4+
does not support dynamic language switching. However, to meet the requirements of certain extension markets, we still
5+
add `chrome.i18n` language files in the `src/assets/_locales` directory.
6+
7+
## Language Files
8+
9+
Language files are located in the `src/locales` directory and are divided by pages, with each page having a
10+
corresponding language file. These files are ultimately merged and exported through `locales.ts`.
11+
12+
## Keyword Conflicts
13+
14+
If keywords in a page are the same but their translations differ, you can distinguish them using the `page.key` format,
15+
for example:
16+
17+
```json
18+
{
19+
"list": {
20+
"confirm_delete": "Are you sure you want to delete? Please note that this is an irreversible operation.",
21+
"confirm_update": "Are you sure you want to update? Please note that this is an irreversible operation."
22+
}
23+
}
24+
```
25+
26+
### Help Us Translate
27+
28+
[Crowdin](https://crowdin.com/project/scriptcat)
29+
is an online localization platform that helps us manage translations. If you're interested in helping us translate ScriptCat, you can find the project on Crowdin and start contributing.
30+
31+
- `src/locales` is the translation file directory for the [extension](https://github.com/scriptscat/scriptcat)
32+
- `public/locales` is the translation file directory for the [script website](https://github.com/scriptscat/scriptlist-frontend)
33+
134
# i18n 方案
235

336
i18n 使用[i8next](https://www.i18next.com/)实现,之所以不是用`chrome.i18n`的原因是该方案不支持动态切换语言。但是为了某些扩展市场的要求,我们还是在`src/assets/_locales`目录下添加了`chrome.i18n`的语言文件。
@@ -10,7 +43,19 @@ i18n 使用[i8next](https://www.i18next.com/)实现,之所以不是用`chrome.
1043

1144
如果页面中的关键字一样,但是翻译不一样,可以使用`page.key`的方式进行区分,例如:
1245

13-
```yaml
14-
list:
15-
confirm_delete: 确定要删除吗?请注意这个操作无法恢复!
46+
```json
47+
{
48+
"list": {
49+
"confirm_delete": "确定要删除吗?请注意这个操作无法恢复!",
50+
"confirm_update": "确定要更新吗?请注意这个操作无法恢复!"
51+
}
52+
}
1653
```
54+
55+
### 帮助我们翻译
56+
57+
[Crowdin](https://crowdin.com/project/scriptcat)
58+
是一个在线的多语言翻译平台。如果您有兴趣帮助我们翻译 ScriptCat 的相关内容,您可以在 Crowdin 上找到 ScriptCat 项目,并开始进行翻译工作。
59+
60+
- `src/locales`[扩展](https://github.com/scriptscat/scriptcat)翻译文件目录
61+
- `public/locales`[脚本站](https://github.com/scriptscat/scriptlist-frontend)的翻译文件目录

0 commit comments

Comments
 (0)