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 Japanese translation for docs/ja/docs/tutorial/extra-models.md #1941

Merged

Conversation

SwftAlpc
Copy link
Contributor

@SwftAlpc SwftAlpc commented Aug 21, 2020

This PR translates the tutorial/extra-models.md to Japanese.
Please review tutorial/extra-models.md

Issue #1571 generates a new directory to support Japanese.
PR #1656 generates a new directory for tutorial.
I will fix dependency after #1571 & #1656 are merged.

@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Patch and project coverage have no change.

Comparison is base (cf73051) 100.00% compared to head (e7b32fa) 100.00%.

❗ Current head e7b32fa differs from pull request most recent head 4b6e845. Consider uploading reports for the commit 4b6e845 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##            master     #1941     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files          540       239    -301     
  Lines        13969      7079   -6890     
===========================================
- Hits         13969      7079   -6890     

see 356 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

📝 Docs preview for commit 01c233f at: https://5f3fe3fb73d0e97772ee935f--fastapi.netlify.app

@SwftAlpc SwftAlpc mentioned this pull request Aug 23, 2020
@github-actions
Copy link
Contributor

📝 Docs preview for commit fac0a58 at: https://5f424ef9a293b75f104a998a--fastapi.netlify.app

@tiangolo tiangolo added awaiting-review lang-all Translations lang-ja Japanese translations labels Aug 29, 2020
@github-actions
Copy link
Contributor

📝 Docs preview for commit cec7a6c at: https://5f4cbf5cb850660e0943d2cb--fastapi.netlify.app

@@ -0,0 +1,195 @@
# 追加モデル
Copy link
Contributor

Choose a reason for hiding this comment

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

モデル - より詳しく

(extraはいい訳がないので、がっつり意訳しないと不自然な気がします。目次を見ると、Response Modelsの次がこのセクションで、Response Modelsで紹介しなかったことをより詳しく紹介している章なのでこの様な見出しはどうでしょうか)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

良い和訳だと思います!修正しました

これはユーザーモデルの場合は特にそうです。なぜなら:

* **入力モデル** にはパスワードが必要です。
* **出力モデル**にはパスワードを設定すべきではありません。
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 出力モデルはパスワードをもつべきではありません。

* **データベースモデル**はおそらくハッシュ化されたパスワードが必要になるでしょう。

!!! danger "危険"
ユーザーの平文のパスワードは絶対に保存しないでください。常に「安全なハッシュ」を保存し、それを確認することができます。
Copy link
Contributor

Choose a reason for hiding this comment

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

ユーザーの平文のパスワードは絶対に保存しないでください。常に認証に利用可能な「安全なハッシュ」を保存してください。


## 複数のモデル

ここでは、モデルのパスワードフィールドと使用場所でモデルがどのように見えるのか、大まかなイメージを紹介します:
Copy link
Contributor

Choose a reason for hiding this comment

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

ここでは、パスワードフィールドをもつモデルがどのように見えるのか、また、どこで使われるのか、大まかなイメージを紹介します:

user_dict = user_in.dict()
```

これで変数`user_dict`のデータを持つ`dict`ができました。(これはPydanticモデルのオブジェクトの代わりに`dict`です)。
Copy link
Contributor

Choose a reason for hiding this comment

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

これで変数user_dictのデータを持つdictができました。(これはPydanticモデルのオブジェクトの代わりになるdictです)。

```Python
UserInDB(
username = user_dict["username"],
password = user_dict["password"],これやばい
Copy link
Contributor

Choose a reason for hiding this comment

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

password = user_dict["password"],

Copy link
Contributor Author

Choose a reason for hiding this comment

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

変な日本語入ってましたね...;;
修正しました!

)
```

#### 別の内容からのPydanticモデル
Copy link
Contributor

Choose a reason for hiding this comment

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

別のモデルからつくるPydanticモデル


## `Union`または`anyOf`

レスポンスを2つの型の`Union`と宣言することができます。
Copy link
Contributor

Choose a reason for hiding this comment

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

レスポンスを2つの型のUnionとして宣言することができます。


複数のPydanticモデルを使用し、ケースごとに自由に継承します。

エンティティが異なる「状態」を持つことができる必要がある場合は、ケンティティごとに単一のデータモデルを持つ必要はありません。ユーザー「エンティティ」の場合と同様に、`password`や`password_hash`を含み、パスワードはありません。
Copy link
Contributor

Choose a reason for hiding this comment

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

エンティティが異なる「状態」を持てなければならない場合は、エンティティごとに単一のデータモデルを持つ必要はありません。passwordpassword_hashやパスワードなしなどのいくつかの「状態」をもつユーザー「エンティティ」の場合の様にすれば良いのです。

@github-actions
Copy link
Contributor

📝 Docs preview for commit 1164fea at: https://5f9aa712efcb983ab7c43051--fastapi.netlify.app

@SwftAlpc
Copy link
Contributor Author

@tokusumi
Thanks for the review!
I apologize for taking so long to respond.
Could you re-review?

@github-actions
Copy link
Contributor

📝 Docs preview for commit e7b32fa at: https://5f9aa94d5f755e2598dad129--fastapi.netlify.app

Copy link
Contributor

@tokusumi tokusumi left a comment

Choose a reason for hiding this comment

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

your awesome works are really helpful. Thank you🎉

@tiangolo tiangolo changed the title Add tutorial/extra-models.md. Japanese ver. 🌐 Add Japanese translation for docs/ja/docs/tutorial/extra-models.md Jun 26, 2023
@tiangolo tiangolo added lang-ja Japanese translations awaiting-review and removed lang-ja Japanese translations awaiting-review labels Jun 26, 2023
@tiangolo
Copy link
Owner

📝 Docs preview for commit 4b6e845 at: https://6499c2f1bac8cd0083555671--fastapi.netlify.app

@tiangolo
Copy link
Owner

As this was done by @SwftAlpc and reviewed by @tokusumi, champions of the Japanese translations, I'm gonna merge this. 🚀

@tiangolo tiangolo merged commit c238292 into tiangolo:master Jan 15, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review lang-all Translations lang-ja Japanese translations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants