Skip to content

Commit dfa352f

Browse files
Lampesepeter-jerry-ye
authored andcommitted
CONTRIBUTING & Chinese Document
1 parent a6d0601 commit dfa352f

9 files changed

+181
-1
lines changed

CONTRIBUTING-zh.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# 贡献指南
2+
3+
_我们鼓励包括问题报告、拉取 PR,以及任何形式的贡献!_
4+
5+
## :bulb: 提问
6+
7+
请访问我们的论坛 ([英文](https://discuss.moonbitlang.com/)/[中文](https://taolun.moonbitlang.com/))。
8+
简而言之,GitHub 问题不是调试特定项目的地方,而是用于提交错误和功能请求。
9+
10+
## :inbox_tray: 提交问题
11+
12+
在提起 issue 之前,请先检查你使用的是否是 [最新版本](https://www.moonbitlang.com/download/) 的 MoonBit 工具链。如果不是,请先更新 MoonBit 工具链到最新版本并确定问题是否仍然存在。
13+
14+
向项目贡献的一个很好的方式是在遇到问题时提交详细的 issue。我们始终感谢编写完善、详尽的错误报告。:v:
15+
16+
简而言之,作为一名开发者,**请提供一个你自己也愿意收到的 issue**
17+
18+
- 如果你使用的是 [playground](https://try.moonbitlang.com/),只需点击分享图标分享代码:
19+
20+
<img width="600" src="imgs/share_moonbit.png">
21+
22+
- 如果你使用的是 [moon build](https://www.moonbitlang.com/docs/build-system-tutorial/),请提供 `moon version` 和你的操作系统版本的输出。
23+
24+
## :hammer: 贡献代码
25+
26+
我们鼓励贡献者使用 [GitHub 的 Pull Request (PR)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) 来提交他们的贡献,包括但不限于以下的贡献:
27+
- 修正代码/文档中的错误
28+
- 提交缺失的中文翻译或改进翻译
29+
30+
文档分为两部分,一部分为交互式的教程,一部分为静态的详细语言文档。
31+
32+
- 对于交互式教程:可以在[这里](https://github.com/moonbitlang/moonbit-docs/tree/main/moonbit-tour/tour)找到其源码,而中文内容则在[这里](https://github.com/moonbitlang/moonbit-docs/tree/main/moonbit-tour/tour/zh)可以找到。
33+
34+
- 对于静态的详细语言文档:可以在[这里](https://github.com/moonbitlang/moonbit-docs/tree/main/next)找到其源码,而中文内容则在[这里](https://github.com/moonbitlang/moonbit-docs/tree/main/next/locales/zh_CN/LC_MESSAGES)可以找到,需要额外注意到的是,中文内容是使用 gettext 工具生成的,因此需要额外注意其中的翻译文件的格式。
35+
36+
## :scroll: 翻译指南
37+
38+
这里是对于中文文档翻译的一些预期要求:
39+
40+
- 翻译需要尽可能忠于原文,不要出现过于冗余的翻译。
41+
42+
- 为保证美观和可读性,中文与英文相邻时要有空格分隔。
43+
44+
- 非特殊情况下请使用中文标点符号,包括但不限于冒号、逗号、句号、引号、全角括号等。
45+

CONTRIBUTING.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Contributing Guidelines
22

3+
view [CONTRIBUTING-zh.md](./CONTRIBUTING-zh.md) for Chinese version and translate guidelines.
4+
35
_Pull requests, bug reports, and all other forms of contribution are welcomed and highly encouraged!_
46

57
## :bulb: Asking Questions
@@ -19,3 +21,17 @@ In short, since you are most likely a developer, **provide a ticket that you wou
1921
<img width="600" src="imgs/share_moonbit.png">
2022

2123
- If you are using [moon build](https://www.moonbitlang.com/docs/build-system-tutorial/), please provide the output of `moon version` and your OS version.
24+
25+
## :hammer: Contributing Code
26+
27+
We encourage contributors to use [GitHub's Pull Request (PR)](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) to submit their contributions, including but not limited to the following contributions:
28+
- Fix errors in code/documentation
29+
- Submit missing Chinese translations or improve translations
30+
31+
The documentation is divided into two parts: one is the interactive tutorial, and the other is the static detailed language documentation.
32+
33+
- For the interactive tutorial: the source code can be found [here](https://github.com/moonbitlang/moonbit-docs/tree/main/moonbit-tour/tour), and the Chinese content can be found [here](https://github.com/moonbitlang/moonbit-docs/tree/main/moonbit-tour/tour/zh).
34+
35+
- For the static detailed language documentation: the source code can be found [here](https://github.com/moonbitlang/moonbit-docs/tree/main/next), and the Chinese content can be found [here](https://github.com/moonbitlang/moonbit-docs/tree/main/next/locales/zh_CN/LC_MESSAGES), where it should be noted that the Chinese content is generated using the `gettext` tool, so special attention should be paid to the format of the translation files.
36+
37+
If you are interested in translating the documentation, please refer to the [Chinese version Contributing Guidelines](./CONTRIBUTING-zh.md).

README-zh.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# MoonBit 文档网站
22

3+
查看 [README.md](./README.md) 获取英文版本。
4+
35
此存储库托管了 MoonBit 的文档网站 [docs.moonbitlang.com](https://docs.moonbitlang.com)
46

57
打开 `document.code-workspace` 以获得更好的开发体验。可以从终端面板中的 `+` 号选择命令运行,或在命令面板中运行 `Tasks: Run Build Task`
68

79
## 布局
810

911
- `legacy/examples`: 一些 MoonBit 的小示例。
10-
- `next`: 基于 Sphinx 的当前文档,托管在 readthedocs 上。查看 [README](./next/README)
12+
- `next`: 基于 Sphinx 的当前文档,托管在 readthedocs 上。查看 [README](./next/README.md)
1113
- `moonbit-tour`: 一个互动教程。查看 [README](./moonbit-tour/README.md)

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# MoonBit Docs Website
22

3+
view [README-zh.md](./README-zh.md) for Chinese version.
4+
35
This repository hosts the documentation website for MoonBit [docs.moonbitlang.com](https://docs.moonbitlang.com).
46

57
Open `document.code-workspace` for a better development experience. Choose commands to run from either the `+` sign in the Terminal Panel or run `Tasks: Run Build Task` in the command palette.

imgs/share_moonbit.png

48.2 KB
Loading

moonbit-tour/README-zh.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# MoonBit Language Tour
2+
3+
查看该文件的英文版本:[English version](./README.md)
4+
5+
一个用于学习 MoonBit 编程语言的交互式教程。
6+
7+
## 开始
8+
9+
```sh
10+
pnpm install
11+
pnpm build
12+
pnpm preview
13+
```
14+
15+
打开 <http://localhost:3000> 查看 tour 网站。
16+
17+
## 如何添加新的教程
18+
19+
### 添加新的教程
20+
21+
1. 设置开发环境。
22+
23+
```sh
24+
pnpm install
25+
pnpm dev
26+
```
27+
28+
1. 打开 <http://localhost:8080> 查看 tour 网站。
29+
30+
1. 在章节文件夹下创建一个新的文件夹,遵循命名惯例 `lesson<n>_<lesson-name>` (从 1 开始计数)。
31+
32+
1. 在创建的文件夹下编写教程内容(`index.md`),并编写教程代码(`index.mbt`)。
33+
34+
### 添加新的章节
35+
36+
1.`tour` 文件夹下创建一个新的文件夹,遵循命名惯例 `chapter<n>_<chapter-name>`
37+
1. 按照上述步骤添加新的教程。
38+
39+
## 致谢
40+
41+
该项目深受 [Gleam Language Tour](https://github.com/gleam-lang/language-tour) 启发。

moonbit-tour/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# MoonBit Language Tour
22

3+
view the [Chinese version](./README-zh.md) of this file.
4+
35
An interactive tour to learn the MoonBit programming language.
46

57
## Get started

next/README-zh.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Next gen moonbit-docs
2+
3+
查看[README.md](./README.md) 获取英文版本。
4+
5+
基于 Sphinx 的新一代 MoonBit 文档框架。
6+
7+
## 开发指南
8+
9+
### 安装
10+
11+
- 对于 Python 环境,可以在 VSCode 中执行 `> Python: Create Environment` 命令,为 `next` 项目使用 `requirement.txt` 创建环境,或者:
12+
13+
```bash
14+
python3 -m venv .env
15+
source .env/bin/activate
16+
pip install -r requirements.txt
17+
```
18+
19+
- 使用 Latex 构建 PDF 时,需要安装 `latexmk`
20+
- MacOS:
21+
- 安装 [Mactex](https://www.tug.org/mactex/)
22+
- 使用 TeX Live Utility 安装 `latexmk`
23+
24+
### 开发
25+
26+
在 VSCode 中执行 `Watch Document` 任务,或者:
27+
28+
```bash
29+
sphinx-autobuild . ./_build/html
30+
# 或者 sphinx-autobuild -D language='zh_CN' . ./_build/html
31+
```
32+
33+
### 构建
34+
35+
在 VSCode 中执行 `Build Document` 任务,或者:
36+
37+
```bash
38+
make html
39+
python3 -m http.server -d _build/html
40+
```
41+
42+
对于中文版本:
43+
44+
```bash
45+
LANGUAGE="zh_CN" make html
46+
python3 -m http.server -d _build/html
47+
```
48+
49+
对于 PDF:
50+
51+
```bash
52+
make latexpdf
53+
open ./_build/latex/moonbitdocument.pdf
54+
```
55+
56+
对于 Markdown:
57+
58+
```bash
59+
pip install sphinx-markdown-builder
60+
make markdown
61+
```
62+
63+
### 更新翻译模板
64+
65+
在 VSCode 中执行 `Translate Document` 任务,或者:
66+
67+
```bash
68+
make gettext
69+
sphinx-intl update -p _build/gettext -l zh_CN
70+
```

next/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Next gen moonbit-docs
22

3+
view [README-zh.md](./README-zh.md) for Chinese version.
4+
35
A new MoonBit docs framework based on Sphinx.
46

57
## Develop

0 commit comments

Comments
 (0)