Skip to content

Commit

Permalink
Translate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kesonan committed Jun 5, 2023
1 parent 6c8c641 commit 2a4ab5c
Show file tree
Hide file tree
Showing 35 changed files with 1,257 additions and 1,273 deletions.
19 changes: 19 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
project_id: '592879'
api_token_env: CROWDIN_PERSONAL_TOKEN
preserve_hierarchy: true
languages_mapping: &languages_mapping
two_letters_code:
zh: en
files:
# JSON translation files
- source: /i18n/zh/**/*
translation: /i18n/%two_letters_code%/**/%original_file_name%
languages_mapping: *languages_mapping
# Docs Markdown files
- source: /docs/**/*.md
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
languages_mapping: *languages_mapping
# Docs Markdown files
- source: /docs/**/*.mdx
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
languages_mapping: *languages_mapping
2 changes: 1 addition & 1 deletion i18n/en/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "The label for version current"
},
"sidebar.tasks.category.安装": {
"message": "Install",
"message": "Installation",
"description": "The label for category 安装 in sidebar tasks"
},
"sidebar.tasks.category.DSL 介绍": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ title: ''
slug: /docs/components
---

组件功能正在努力编写中...
Component function work in progress ...
178 changes: 88 additions & 90 deletions i18n/en/docusaurus-plugin-content-docs/current/concepts.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,118 @@
---
title: 框架概述
sidebar_label: 框架概述
title: Framework Overview
sidebar_label: Framework Overview
slug: /docs/concepts/overview
---

import { Image } from '@arco-design/web-react';

## go-zero

> **_缩短从需求到上线的距离_**
> **_Shorten distance from demand to offline_**
go-zero 是一个集成了各种工程实践的 web rpc 框架。通过弹性设计保障了大并发服务端的稳定性,经受了充分的实战检验。
go-zero is a web and rpc framework that integrates various engineering practices.Flexible design guarantees stability at the same end and undergoes a full operational test.

go-zero 包含极简的 API 定义和生成工具 goctl,可以根据定义的 api 文件一键生成 Go, iOS, Android, Kotlin, Dart, TypeScript, JavaScript 代码,并可直接运行。
go-Zero contains very simple API definitions and generation tools goctl. Can generate Go, iOS, Android, Kotlin, Dart, TypeScript, JavaScript code based on defined api files and can be run directly.

## 使用 go-zero 的好处
## Benefits of using go-zero

- 轻松获得支撑千万日活服务的稳定性
- 内建级联超时控制、限流、自适应熔断、自适应降载等微服务治理能力,无需配置和额外代码
- 微服务治理中间件可无缝集成到其它现有框架使用
- 极简的 API 描述,一键生成各端代码
- 自动校验客户端请求参数合法性
- 大量微服务治理和并发工具包
- Easily get stability to support millions of living services
- Intra-stage timeout control, limited flow, adaptive melting, adaptive loop and adaptive loop capability for microservice governance without configuration or extra code
- Microservice Governance Middleware can be seamlessly integrated into other existing frameworks using
- Useful API description, all end code generated by one click
- Auto-Verify Client Request Parameters
- A large number of micro-service governance and parallel development kits

<Image width={1500} src={require('./resource/concepts/architecture.png').default} alt='架构图' />


## 1. go-zero 框架背景
## 1. go-zero framework background

18 年初,我们决定从 `Java+MongoDB` 的单体架构迁移到微服务架构,经过仔细思考和对比,我们决定
At the beginning of 18 years, we decided to migrate from a single architecture of `Java+MongoDB` to a microservice architecture, after careful thought and comparison, we decided to

- 基于 Go 语言
- 高效的性能
- 简洁的语法
- 广泛验证的工程效率
- 极致的部署体验
- 极低的服务端资源成本
- 自研微服务框架
- 有过很多微服务框架自研经验
- 需要有更快速的问题定位能力
- 更便捷的增加新特性
- Based on Go Language
- Efficient performance
- Simple Syntax
- Widespread validating engineering efficiency
- Extreme deployment experience
- Very low service resource cost
- Self-research micro-service frameworks
- Many micro-service framework self-research experience
- A faster problem location capability is required
- Easier add new features

## 2. go-zero 框架设计思考
## 2. Thinking on go-zero framework design

对于微服务框架的设计,我们期望保障微服务稳定性的同时,也要特别注重研发效率。所以设计之初,我们就有如下一些准则:
With regard to the design of the framework for microservices, we expect to guarantee the stability of microservices with a special focus on research and development efficiency.So at the beginning of the design, we had some guidelines as follows:

