Skip to content
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

🌐 Add Chinese translation for Tutorial - Security - Get Current User #2474

Conversation

waynerv
Copy link
Contributor

@waynerv waynerv commented Dec 6, 2020

@RunningIkkyu @maoyibo @yanever Please take a look.

@codecov
Copy link

codecov bot commented Dec 6, 2020

Codecov Report

Merging #2474 (e20352b) into master (f175929) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2474   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          242       243    +1     
  Lines         7396      7419   +23     
=========================================
+ Hits          7396      7419   +23     
Impacted Files Coverage Δ
fastapi/routing.py 100.00% <0.00%> (ø)
fastapi/encoders.py 100.00% <0.00%> (ø)
fastapi/concurrency.py 100.00% <0.00%> (ø)
fastapi/applications.py 100.00% <0.00%> (ø)
fastapi/openapi/utils.py 100.00% <0.00%> (ø)
fastapi/datastructures.py 100.00% <0.00%> (ø)
tests/test_params_repr.py 100.00% <0.00%> (ø)
fastapi/security/__init__.py 100.00% <0.00%> (ø)
fastapi/dependencies/utils.py 100.00% <0.00%> (ø)
tests/test_custom_route_class.py 100.00% <0.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 436b023...e20352b. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2020

📝 Docs preview for commit 526e3d7 at: https://5fcc6101505f01750b806855--fastapi.netlify.app

@waynerv waynerv mentioned this pull request Dec 7, 2020

## 创建一个用户模型

首先,让我们来创建一个用户 Pydantic 模型。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
首先,让我们来创建一个用户 Pydantic 模型
首先,让我们来创建一个 Pydantic 用户模型

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我特意将原文的顺序做了一些调整以符合中文的阅读习惯,比如我们我们通常会说「用户数据库模型」或「用户JSON模型」,而不会说「数据库用户模型」或「JSON用户模型」。


还记得依赖项可以有子依赖项吗?

`get_current_user` 将具有一个我们之前所创建的同一个 `oauth2_scheme` 作为依赖项。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`get_current_user` 将具有一个我们之前所创建的同一个 `oauth2_scheme` 作为依赖项
`get_current_user` 将具有和我们之前所创建的 `oauth2_scheme` 相同的依赖项

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「和某某相同」应该有两个主体,但这里从原文看只有一个主体即oauth2_scheme,因此翻译成了同一个

docs/zh/docs/tutorial/security/get-current-user.md Outdated Show resolved Hide resolved
docs/zh/docs/tutorial/security/get-current-user.md Outdated Show resolved Hide resolved
docs/zh/docs/tutorial/security/get-current-user.md Outdated Show resolved Hide resolved

你可以使用任何模型或数据来满足安全性要求(在这个示例中,使用的是 Pydantic 模型 `User`)。

但是你并未被限制只能使用某些特定的数据模型,类或类型。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉着这句可以和上一句一起翻译,中文习惯按原文的表达方式有点“分家“

Suggested change
但是你并未被限制只能使用某些特定的数据模型,类或类型。
并不限于使用某些特定的数据模型,类或类型。


你只想要一个 `str`?或者仅仅一个 `dict`?还是直接一个数据库模型类的实例?它们的工作方式都是一样的。

实际上你没有用户登录到你的应用程序,而是只拥有访问令牌的机器人,程序或其他系统?再一次,它们的工作方式也是一样的。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
实际上你没有用户登录到你的应用程序,而是只拥有访问令牌的机器人,程序或其他系统?再一次,它们的工作方式也是一样的
就算除了拥有访问令牌的机器人、自动程序或其他系统,实际上没有用户登录到你的应用程序?再说一次,它们的工作方式还是一样的


## 代码体积

这个示例似乎看起来很冗长。考虑到我们在同一文件中混合了安全性,数据模型工具函数和路径操作等代码。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
这个示例似乎看起来很冗长。考虑到我们在同一文件中混合了安全性,数据模型工具函数和路径操作等代码。
这个示例似乎看起来很冗长。请记住我们在同一文件中混合了安全性、数据模型工具函数和路径操作等代码。

docs/zh/docs/tutorial/security/get-current-user.md Outdated Show resolved Hide resolved
docs/zh/docs/tutorial/security/get-current-user.md Outdated Show resolved Hide resolved
@blt232018
Copy link
Contributor

@waynerv just some suggestions. Actually it doesn't have any problem! I'll approve it tomorrow in case that you may accept any suggestion of me.

@waynerv
Copy link
Contributor Author

waynerv commented Dec 17, 2020

@blt232018 Thanks for the review!

@tiangolo tiangolo added awaiting-review lang-all Translations lang-zh Chinese translations labels Dec 19, 2020
@tiangolo tiangolo changed the title Add Chinese translation for Tutorial - Security - Get Current User 🌐 Add Chinese translation for Tutorial - Security - Get Current User Jan 9, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2021

📝 Docs preview for commit e20352b at: https://5ff9fad793ca4a7029653056--fastapi.netlify.app

@tiangolo
Copy link
Owner

tiangolo commented Jan 9, 2021

Awesome! Thanks a lot @waynerv ! 🙇 🍰

And thanks @blt232018 and @Laineyzhang55 for the reviews ☕ 🔍

@tiangolo tiangolo merged commit d2ca3df into tiangolo:master Jan 9, 2021
@waynerv waynerv deleted the add-chinese-translation-for-get-current-user.md branch January 13, 2021 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved-2 lang-all Translations lang-zh Chinese translations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants