Skip to content

Commit a5f4ed2

Browse files
authored
docs: add Chinese of developer guide (#511)
* docs: add Chinese of developer guide * docs: apply comments
1 parent 37f381e commit a5f4ed2

File tree

22 files changed

+745
-787
lines changed

22 files changed

+745
-787
lines changed

docs/karpor/4-developer-guide/1-contribution-guide/2-code-contribute.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This guide will help you get started with Karpor development.
2020
<details>
2121
<summary>Installing Golang</summary>
2222

23-
1. Install go1.19 from the [official website](https://go.dev/dl/). Extract the binary files and place them at a location, assuming it is located under the home directory `~/go/`, here is an example command, you should choose the correct binary file for your system.
23+
1. Install go1.19+ from the [official website](https://go.dev/dl/). Extract the binary files and place them at a location, assuming it is located under the home directory `~/go/`, here is an example command, you should choose the correct binary file for your system.
2424

2525
```
2626
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz

docs/karpor/4-developer-guide/2-conventions/2-code-conventions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ In this section, you will find the code conventions for all kinds of code Karpor
1010

1111
## Go Code Conventions
1212

13-
- [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
14-
- [Effective Go](https://golang.org/doc/effective_go.html)
13+
- [Go Code Review Comments](https://go.dev/wiki/CodeReviewComments)
14+
- [Effective Go](https://go.dev/doc/effective_go)
1515
- Know and avoid [Go landmines](https://gist.github.com/lavalamp/4bd23295a9f32706a48f)
1616
- Comment your code.
1717

docs/karpor/4-developer-guide/2-conventions/3-test-conventions.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,5 +265,3 @@ It is worth noting that most mainstream IDEs have already integrated [gotests](h
265265
- `t.Errorf("Error occurred")`
266266
- `fmt.Println("Error occurred")`
267267
- `panic("Error occurred")`
268-
269-
When a test fails, output clear and understandable error messages to help developers locate the problem.
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
---
2-
title: Non-code Contribution Guide
2+
title: 非代码贡献指南
33
---
4-
You can contribute in any of the following ways that interest you.
4+
你可以用以下任何感兴趣的方式贡献。
55

6-
## Contributing Use Cases and Demos
6+
## 贡献用户示例和 Demo
77

8-
* If you are using Karpor, the simplest way to contribute is to [express gratitude to the community](https://github.com/KusionStack/karpor/issues/343).
8+
* 如果你正在使用 Karpor,最简单的贡献方式就是 [向社区表达感谢](https://github.com/KusionStack/karpor/issues/343)
99

10-
## Reporting Bugs
10+
## 报告漏洞
1111

12-
Before submitting a new issue, please make sure that no one has already reported the problem.
12+
在提交新的 issue 之前,请确保该问题没有被提交过。
1313

14-
Check the [Issue list](https://github.com/KusionStack/karpor/issues) for any similar issues.
14+
检查 [Issue 列表](https://github.com/KusionStack/karpor/issues) 是否有类似 issue。
1515

16-
[Report bugs](https://github.com/KusionStack/karpor/issues/new?assignees=&labels=kind%2Fbug&projects=&template=bug-report.yaml) by submitting a Bug report, ensuring you provide as much information as possible to help reproduce the Bug.
16+
通过 [报告漏洞](https://github.com/KusionStack/karpor/issues/new?assignees=&labels=kind%2Fbug&projects=&template=bug-report.yaml) 提交漏洞报告,确保你提供了足够的信息帮助复现该漏洞。
1717

18-
Follow the issue template and add additional information to help us replicate the issue.
18+
遵循下面的 issue 模板并且添加额外信息来帮助我们复现该问题。
1919

20-
## Security Issues
20+
## 安全性 issue
2121

22-
If you believe you have discovered a security vulnerability, please read our [security policy](https://github.com/KusionStack/karpor/blob/main/SECURITY.md) for more detailed information.
22+
如果你确信发现了安全漏洞,请阅读我们的 [安全策略](https://github.com/KusionStack/karpor/blob/main/SECURITY.md) 获取更多细节。
2323

24-
## Suggesting Enhancements
24+
## 提议增强特性
2525

26-
If you have ideas to improve Karpor, please submit a [feature request](https://github.com/KusionStack/karpor/issues/new?assignees=&labels=kind%2Ffeature&projects=&template=enhancement.yaml).
26+
如果你有提升 Karpor 的好点子,请提交 [特性请求](https://github.com/KusionStack/karpor/issues/new?assignees=&labels=kind%2Ffeature&projects=&template=enhancement.yaml)
2727

28-
## Answering Questions
28+
## 回答问题
2929

30-
If you have a question and cannot find the answer in the [documentation](https://www.kusionstack.io/karpor/), the next step is to ask on [GitHub Discussions](https://github.com/KusionStack/karpor/discussions).
30+
如果你有疑问并且在 [文档](https://www.kusionstack.io/karpor/) 中找不到答案,下一步是在 [GitHub 论坛](https://github.com/KusionStack/karpor/discussions) 中提问。
3131

32-
Helping these users is important to us, and we would love to have your help. You can contribute by answering [their questions](https://github.com/KusionStack/karpor/discussions) to help other Karpor users.
32+
帮助这些用户对我们很重要,我们很需要你的帮助。你可以通过回答 [他们的问题](https://github.com/KusionStack/karpor/discussions) 来帮助其他的 Karpor 用户。
3333

34-
## Contributing Documentation
34+
## 贡献文档
3535

36-
Contributing to the documentation requires some knowledge on how to submit a pull request to Github, which I think won't be difficult if you follow the guide.
36+
贡献文档需要一些提交 pull request Github 的知识,按照下面的指南这将会非常简单。
3737

38-
* [kusionstack.io Developer's Guide](https://github.com/KusionStack/kusionstack.io/blob/main/README.md)
38+
* [kusionstack.io 开发者指南](https://github.com/KusionStack/kusionstack.io/blob/main/README.md)
3939

40-
For more ways to contribute, please look at the [Open Source Guide](https://opensource.guide/how-to-contribute/).
40+
查看 [开源指南](https://opensource.guide/how-to-contribute/) 获取更多贡献方式。
Original file line numberDiff line numberDiff line change
@@ -1,174 +1,174 @@
11
---
2-
title: Code Contribution Guide
2+
title: 代码贡献指南
33
---
4-
In this code contribution guide, you will learn about the following:
4+
在本代码贡献指南,你将会了解下列内容:
55

6-
- [How to run Karpor locally](#running-karpor-locally)
7-
- [How to create a pull request](#creating-a-pull-request)
8-
- [Code review guidelines](#code-review)
9-
- [Formatting guidelines for pull requests](#formatting-guidelines)
10-
- [Updating Documentation and Website](#updating-documentation-and-website)
6+
- [如何在本地运行 Karpor](#%E5%A6%82%E4%BD%95%E5%9C%A8%E6%9C%AC%E5%9C%B0%E8%BF%90%E8%A1%8C-karpor)
7+
- [如何创建拉取请求(pull request](#%E5%88%9B%E5%BB%BA%E6%8B%89%E5%8F%96%E8%AF%B7%E6%B1%82pull-request)
8+
- [代码审查指导规则](#%E4%BB%A3%E7%A0%81%E5%AE%A1%E6%9F%A5)
9+
- [Pull request 格式指南](#pull-request-%E6%A0%BC%E5%BC%8F%E6%8C%87%E5%8D%97)
10+
- [更新文档和网站](#%E6%9B%B4%E6%96%B0%E6%96%87%E6%A1%A3%E5%92%8C%E7%BD%91%E7%AB%99)
1111

12-
## Running Karpor Locally
12+
## 如何在本地运行 Karpor
1313

14-
This guide will help you get started with Karpor development.
14+
本指南将会帮助你开始 Karpor 开发。
1515

16-
### Prerequisites
16+
### 前提条件
1717

18-
* Golang version 1.19+
18+
* Golang 版本 1.19+
1919

2020
<details>
21-
<summary>Installing Golang</summary>
21+
<summary>安装 Golang</summary>
2222

23-
1. Install go1.19 from the [official website](https://go.dev/dl/). Extract the binary files and place them at a location, assuming it is located under the home directory `~/go/`, here is an example command, you should choose the correct binary file for your system.
23+
1. [官方网站](https://go.dev/dl/) 安装 golang 1.19+。解压二进制文件并放置到某个位置,假设该位置是 home 目录下的 `~/go/`,下面是一个示例命令,你应当选择适合你系统的正确二进制文件。
2424

2525
```
2626
wget https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
2727
tar xzf go1.20.2.linux-amd64.tar.gz
2828
```
2929

30-
If you would like to maintain multiple versions of golang in your local development environment, you can download the package and extract it to a location, like `~/go/go1.19.1`, and then alter the path in the command below accordingly.
30+
如果你想在本地开发环境维护多个 golang 版本,你可以下载包并解压到某个位置,比如 `~/go/go1.19.1`,然后根据下面的命令相应地改变路径。
3131

32-
1. Set environment variables for Golang
32+
1. Golang 设置环境变量
3333

3434
```
3535
export PATH=~/go/bin/:$PATH
3636
export GOROOT=~/go/
3737
export GOPATH=~/gopath/
3838
```
3939

40-
If the `gopath` folder does not exist, create it with `mkdir ~/gopath`. These commands will add the go binary folder to the `PATH` environment variable (making it the primary choice for go) and set the `GOROOT` environment to this go folder. Please add these lines to your `~/.bashrc` or `~/.zshrc` file, so you won't need to set these environment variables every time you open a new terminal.
40+
如果 `gopath` 目录不存在,可以使用 `mkdir ~/gopath` 创建。这些命令将会把 go 二进制文件所在的目录添加到 `PATH` 环境变量 (让其成为 go 命令的优先选择)并且设置 `GOROOT` 环境到该 go 目录。如果将这些行添加到你的 `~/.bashrc` or `~/.zshrc` 文件,你就不用每次打开新的终端时设置这些环境变量。
4141

42-
1. (Optional) Some regions, such as China, may have slow connection to the default go registry; you can configure GOPROXY to speed up the download process.
42+
1. (可选) 在一些地区,例如中国大陆,连接到默认的 go 仓库可能会很慢;你可以配置 GOPROXY 来加速下载过程。
4343

4444
```
4545
go env -w GOPROXY=https://goproxy.cn,direct
4646
```
4747

4848
</details>
4949

50-
* Kubernetes version v1.20+ configured with `~/.kube/config`.
51-
* golangci-lint version v1.52.2+, it will be installed automatically if you run `make lint`, if the installation fails, you can install it manually.
50+
* Kubernetes 版本 v1.20+ ,且配置文件保存在 `~/.kube/config`
51+
* golangci-lint 版本 v1.52.2+, 通过运行 `make lint` 可以自动安装,如果自动安装失败,你可以手动安装。
5252

5353
<details>
54-
<summary>Manually installing golangci-lint</summary>
54+
<summary>手动安装 golangci-lint</summary>
5555

56-
You can install it manually following the [guide](https://golangci-lint.run/welcome/install), or use the command:
56+
你可以根据 [安装指南](https://golangci-lint.run/welcome/install)手动安装,或者使用以下命令:
5757

5858
```
5959
cd ~/go/ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2
6060
```
6161

6262
</details>
6363

64-
### Building
64+
### 构建
6565

66-
- Clone this project
66+
- 克隆项目
6767

6868
```shell
6969
git clone [email protected]:KusionStack/karpor.git
7070
```
7171

72-
- Build locally
72+
- 本地构建
7373

74-
Executing `make build-all` will build the executables for all platforms; if you only want to build for a specific platform, execute `make build-${PlatformName}`, e.g., `make build-darwin`. To see all available commands, execute `make help`.
74+
执行 `make build-all` 将会为所有平台创建可执行文件;如果你只想为特定平台构建,执行 `make build-${PlatformName}`,例如 `make build-darwin`。查看所有可用命令,执行 `make help`
7575

76-
### Testing
76+
### 测试
7777

78-
It's essential to write tests to maintain code quality, you can run all unit tests by executing the following command in the project root directory:
78+
为了保证代码质量,编写测试代码是必不可少的,你可以在项目根目录运行以下命令执行单元测试:
7979

8080
```shell
8181
make test
8282
```
8383

84-
If you need to generate extra coverage report files, execute:
84+
如果你需要生成额外的覆盖率报告,执行:
8585

8686
```shell
8787
make cover
8888
```
8989

90-
Then you can view the content of the coverage report in a browser by running:
90+
接下来你可以执行下列命令,来从浏览器中阅读测试覆盖率报告:
9191

9292
```shell
9393
make cover-html
9494
```
9595

96-
## Creating a Pull Request
96+
## 创建拉取请求(Pull Request
9797

98-
We are thrilled that you are considering contributing to the Karpor project!
98+
我们很高兴你考虑为 Karpor 项目作出贡献!
9999

100-
This document will guide you through the process of [creating a pull request](./index.md#contribute-a-pull-request).
100+
本文档将会指导你完成 [创建拉取请求](./index.md#contribute-a-pull-request) 的过程。
101101

102-
### Before you begin
102+
### 在你开始之前
103103

104-
We know you are excited to create your first pull request. Before we get started, make sure your code follows the relevant [code conventions](../2-conventions/2-code-conventions.md).
104+
我们知道你对于创建第一个 pull request 非常兴奋。在我们开始之前,请确保你的代码符合相关的 [代码规约](../2-conventions/2-code-conventions.md)
105105

106-
### Your First Pull Request
106+
### 你的第一个 Pull Request
107107

108-
Before submitting your PR, run the following commands to ensure they all succeed:
108+
在提交你的 PR 之前,运行下面的命令并确保它们都成功了:
109109

110110
```
111111
make test
112112
make lint
113113
```
114114

115-
If this is your first time contributing to an open-source project on GitHub, please make sure to read the instructions on [creating a pull request](https://help.github.com/en/articles/creating-a-pull-request).
115+
如果这是你第一次向 Github 上的开源项目贡献,请确保你已经阅读了 [创建拉取请求](https://docs.github.com/zh/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
116116

117-
To increase the chances of your pull request being accepted, please ensure your pull request follows these guidelines:
117+
为了提高你的 pull request 被接受的机会,请确保你的 pull rquest 符合以下指导规则:
118118

119-
- The title and description match the implementation.
120-
- The commits in the pull request follow the [formatting guidelines](#Formatting-guidelines).
121-
- The pull request closes a related issue.
122-
- The pull request includes necessary tests to verify the expected behavior.
123-
- If your pull request has conflicts, please rebase your branch onto the main branch.
119+
- 标题和描述与实现相符。
120+
- pull request 中的所有 commit 都符合 [格式指南](#Formatting-guidelines)
121+
- pull request 会关闭一个相关 issue
122+
- pull request 包含了必要的测试,以验证预期行为。
123+
- 如果你的 pull request 有冲突,请将你的分支 rebase main 分支。
124124

125-
If the pull request fixes a bug:
125+
如果 pull request 修复了一个漏洞:
126126

127-
- The pull request description must contain `Closes #<issue number>` or `Fixes #<issue number>`.
128-
- To prevent regressions, the pull request should include tests that replicate the bug being fixed.
127+
- pull request 的描述中必须包含 `Closes #<issue number>` `Fixes #<issue number>`
128+
- 为了避免回归问题,pull request 必须包含验证该漏洞被修复的测试。
129129

130-
## Code Review
130+
## 代码审查
131131

132-
Once you have created a pull request, the next step is to have others review your changes. Review is a learning opportunity for both reviewers and the author of the pull request.
132+
一旦你创建了一个 pull requset,下一步就是让其他人审查你的改动。代码审查对审查者和 pull request 作者都是很好的学习机会。
133133

134-
If you believe a specific person should review your pull request, you can tag them in the description or a comment.
135-
Tag a user by typing an `@` symbol followed by their username.
134+
如果你觉得某个特定的人应当审查你的 pull request,你可以在描述或评论中标记他们。
135+
通过输入 `@` 符号和其用户名来标记用户。
136136

137-
We recommend that you read [How to do a code review](https://google.github.io/eng-practices/review/reviewer/) to learn more about code reviews.
137+
我们建议你阅读 [如何进行代码审查](https://google.github.io/eng-practices/review/reviewer/) 来了解更多关于代码审查的知识。
138138

139-
## Formatting Guidelines
139+
## Pull request 格式指南
140140

141-
A well-crafted pull request can minimize the time to get your changes accepted. These guidelines will help you write well-formulated commit messages and descriptions for your pull requests.
141+
精心编写的 pull request 可以最大程度地缩短你的更改被接受的时间。这些指南将帮助你为 pull requset 编写条理清晰的提交消息和说明。
142142

143-
### Commit Message Format
143+
### Commit 信息格式
144144

145-
More see: [Commit Conventions](../2-conventions/4-commit-conventions.md)
145+
了解更多:[Commit 规约](../2-conventions/4-commit-conventions.md)
146146

147-
### Pull Request Title
147+
### Pull Request 标题
148148

149-
When accepting pull requests, the Karpor team merges all commits into one.
149+
在接受 pull request 时,Karpor 团队会将所有的 commit 合并为一个。
150150

151-
The pull request title becomes the subject line of the merged commit message.
151+
Pull request 的标题将会成为合并后的 commit 信息的描述。
152152

153-
We still encourage contributors to write informative commit messages, as they will be part of the Git commit body.
153+
我们仍然鼓励贡献者撰写详细的 commit 信息,因为它们将会作为 git commit 正文的一部分。
154154

155-
We use the pull request titles when generating change logs for releases. Hence, we strive to make the titles as informative as possible.
155+
我们在生成发布更新日志时将会使用 pull request 的标题。因此,我们会努力使标题尽可能具有信息量。
156156

157-
Make sure your pull request title uses the same format as the commit message subject line. If the format is not followed, we will add a `title-needs-formatting` label on the pull request.
157+
确保你的 pull request 标题使用与 commit 信息相同的格式。如果不遵循该格式,我们将会在该 pull request 添加 `title-needs-formatting` 标签。
158158

159-
### Passing All CI Checks
159+
### 通过所有 CI 检查
160160

161-
Before merging, all testing CIs should pass:
161+
在合并之前,所有的测试 CI 都应该通过:
162162

163-
- Coverage should not drop. Currently, the pull request coverage should be at least 70%.
164-
- Karpor uses a **CLA** for the contributor agreement. It requires you to sign for every commit before merging the pull request.
163+
- 覆盖率不应该下降。当前,pull request 的覆盖率应当至少为 70%
164+
- Karpor 使用 **CLA** 作为贡献者协议。它要求你在第一次合并 pull request 之前签署。
165165

166-
## Updating Documentation and Website
166+
## 更新文档和网站
167167

168-
If your pull request has been merged, and it is a new feature or enhancement, you need to update the documentation and send a pull request to the [kusionstack.io](https://github.com/KusionStack/kusionstack.io) repository.
168+
如果你的 pull request 被合并了,而且它引入了新的特性或增强,你需要更新文档并且提交 pull requset 到 [kusionstack.io](https://github.com/KusionStack/kusionstack.io) 仓库。
169169

170-
Learn how to write documentation through the following guide:
170+
根据下面的文档了解如何编写文档:
171171

172-
- [kusionstack.io Developer Guide](https://github.com/KusionStack/kusionstack.io/blob/main/README.md)
172+
- [kusionstack.io 开发者指南](https://github.com/KusionStack/kusionstack.io/blob/main/README.md)
173173

174-
Awesome, you've completed the lifecycle of code contribution!
174+
太棒了,你已经完成了代码贡献的整个生命周期!

i18n/zh/docusaurus-plugin-content-docs-karpor/current/4-developer-guide/1-contribution-guide/3-roles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Roles
2+
title: 角色
33
---
44
感谢您对本开源项目的关注和支持!本文档将阐述贡献者在项目中的角色、职责以及如何从 Contributor 升级为 Maintainer,以及 Maintainer 降级为 Contributor 的规则。我们希望通过这份文档,让每位贡献者都能清楚地了解自己的成长路径,并为项目的发展做出更大的贡献。
55

0 commit comments

Comments
 (0)