- 保持简单,第一原则
- 弹性设计,面向故障编程
- 工具大于约定和文档
- 高可用
- 高并发
- 易扩展
- 对业务开发友好,封装复杂度
- 约束做一件事只有一种方式
- Stay simple, first principle
- Flexible Design, Programming for Failure
- Tools are larger than contracts and documents
- High Available
- High Conversion
- High Scalability
- Development friendly, encapsulated complexity
- Only one way to bind to do one thing

我们不到半年时间,我们彻底完成了从 `Java+MongoDB` `Golang+MySQL` 为主的微服务体系迁移,并于 18 年 8 月底完全上线,稳定保障了业务后续迅速增长,确保了整个服务的高可用。
In less than half a year, we have completely migrated from `Java+MongoDB` to `Golang+MySQL` , the primary microservice system, fully online at the end of August 18, and have stabilized the rapid growth of business follow-up and ensured high availability of the entire service.

## 3. go-zero 项目实现和特点
## 3. Implementation and characteristics of the go-zero project

go-zero 是一个集成了各种工程实践的包含 web rpc 框架,有如下主要特点:
go-zero is an integrated web and rpc framework with various engineering practices, with the following key features:

- 强大的工具支持,尽可能少的代码编写
- 极简的接口
- 完全兼容 net/http
- 支持中间件,方便扩展
- 高性能
- 面向故障编程,弹性设计
- 内建服务发现、负载均衡
- 内建限流、熔断、降载,且自动触发,自动恢复
- API 参数自动校验
- 超时级联控制
- 自动缓存控制
- 链路跟踪、统计报警等
- 高并发支撑,稳定保障了疫情期间每天的流量洪峰
- Powerful tool support, minimum code writing
- Very simple interface
- Fully compatible net/http
- Support Middleware for Extensions
- High Performance
- Programming for failure, flexible design
- Built-in Services Discovery, Load Balancer
- Internal limit flow, melt, download, and automatically trigger, restore automatically
- API Parameters Auto-Validation
- Timeout link control
- Auto Cache Control
- Link tracking, statistics alerts, etc.
- High and sustained stability, which guarantees daily flow peaks during the epidemic

如下图,我们从多个层面保障了整体服务的高可用
As shown below, we guarantee high availability of overall services at multiple levels

<Image src={require('./resource/concepts/resilience.jpg').default} alt="弹性设计" />

觉得不错的话,别忘 **star** 👏
Don't note **star** : capping_hands:

## 4. Installation

在项目目录下通过如下命令安装
Install under project directory

```shell
GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro/go-zero
```

## 5. Quick Start

0. 完整示例请查看
0. Full example please view

