Skip to content

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

Merged
merged 1 commit into from
Sep 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 56 additions & 8 deletions tutorial/controlflow.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.6 TW\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-26 18:54+0800\n"
"PO-Revision-Date: 2018-05-23 16:18+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"POT-Creation-Date: 2018-05-23 22:27+0800\n"
"PO-Revision-Date: 2018-07-12 20:50+0800\n"
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
"Language-Team: Chinese Traditional (http://www.transifex.com/python-tw-doc/"
"python-36-tw/language/zh-Hant/)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_TW\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 2.0.8\n"

#: ../../tutorial/controlflow.rst:5
msgid "More Control Flow Tools"
Expand Down Expand Up @@ -98,6 +99,8 @@ msgid ""
"With ``for w in words:``, the example would attempt to create an infinite "
"list, inserting ``defenestrate`` over and over again."
msgstr ""
"在 ``for w in words:`` 的情況,這個例子會試著重覆不斷地插入 "
"``defenestrate``,產生一個無限長的 list。"

#: ../../tutorial/controlflow.rst:88
msgid "The :func:`range` Function"
Expand All @@ -122,7 +125,7 @@ msgid ""
msgstr ""
"給定的結束值永遠不會出現在生成的序列中;\\ ``range(10)`` 生成的 10 個數值,即"
"對應存取一個長度為 10 的序列內每一個元素的索引值。也可以讓 range 從其他數值計"
"數,或者給定不同的級距(甚至為負;有時稱之為 'step'):\n"
"數,或者給定不同的級距(甚至為負;有時稱之為 step):\n"
"\n"
"::"

Expand Down Expand Up @@ -195,6 +198,8 @@ msgid ""
"The :keyword:`break` statement, like in C, breaks out of the innermost "
"enclosing :keyword:`for` or :keyword:`while` loop."
msgstr ""
":keyword:`break` 陳述,如同 C 語言,終止包含其最內部的 :keyword:`for` 或 :"
"keyword:`while` 迴圈。"

#: ../../tutorial/controlflow.rst:163
msgid ""
Expand Down Expand Up @@ -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"
Copy link
Collaborator

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?

"\n"
"::"

Expand Down Expand Up @@ -270,7 +275,7 @@ msgid ""
"ignored::"
msgstr ""
":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,它可幫助你以更宏觀"
"的角度思考並撰寫新的程式碼。\\ :keyword:`pass` 可自動忽略:\n"
"的角度思考並撰寫新的程式碼。\\ :keyword:`pass` 可被忽略:\n"
"\n"
"::"

Expand All @@ -283,6 +288,9 @@ msgid ""
"We can create a function that writes the Fibonacci series to an arbitrary "
"boundary::"
msgstr ""
"我們可以建立一個函式來產生費式數列到任何一個上界:\n"
"\n"
"::"

#: ../../tutorial/controlflow.rst:265
msgid ""
Expand All @@ -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` 帶入一個函式的\\ *定義*。它之後必須連著該函式的名稱和置"
"於括號之中的參數們。自下一行起,所有縮排的陳述成為該函式的主體。"
Copy link
Collaborator

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 "參數們".


#: ../../tutorial/controlflow.rst:270
msgid ""
Expand All @@ -302,6 +312,11 @@ msgid ""
"through code; it's good practice to include docstrings in code that you "
"write, so make a habit of it."
msgstr ""
"一個函式的第一個陳述可以是一個字串值;此情況該字串值被視為該函式的說明文件字"
"串,即 :dfn:`docstring`\\ 。(關於 docstring 的細節請參見\\ :ref:`tut-"
"docstrings`\\ 段落。)有些工具可以使用 docstring 來自動產生線上或可列印的文"
"件,或讓使用者能自由地自原始碼中瀏覽文件。在原始碼中加入 docstring 是個好慣"
"例,應該養成這樣的習慣。"

#: ../../tutorial/controlflow.rst:277
msgid ""
Expand All @@ -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)來儲存該函式內的區域變數。更"
"精確地說,所有在函式內的變數賦值都會把該值儲存在一個區域符號表。然而,在讀取"
"一個變數時,會先從區域符號表起搜尋,其次為所有包含其函式的區域符號表們,其次"
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/區域符號表們/區域符號表/

"為全域符號表,最後為所有內建的名稱。因此,在函式中,全域變數無法被直接賦值"
"(除非該變數是透過 :keyword:`global` 陳述建立),但它們可以被讀取。"
Copy link
Collaborator

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?


#: ../../tutorial/controlflow.rst:286
msgid ""
Expand All @@ -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 ""
"在一個函式被呼叫的時候,實際傳入的參數們(引數)會被加入至該函數的區域符號"
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/參數們/參數/

"表。因此,引數傳入的方式為\\ *傳值呼叫 (call by value)*\\ (這裡傳遞的「值」"
"永遠是一個物件的參照,而不是該物件的值)。\\ [#]_ 當一個函式呼叫別的函式時,"
Copy link
Collaborator

Choose a reason for hiding this comment

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

"reference" is marked as italic text in the source, it should also be present in the translation in order to emphasise. Also, reference is considered a professional enough term (I think) that should have the original word quoted after the translation.

"在被呼叫的函式中會建立一個新的區域符號表。"

#: ../../tutorial/controlflow.rst:292
msgid ""
Expand All @@ -332,6 +356,11 @@ msgid ""
"another name which can then also be used as a function. This serves as a "
"general renaming mechanism::"
msgstr ""
"一個函式定義會把該函式名稱加入至當前的符號表。該函式名稱的值帶有一個型別,並"
"被直譯器辨識為使用者自定函式。該值可以被賦予別的變數名。這即是常見的重新命名"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like the translation for "which can then also be used as a function" is missing here. A possible translation could be "該變數也可以被當作函式使用"

"方式:\n"
"\n"
"::"

#: ../../tutorial/controlflow.rst:304
msgid ""
Expand All @@ -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` 陳述,它亦"
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/它為沒有回傳值/它並沒有回傳值/

"有一個固定的回傳值。這個值為 ``None``\\ (它是一個內建名稱)。在直譯器中單獨"
"使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它:\n"
"\n"
"::"

#: ../../tutorial/controlflow.rst:315
msgid ""
"It is simple to write a function that returns a list of the numbers of the "
"Fibonacci series, instead of printing it::"
msgstr ""
"如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易:\n"
"\n"
"::"

#: ../../tutorial/controlflow.rst:331
msgid "This example, as usual, demonstrates some new Python features:"
msgstr ""
msgstr "這個例子一樣示範了一些新的 Python 特性:"

#: ../../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``\\ 。"
Copy link
Collaborator

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 "表達式作為引數"?


#: ../../tutorial/controlflow.rst:337
msgid ""
Expand All @@ -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(方法)。"
Copy link
Collaborator

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/

"method 為「屬於」一個物件的函式,命名規則為 ``obj.methodname``\\ ,其中 "
"``obj`` 為某個物件(亦可為一表達式),而 ``methodname`` 為該 method 的名稱,"
"並被該物件決定其型別。不同的型別代表不同的 method。不同型別的 method 可以擁有"
Copy link
Collaborator

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.

"一樣的名稱而不會讓 Python 混淆。(你可以使用 class 定自己的物件型別和 "
Copy link
Collaborator

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/定/定義/

"method,見 :ref:`tut-classes`\\ )這裡 :meth:`append` method 定義在 list 物件"
"中;它會加入一個新的元素在該 list 的末端。這個例子等同於 ``result = result + "
"[a]``\\ ,但更有效率。"

#: ../../tutorial/controlflow.rst:352
msgid "More on Defining Functions"
Expand Down