Skip to content
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
90 changes: 75 additions & 15 deletions library/numbers.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@
# This file is distributed under the same license as the Python package.
#
# Translators:
# Liang-Bo Wang <me@liang2.tw>, 2016
# Matt Wang <mattwang44@gmail.com>, 2022
msgid ""
msgstr ""
"Project-Id-Version: Python 3.11\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-05 00:20+0000\n"
"PO-Revision-Date: 2016-11-19 00:32+0000\n"
"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n"
"POT-Creation-Date: 2022-10-16 04:24+0800\n"
"PO-Revision-Date: 2022-11-16 04:57+0800\n"
"Last-Translator: Matt Wang <mattwang44@gmail.com>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.2\n"

#: ../../library/numbers.rst:2
msgid ":mod:`numbers` --- Numeric abstract base classes"
msgstr ""
msgstr ":mod:`numbers` --- 數值的抽象基底類別"

#: ../../library/numbers.rst:7
msgid "**Source code:** :source:`Lib/numbers.py`"
Expand All @@ -33,16 +36,21 @@ msgid ""
"more operations. None of the types defined in this module are intended to "
"be instantiated."
msgstr ""
":mod:`numbers` 模組 (:pep:`3141`) 定義了數值\\ :term:`抽象基底類別 <abstract "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
":mod:`numbers` 模組 (:pep:`3141`) 定義了數值\\ :term:`抽象基底類別 <abstract "
":mod:`numbers` 模組 (:pep:`3141`) 定義了數值\ :term:`抽象基底類別 <abstract "

此處按文檔,應該只用一個\

@mattwang44 mattwang44 Dec 26, 2022

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

README 指的應該是在 PoEdit 上編輯的時候應要只輸入一個 \,但在 .po 檔案中會被轉換成 \\(第一個 \ 是跳脫字元);若是 .po 檔案中只留一個 \ 的話,雖然 build 出來的 html 會是正確的,但 PoEdit 編輯器上會顯示錯誤(如附圖)並在儲存時自動修正為 \\。目前其他譯文的 .po 檔案中也都是使用 \\
應該是要在 README 上敘述 PoEdit 有這個行為。

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

學到了一些新東西,非常感謝!🥰

@mattwang44 mattwang44 Dec 26, 2022

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

也非常感謝你的 review!

"base class>` 的階層結構,其中逐一定義了更多操作。此模組中定義的型別都不可被實"
"例化。"

#: ../../library/numbers.rst:18
msgid ""
"The root of the numeric hierarchy. If you just want to check if an argument "
"*x* is a number, without caring what kind, use ``isinstance(x, Number)``."
msgstr ""
"數值階層結構的基礎。如果你只想確認引數 *x* 是不是數值、並不關心其型別,請使"
"用 ``isinstance(x, Number)``。"

#: ../../library/numbers.rst:23
msgid "The numeric tower"
msgstr ""
msgstr "數值的階層"

#: ../../library/numbers.rst:27
msgid ""
Expand All @@ -52,57 +60,70 @@ msgid ""
"``, ``*``, ``/``, ``**``, :func:`abs`, :meth:`conjugate`, ``==``, and ``!"
"=``. All except ``-`` and ``!=`` are abstract."
msgstr ""
"這個型別的子類別描述了複數並包含適用於內建 :class:`complex` 型別的操作。這些"
"操作有::class:`complex` 和 :class:`bool` 的轉換、:attr:`.real`、:attr:`."
"imag`、``+``、``-``、``*``、``/``、``**``、:func:`abs`、:meth:`conjugate`、"
"``==`` 以及 ``!=``。除 ``-`` 和 ``!=`` 之外所有操作都是抽象的。"

#: ../../library/numbers.rst:35
msgid "Abstract. Retrieves the real component of this number."
msgstr ""
msgstr "為抽象的。取得該數值的實數部分。"

#: ../../library/numbers.rst:39
msgid "Abstract. Retrieves the imaginary component of this number."
msgstr ""
msgstr "為抽象的。取得該數值的虛數部分。"

#: ../../library/numbers.rst:43
msgid ""
"Abstract. Returns the complex conjugate. For example, ``(1+3j).conjugate() "
"== (1-3j)``."
msgstr ""
msgstr "為抽象的。回傳共軛複數,例如 ``(1+3j).conjugate() == (1-3j)``。"

#: ../../library/numbers.rst:48
msgid ""
"To :class:`Complex`, :class:`Real` adds the operations that work on real "
"numbers."
msgstr ""
msgstr "相對於 :class:`Complex`,:class:`Real` 加入了只有實數才能進行的操作。"

#: ../../library/numbers.rst:51
msgid ""
"In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :"
"func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, "
"``%``, ``<``, ``<=``, ``>``, and ``>=``."
msgstr ""
"簡單的說,有 :class:`float` 的轉換、:func:`math.trunc`、:func:`round`、:func:"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"簡單的說,有 :class:`float` 的轉換、:func:`math.trunc`、:func:`round`、:func:"
"簡單地說,有 :class:`float` 的轉換、:func:`math.trunc`、:func:`round`、:func:"

也許這裏應該使用“地”?書面語的話,副詞后跟動詞應該使用“地”連接。

@mattwang44 mattwang44 Dec 26, 2022

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

根據台灣教育部國語辭典,在做為副詞後的結構助詞時,「的」與「地」同義、皆可使用。

image

"`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、"
"``<=``、``>``、和 ``>=``。"

#: ../../library/numbers.rst:55
msgid ""
"Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :"
"attr:`~Complex.imag`, and :meth:`~Complex.conjugate`."
msgstr ""
"實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` "
"和 :meth:`~Complex.conjugate` 的預設值。"

#: ../../library/numbers.rst:61
msgid ""
"Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:"
"`~Rational.denominator` properties. It also provides a default for :func:"
"`float`."
msgstr ""
":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` 和 :attr:"
"`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。"

#: ../../library/numbers.rst:65
msgid ""
"The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values "
"should be instances of :class:`Integral` and should be in lowest terms with :"
"attr:`~Rational.denominator` positive."
msgstr ""
":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :"
"class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。"

#: ../../library/numbers.rst:71 ../../library/numbers.rst:75
msgid "Abstract."
msgstr ""
msgstr "為抽象的。"

#: ../../library/numbers.rst:80
msgid ""
Expand All @@ -111,10 +132,14 @@ msgid ""
"`~Rational.denominator`. Adds abstract methods for :func:`pow` with modulus "
"and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``."
msgstr ""
":class:`Rational` 的子型別,並增加了 :class:`int` 的轉換操作。為 :func:"
"`float`、:attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 提供了"
"預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string "
"operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。"

#: ../../library/numbers.rst:88
msgid "Notes for type implementors"
msgstr ""
msgstr "給型別實作者的註記"

#: ../../library/numbers.rst:90
msgid ""
Expand All @@ -123,21 +148,30 @@ msgid ""
"the real numbers. For example, :class:`fractions.Fraction` implements :func:"
"`hash` as follows::"
msgstr ""
"實作者需注意,相等的數值除了大小相等外,還必須擁有同樣的雜湊值。當使用兩個不"
"同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :"
"func:`hash` 實作如下:\n"
"\n"
"::"

#: ../../library/numbers.rst:109
msgid "Adding More Numeric ABCs"
msgstr ""
msgstr "加入更多數值 ABC"

#: ../../library/numbers.rst:111
msgid ""
"There are, of course, more possible ABCs for numbers, and this would be a "
"poor hierarchy if it precluded the possibility of adding those. You can add "
"``MyFoo`` between :class:`Complex` and :class:`Real` with::"
msgstr ""
"當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :"
"class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是:\n"
"\n"
"::"

#: ../../library/numbers.rst:123
msgid "Implementing the arithmetic operations"
msgstr ""
msgstr "實作算術操作"

#: ../../library/numbers.rst:125
msgid ""
Expand All @@ -147,6 +181,12 @@ msgid ""
"there. For subtypes of :class:`Integral`, this means that :meth:`__add__` "
"and :meth:`__radd__` should be defined as::"
msgstr ""
"我們想要實作算術操作,來使得混合模式操作要麼呼叫一個作者知道兩個引數之型別的"
"實作,要麼將其轉換成最接近的內建型別並執行這個操作。對於 :class:"
"`Integral` 的子型別,這意味著 :meth:`__add__` 和 :meth:`__radd__` 必須用如下方式定"
"義:\n"
"\n"
"::"

#: ../../library/numbers.rst:156
msgid ""
Expand All @@ -156,10 +196,14 @@ msgid ""
"an instance of ``A``, which is a subtype of :class:`Complex` (``a : A <: "
"Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:"
msgstr ""
":class:`Complex` 的子類別有 5 種不同的混合型別操作。我將上面提到所有不涉及 "
"``MyIntegral`` 和 ``OtherTypeIKnowAbout`` 的程式碼稱作「模板 "
"(boilerplate)」。``a`` 是 :class:`Complex` 之子型別 ``A`` 的實例 (``a : A "
"<: Complex``),同時 ``b : B <: Complex``。我將要計算 ``a + b``:"

#: ../../library/numbers.rst:163
msgid "If ``A`` defines an :meth:`__add__` which accepts ``b``, all is well."
msgstr ""
msgstr "如果 ``A`` 有定義成一個接受 ``b`` 的 :meth:`__add__`,不會發生問題。"

#: ../../library/numbers.rst:165
msgid ""
Expand All @@ -169,32 +213,44 @@ msgid ""
"`NotImplemented` from :meth:`__add__`. (Or ``A`` may not implement :meth:"
"`__add__` at all.)"
msgstr ""
"如果 ``A`` 回退成模板程式碼,它將回傳一個來自 :meth:`__add__` 的值,並喪失讓 "
"``B`` 定義一個更完善的 :meth:`__radd__` 的機會,因此模板需要回傳一個來自 :"
"meth:`__add__` 的 :const:`NotImplemented`。(或者 ``A`` 可能完全不實作 :meth:"
"`__add__`。)"

#: ../../library/numbers.rst:171
msgid ""
"Then ``B``'s :meth:`__radd__` gets a chance. If it accepts ``a``, all is "
"well."
msgstr ""
msgstr "接著看 ``B`` 的 :meth:`__radd__`。如果它接受 ``a`` ,不會發生問題。"

#: ../../library/numbers.rst:173
msgid ""
"If it falls back to the boilerplate, there are no more possible methods to "
"try, so this is where the default implementation should live."
msgstr ""
"如果沒有成功回退到模板,就沒有更多的方法可以去嘗試,因此這裡將使用預設的實"
"作。"

#: ../../library/numbers.rst:176
msgid ""
"If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, "
"because it was implemented with knowledge of ``A``, so it can handle those "
"instances before delegating to :class:`Complex`."
msgstr ""
"如果 ``B <: A``,Python 會在 ``A.__add__`` 之前嘗試 ``B.__radd__``。這是可行"
"的,因為它是透過對 ``A`` 的理解而實作的,所以這可以在交給 :class:`Complex` 之"
"前處理好這些實例。"

#: ../../library/numbers.rst:181
msgid ""
"If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, "
"then the appropriate shared operation is the one involving the built in :"
"class:`complex`, and both :meth:`__radd__` s land there, so ``a+b == b+a``."
msgstr ""
"如果 ``A <: Complex`` 和 ``B <: Real`` 且沒有共享任何其他型別上的理解,那麼適當的共享操作會涉"
"及內建的 :class:`complex`,並且分別用到 :meth:`__radd__`,因此 ``a+b == b"
"+a``。"

#: ../../library/numbers.rst:186
msgid ""
Expand All @@ -203,3 +259,7 @@ msgid ""
"reverse instances of any given operator. For example, :class:`fractions."
"Fraction` uses::"
msgstr ""
"由於大部分對任意給定類型的操作都十分相似的,定義一個為任意給定運算子生成向前 (forward) 與向"
"後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:`fractions.Fraction` 使用了:\n"
"\n"
"::"