-
-
Notifications
You must be signed in to change notification settings - Fork 214
Translating tutorial/controlflow #18
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
Conversation
Complete translation until section 4.7. More on Defining Functions
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.
Thank you so much for the translation! ✨
There are some minor changes that I think would be better if made, please feel free to open a discussion if you don't agree on any of those. 😄
@@ -237,7 +242,7 @@ msgid "" | |||
"The :keyword:`continue` statement, also borrowed from C, continues with the " | |||
"next iteration of the loop::" | |||
msgstr "" | |||
":keyword:`continue` 陳述,亦承襲於 C 語言,讓迴圈於下個选代起繼續執行:\n" | |||
":keyword:`continue` 陳述,亦承襲於 C 語言,讓所屬的迴圈繼續執行下個选代:\n" |
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.
Was looking up for translations of the word "iteration", I found that it's common that people use "迭代" in China, whereas in Taiwan people tend to use "疊代", e.g. Wikipedia - 疊代法
I'd suggest to replace all the "迭代"s to "疊代". But it seems like "迭代" is still frequently used in documentations of other programming languages or in general. Do you have any idea on this?
@@ -291,6 +299,8 @@ msgid "" | |||
"parameters. The statements that form the body of the function start at the " | |||
"next line, and must be indented." | |||
msgstr "" | |||
"關鍵字 :keyword:`def` 帶入一個函式的\\ *定義*。它之後必須連著該函式的名稱和置" | |||
"於括號之中的參數們。自下一行起,所有縮排的陳述成為該函式的主體。" |
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's no plural forms for nouns other than personal pronouns or humans, therefore the translation for "parameters" would be "參數" instead of "參數們".
@@ -314,6 +329,11 @@ msgid "" | |||
"assigned a value within a function (unless named in a :keyword:`global` " | |||
"statement), although they may be referenced." | |||
msgstr "" | |||
"函式執行期間會建立一個新的符號表(symbol table)來儲存該函式內的區域變數。更" | |||
"精確地說,所有在函式內的變數賦值都會把該值儲存在一個區域符號表。然而,在讀取" | |||
"一個變數時,會先從區域符號表起搜尋,其次為所有包含其函式的區域符號表們,其次" |
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.
s/區域符號表們/區域符號表/
"精確地說,所有在函式內的變數賦值都會把該值儲存在一個區域符號表。然而,在讀取" | ||
"一個變數時,會先從區域符號表起搜尋,其次為所有包含其函式的區域符號表們,其次" | ||
"為全域符號表,最後為所有內建的名稱。因此,在函式中,全域變數無法被直接賦值" | ||
"(除非該變數是透過 :keyword:`global` 陳述建立),但它們可以被讀取。" |
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.
I'd say translating "named" into "建立" is a little bit weird since the variables are not "constructed" nor "defined" inside the function. Maybe "提及" or "提名" can be a better translation for that?
@@ -323,6 +343,10 @@ msgid "" | |||
"*reference*, not the value of the object). [#]_ When a function calls " | |||
"another function, a new local symbol table is created for that call." | |||
msgstr "" | |||
"在一個函式被呼叫的時候,實際傳入的參數們(引數)會被加入至該函數的區域符號" |
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.
s/參數們/參數/
@@ -343,23 +372,34 @@ msgid "" | |||
"the only value written. You can see it if you really want to using :func:" | |||
"`print`::" | |||
msgstr "" | |||
"如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure)," | |||
"因為它為沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述,它亦" |
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.
s/它為沒有回傳值/它並沒有回傳值/
|
||
#: ../../tutorial/controlflow.rst:333 | ||
msgid "" | ||
"The :keyword:`return` statement returns with a value from a function. :" | ||
"keyword:`return` without an expression argument returns ``None``. Falling " | ||
"off the end of a function also returns ``None``." | ||
msgstr "" | ||
":keyword:`return` 陳述會讓一個函式回傳一個值。單獨使用 :keyword:`return` 不外" | ||
"加一個表達引數會回傳 ``None``\\ 。一個函式執行到結束也會回傳 ``None``\\ 。" |
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.
I think "表達引數" sounds quite unnatural, maybe it'll be more clear in meaning to translate as "表達式作為引數"?
@@ -374,6 +414,14 @@ msgid "" | |||
"for list objects; it adds a new element at the end of the list. In this " | |||
"example it is equivalent to ``result = result + [a]``, but more efficient." | |||
msgstr "" | |||
"``result.append(a)`` 陳述呼叫了一個 list 物件 ``result`` 的 method(方法)。" |
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.
s/list 物件 result 的 method/list 物件的 result method/
"``result.append(a)`` 陳述呼叫了一個 list 物件 ``result`` 的 method(方法)。" | ||
"method 為「屬於」一個物件的函式,命名規則為 ``obj.methodname``\\ ,其中 " | ||
"``obj`` 為某個物件(亦可為一表達式),而 ``methodname`` 為該 method 的名稱," | ||
"並被該物件決定其型別。不同的型別代表不同的 method。不同型別的 method 可以擁有" |
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.
Is "並被該物件決定其型別" the translation for the clause "is defined by the object's type"? If yes, I propose that "並由該物件的型別所定義" would be a better translation.
"method 為「屬於」一個物件的函式,命名規則為 ``obj.methodname``\\ ,其中 " | ||
"``obj`` 為某個物件(亦可為一表達式),而 ``methodname`` 為該 method 的名稱," | ||
"並被該物件決定其型別。不同的型別代表不同的 method。不同型別的 method 可以擁有" | ||
"一樣的名稱而不會讓 Python 混淆。(你可以使用 class 定自己的物件型別和 " |
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.
"class" should be marked as italic text as in the source.
s/定/定義/
Currently missing:
Close #2.