[快速构建高并发微服务](https://github.com/zeromicro/zero-doc/blob/main/doc/shorturl.md)
[Quick Build High & Microservice](https://github.com/zeromicro/zero-doc/blob/main/doc/shorturl.md)

[快速构建高并发微服务 - 多 RPC 版](https://github.com/zeromicro/zero-doc/blob/main/docs/zero/bookstore.md)
[Quick Build High & Microservice - Multi-RPC](https://github.com/zeromicro/zero-doc/blob/main/docs/zero/bookstore.md)

1. 安装 goctl 工具
1. Install goctl tools

`goctl` 读作 `go control`,不要读成 `go C-T-L``goctl` 的意思是不要被代码控制,而是要去控制它。其中的 `go` 不是指 `golang`。在设计 `goctl` 之初,我就希望通过 `` 来解放我们的双手 👈
`goctl` read `go control`, don't read `go C-T-L`.`goctl` means not being controlled by code but to control it.The `go` does not mean `golang`.

```shell
GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro/go-zero/tools/goctl
```

如果使用 go1.16 版本, 可以使用 `go install` 命令安装
If using version go1.16, you can install the `go install` command

```shell
GOPROXY=https://goproxy.cn/,direct go install github.com/zeromicro/go-zero/tools/goctl@latest
```

确保 goctl 可执行
Make sure goctl is executable

2. 快速生成 api 服务
2. Quickly generate api service

```shell
goctl api new greet
Expand All @@ -122,13 +122,13 @@ GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro
go run greet.go -f etc/greet-api.yaml
```

默认侦听在 8888 端口(可以在配置文件里修改),可以通过 curl 请求
Default listener at 8888 port (can be modified in configuration file), can request by curl

```shell
curl -i http://localhost:8888/from/you
```

返回如下
Return to the following

```http
HTTP/1.1 200 OK
Expand All @@ -138,13 +138,13 @@ GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro
Content-Length: 14
```

编写业务代码
Write business code

* api 文件定义了服务对外暴露的路由,可参考 [api 规范](https://github.com/zeromicro/zero-doc/blob/main/go-zero.dev/cn/api-grammar.md)
* 可以在 servicecontext.go 里面传递依赖给 logic,比如 mysql, redis
* 在 api 定义的 get/post/put/delete 等请求对应的 logic 里增加业务处理逻辑
* api file defines the routing of the service to be exposed, reference [api norms](https://github.com/zeromicro/zero-doc/blob/main/go-zero.dev/cn/api-grammar.md)
* Can pass dependencies to logic, such as mysql, redis and so on in servicecontext.go
* Add business processing logic to the get/post/put/delete request

3. 可以根据 api 文件生成前端需要的 Java, TypeScript, Dart, JavaScript 代码
3. Java, TypeScript, Dart, JavaScript code can be generated from api files

```shell
goctl api java -api greet.api -dir greet
Expand All @@ -156,45 +156,43 @@ GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro

<Image src={require('./resource/concepts/benchmark.png').default} alt='benchmark' />

[测试代码见这里](https://github.com/smallnest/go-web-framework-benchmark)
[Test code is here](https://github.com/smallnest/go-web-framework-benchmark)

## 7. 文档
## Documentation

- [API 文档](/docs/tutorials)
- [API documentation](/docs/tutorials)

- [goctl 使用帮助](/docs/tutorials/cli/overview)
- [goctl usage help](/docs/tutorials/cli/overview)

- awesome 系列(更多文章见『微服务实践』公众号)
- aweesome series

- [快速构建高并发微服务](https://github.com/zeromicro/zero-doc/blob/main/doc/shorturl.md)
- [快速构建高并发微服务 - 多 RPC 版](https://github.com/zeromicro/zero-doc/blob/main/docs/zero/bookstore.md)
- [Quick Build High & Microservice](https://github.com/zeromicro/zero-doc/blob/main/doc/shorturl.md)
- [Quick Build High & Microservice - Multi-RPC](https://github.com/zeromicro/zero-doc/blob/main/docs/zero/bookstore.md)

- 精选 `goctl` 插件
- Picked `goctl` plugin
-

| 插件 | 用途 |
| ------------------------- | -------------------------------------------------------------------------------------------- |
| <a href="https://github.com/zeromicro/goctl-swagger">goctl-swagger</a> | 一键生成 <code>api</code> <code>swagger</code> 文档 |
| <a href="https://github.com/zeromicro/goctl-android">goctl-android</a> | 生成 <code>java (android)</code> <code>http client</code> 请求代码 |
| <a href="https://github.com/zeromicro/goctl-go-compact">goctl-go-compact</a> | 合并 <code>api</code> 里同一个 <code>group</code> 里的 <code>handler</code> 到一个 go 文件 |
| Plugin | Usage |
| ------------------------- | ----------------------------------------------------------------------------------------------------------- |
| <a href="https://github.com/zeromicro/goctl-swagger">goctl-swagger</a> | Generate <code>api</code> document <code>swagger</code> |
| <a href="https://github.com/zeromicro/goctl-android">goctl-android</a> | Generate <code>java (android)</code> <code> http client</code> request code |
| <a href="https://github.com/zeromicro/goctl-go-compact">goctl-go-compact</a> | Merge <code>api</code> with the same <code>group</code> in <code>handler</code> to a go file |

## 8. 微信公众号
## 8. Wechat

`go-zero` 相关文章都会在 `微服务实践` 公众号整理呈现,欢迎扫码关注,也可以通过公众号私信我 👏
`go-zero` related articles are displayed in `microservice practice` public sign up and welcome snippets, and can also be used by public contact me : capping_hands:

<Image width={300} src={require('@site/static/img/ad/go-zero-practise.jpg').default} alt='wechat' />


## 9. 微信交流群
## 9. Wechat groups

如果文档中未能覆盖的任何疑问,欢迎您在群里提出,我们会尽快答复。
If you do not cover any questions in the document, you are welcome to ask in the group and we will reply as soon as possible.

您可以在群内提出使用中需要改进的地方,我们会考虑合理性并尽快修改。
You can set out in the group where improvements are needed, and we will consider reasonableness and modify it as soon as possible.

如果您发现 **_bug_** 请及时提 **_issue_**,我们会尽快确认并修改。
If you find **_bugs_** please submit them in a timely manner **_issue_**we will confirm and modify them as soon as possible.

为了防止广告用户、识别技术同行,请 **_star_** 后加我时注明 **github** 当前 **_star_** 数,我再拉进 **go-zero** 群,感谢!

加我之前有劳点一下 **_star_**,一个小小的 **_star_** 是作者们回答海量问题的动力 🤝
Add my previous point **_star_**, a small **_star_** is the power of authors to answer the question of the volume: handshake:

<Image width={300} src="https://raw.githubusercontent.com/zeromicro/zero-doc/main/doc/images/wechat.jpg" alt='wechat' />
Loading

0 comments on commit 2a4ab5c

Please sign in to comment.