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
docs(basics/router.md): [translate] Done #896
Conversation
Finish translating 'basics/router.md' and wait for guys to proofread it.
Codecov Report
@@ Coverage Diff @@
## master #896 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 28 28
Lines 669 669
=====================================
Hits 669 669 Continue to review full report at Codecov.
|
docs/source/en/basics/router.md
Outdated
|
||
Methods that are not needed may not be implemented in `posts.js` and the related URL paths will not be registered to Router neither. | ||
|
||
## destroy in action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://eggjs.org/zh-cn/basics/router.html#router-实战
change to Router in Action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accept
docs/source/en/basics/router.md
Outdated
|
||
## destroy in action | ||
|
||
The destroy syntax will demonstrated by more examples. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下面通过更多实际的例子,来说明 router 的用法。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accept
docs/source/en/basics/router.md
Outdated
|
||
> If you perform a POST request directly, an **error** will occur: 'secret is missing'. This error message comes from [koa-csrf/index.js#L69](https://github.com/koajs/csrf/blob/2.5.0/index.js#L69). | ||
|
||
> **Reason**: the framework verifies the CSFR value specially for form POST requests, so please submit the CSRF key as well when you submit a form. For more detail refer to [Keep Away from CSRF Threat](https://eggjs.org/zh-cn/core/security.html#安全å¨èƒcsrf的防范) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
乱码了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LibreOffice的问题. 已改正.
docs/source/en/basics/router.md
Outdated
|
||
```js | ||
// app/router.js | ||
module.exports = app => { require('./router/news')(app); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
换行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
手误按了J, 已改正.
docs/source/en/basics/router.md
Outdated
|
||
Router is mainly used to describe the relationship between the request URL and the Controller that processes the request eventually. All routing rules are unified in the `app/router.js` file by the framework. | ||
|
||
By unifying routing rules, routing logics are free from scatter, random conflicts disappear and it becomes easy for us to see global routing rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'By unifying routing rules, routing logics are free from scatter, random conflicts disappear and ...'
It maybe more proper like this:
By unifying routing rules, routing logics are free from scatter that may cause unkown conflicts and it will be easier for us to check global routing rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct.
docs/source/en/basics/router.md
Outdated
* app.patch - PATCH | ||
* app.delete - DELETE | ||
* app.del - this is a alias method due to the reservation of delete. | ||
* app.redirect - redirect the request URL. For example, the most common case is to redirect the request accessing the root directory to the homepage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'app.redirect - redirect the request URL'
to redirect the request URL or redirecting the request the URL ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about 'redirects the request URL' which means 'app.redirect redirects the request URL'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lslxdx Do you need update this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/source/en/basics/router.md
Outdated
* app.delete - DELETE | ||
* app.del - this is a alias method due to the reservation of delete. | ||
* app.redirect - redirect the request URL. For example, the most common case is to redirect the request accessing the root directory to the homepage. | ||
- router-name define a alias for the route, and URL can be generated by helper method `pathFor` and `urlFor` provided by Helper. (Optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'define a alias for the route'
suggestion:
defines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct
docs/source/en/basics/router.md
Outdated
* app.redirect - redirect the request URL. For example, the most common case is to redirect the request accessing the root directory to the homepage. | ||
- router-name define a alias for the route, and URL can be generated by helper method `pathFor` and `urlFor` provided by Helper. (Optional) | ||
- path-match - URL path of the route. | ||
- middleware1 - multiple Middlewares can be configured in Router. (Optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Middleware'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean 'multiple Middleware'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've done.
docs/source/en/basics/router.md
Outdated
- middleware1 - multiple Middlewares can be configured in Router. (Optional) | ||
- controller.action - it's a string, take care. The framework will find the Controller sharing the name under `app/controller`, then assign the process to the configured action method. The action can be omitted if the Controller exports a method directly. | ||
|
||
### IMPORTANT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Notices' may be more proper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct
docs/source/en/basics/router.md
Outdated
|
||
> **Reason**: the framework verifies the CSFR value specially for form POST requests, so please submit the CSRF key as well when you submit a form. For more detail refer to [Keep Away from CSRF Threat](https://eggjs.org/zh-cn/core/security.html#安全å¨èƒcsrf的防范) | ||
|
||
> **Note**: the verification is performed because the framework builds in a security plugin [egg-security](https://github.com/eggjs/egg-security) that provides some default security practices and this plugin is enabled by default. In case you want to disable some security protections, just configure the enable attribute of if to be false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'just configure ...'
suggestion:
'just set the enable attribute to false'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accept
docs/source/en/basics/router.md
Outdated
|
||
> **Note**: the verification is performed because the framework builds in a security plugin [egg-security](https://github.com/eggjs/egg-security) that provides some default security practices and this plugin is enabled by default. In case you want to disable some security protections, just configure the enable attribute of if to be false. | ||
|
||
> "Unless you know the consequence consciously, it's recommended not to disable functions provided by the security plugin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
‘unless ...’
suggestion: 'Unless you clearly confirm ..., it's not recommended ...'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accept
docs/source/en/basics/router.md
Outdated
|
||
### Using Middleware | ||
|
||
A middleware can be used to change the request parameter of one kind of user requests to uppercase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
leave out 'of one kind of user requests'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
BTW, should we change the doc of Chinese version together?
e.g.:
'把用户某一类请求的参数都大写' => '把用户请求的参数都大写'
docs/source/en/basics/router.md
Outdated
### Using Middleware | ||
|
||
A middleware can be used to change the request parameter of one kind of user requests to uppercase. | ||
Here we show how to use the middleware briefly, referring to [Middleware](./middleware.md) for detail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
'Here we just briefly explain how to use the middleware, refer to ...'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct.
Moreover, how about '..., and refer to ...'?
docs/source/en/basics/router.md
Outdated
|
||
### Too Many Routing Maps? | ||
|
||
As described above, we do not recommend you scatter routing logics all around, or it leads to a difficult trouble shooting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'we do not recommend ...'
suggestion:
'we do not recommend that ..., or it will bring trouble in trouble shooting'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct.
docs/source/en/basics/router.md
Outdated
* app.patch - PATCH | ||
* app.delete - DELETE | ||
* app.del - this is a alias method due to the reservation of delete. | ||
* app.redirect - redirect the request URL. For example, the most common case is to redirect the request accessing the root directory to the homepage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lslxdx Do you need update this one?
Finish translating 'basics/router.md' and wait for guys to proofread it.
Checklist
Affected core subsystem(s)
Description of change