Skip to content

Translate tutorial/controlflow.po #283

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

Merged
merged 5 commits into from
Jul 24, 2022
Merged

Conversation

StevenHsuYL
Copy link
Contributor

Complete match statement part in controlflow.po

Any suggestion would be welcomed. Thanks for the review!

Reference: pattern, guard.

@mattwang44 mattwang44 self-requested a review June 11, 2022 07:16
@StevenHsuYL
Copy link
Contributor Author

Update match section.

Preview:
controlflow match

@mattwang44
Copy link
Collaborator

commit history 有點嚇人XD 好像包含到一些非關 controlflow 的改動
@StevenHsuYL 可以幫忙 rebase 一下嗎 🙏🏽

@StevenHsuYL
Copy link
Contributor Author

已修復 ^^"
會變這樣好像是因為上週 CPython 有更新此檔,我 merge 3.10 branch 更新原文檔,
之後就跑出一大堆 commit history...
目前已還原到只有更改 tutorial/controlflow.po,再麻煩確認,謝謝!

StevenHsuYL and others added 3 commits July 7, 2022 00:48
in tutorial/controlflow.po
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Update match section after Sync with CPython 3.10
@mattwang44
Copy link
Collaborator

我有再整理了一下,現在應該是只留下需要的 commit
會再找時間 review 🙏🏽

@@ -295,28 +297,45 @@ msgid ""
"also extract components (sequence elements or object attributes) from the "
"value into variables."
msgstr ""
":keyword:`match` 陳述式會拿取一個運算式,並將其值與多個連續的型樣 (pattern) "
Copy link
Collaborator

Choose a reason for hiding this comment

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

還是比較希望 pattern 被翻成「模式」,感覺比較口語化?


#: ../../tutorial/controlflow.rst:274
msgid ""
"Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and "
"never fails to match. If no case matches, none of the branches is executed."
msgstr ""
"請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元*\\ 的角色,且永遠不會"
Copy link
Collaborator

Choose a reason for hiding this comment

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

補一下原文好了

Suggested change
"請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元*\\ 的角色,且永遠不會"
"請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角色,且永遠不會"

@@ -327,13 +346,21 @@ msgid ""
"which makes it conceptually similar to the unpacking assignment ``(x, y) = "
"point``."
msgstr ""
"請仔細研究那個例子!第一個型樣有兩個字面值,可以想作是之前所述的字面值型樣的"
"延伸。但是接下來的兩個型樣結合了一個字面值和一個變數,且該變數\\ *連結*\\ 了"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: 既有翻譯大多譯作「繫結」

Suggested change
"延伸。但是接下來的兩個型樣結合了一個字面值和一個變數,且該變數\\ *連結*\\ 了"
"延伸。但是接下來的兩個型樣結合了一個字面值和一個變數,且該變數\\ *繫結 (bind)*\\ 了"

@@ -344,6 +371,12 @@ msgid ""
"\"y\"), the following patterns are all equivalent (and all bind the ``y`` "
"attribute to the ``var`` variable)::"
msgstr ""
"你可以將位置參數 (positional parameter) 與一些能夠排序其屬性的內建 class(例"
"如 dataclasses)一起使用。你也可以透過在 class 中設定特殊屬性 "
"``__match_args__``,來定義型樣中屬性們的特定位置。如果它被設定為 (“x”, “y”),"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"``__match_args__``,來定義型樣中屬性們的特定位置。如果它被設定為 (“x”, “y”),"
"``__match_args__``,來定義型樣中屬性們的特定位置。如果它被設定為 (\"x\", \"y\"),"


#: ../../tutorial/controlflow.rst:392
msgid ""
"Most literals are compared by equality, however the singletons ``True``, "
"``False`` and ``None`` are compared by identity."
msgstr ""
"大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) "
"``True``\\ 、\\ ``False`` 和 ``None`` 是藉由身份 (identity) 來比較。"
Copy link
Collaborator

Choose a reason for hiding this comment

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

https://docs.python.org/zh-tw/3/library/functions.html#id

Suggested change
"``True``\\ 、\\ ``False`` 和 ``None`` 是藉由身份 (identity) 來比較。"
"``True``\\ 、\\ ``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。"

@mattwang44 mattwang44 merged commit 3868ede into python:3.10 Jul 24, 2022
@StevenHsuYL StevenHsuYL deleted the controlflow branch July 27, 2022 02:56
beccalzh pushed a commit to beccalzh/python-docs-zh-tw that referenced this pull request Sep 4, 2024
* translate match statement

in tutorial/controlflow.po

* Apply suggestions from code review

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>

* Update controlflow.po

Update match section after Sync with CPython 3.10

* Apply suggestions from code review

All suggestions were applied.

Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants