Skip to content

Translate library/typing.po from 'Intro' to 'Type Alias' #646

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 7 commits into from
Sep 10, 2023
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
118 changes: 77 additions & 41 deletions library/typing.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-27 00:19+0000\n"
"PO-Revision-Date: 2018-05-23 16:14+0000\n"
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
"PO-Revision-Date: 2023-09-05 14:49+0800\n"
"Last-Translator: RockLeon <therockleona@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.3.1\n"

#: ../../library/typing.rst:3
msgid ":mod:`typing` --- Support for type hints"
msgstr ""
msgstr ":mod:`typing` --- 支援型別提示"

#: ../../library/typing.rst:16
msgid "**Source code:** :source:`Lib/typing.py`"
Expand All @@ -32,184 +33,217 @@ msgid ""
"They can be used by third party tools such as type checkers, IDEs, linters, "
"etc."
msgstr ""
"Python 執行環境不強制要求函式與變數的型別註釋。他們可以被第三方工具使用,如:"
"型別檢查器、IDE、linter 等。"

#: ../../library/typing.rst:26
msgid ""
"This module provides runtime support for type hints. For the original "
"specification of the typing system, see :pep:`484`. For a simplified "
"introduction to type hints, see :pep:`483`."
msgstr ""
"這個模組提供可以支援型別提示的 runtime。關於加註型別系統的原有規格"
",請看 :pep:`484`。關於型別提示的簡易介紹,請看 :pep:`483`。"

#: ../../library/typing.rst:31
msgid ""
"The function below takes and returns a string and is annotated as follows::"
msgstr ""
msgstr "以下函式接受及回傳都是使用字串,且註解方式如下: ::"

#: ../../library/typing.rst:36
msgid ""
"In the function ``greeting``, the argument ``name`` is expected to be of "
"type :class:`str` and the return type :class:`str`. Subtypes are accepted as "
"arguments."
msgstr ""
"在函式 ``greeting`` 當中,引數 ``name`` 的型別應為 :class:`str` 且回傳的型別"
"也是 :class:`str`。該引數也可以接受其子型別。"

#: ../../library/typing.rst:40
msgid ""
"New features are frequently added to the ``typing`` module. The "
"`typing_extensions <https://pypi.org/project/typing-extensions/>`_ package "
"provides backports of these new features to older versions of Python."
msgstr ""
"新功能會頻繁的新增至 ``typing`` 模組中。`typing_extensions <https://pypi.org/"
"project/typing-extensions/>`_ 套件為這些新功能提供了 backport(向後移植的)版"
"本,提供給舊版本的 Python 使用。"

#: ../../library/typing.rst:44
msgid ""
"For a summary of deprecated features and a deprecation timeline, please see "
"`Deprecation Timeline of Major Features`_."
msgstr ""
"棄用功能及其棄用時間線的簡介,請看\\ `Deprecation Timeline of Major "
"Features`_ \\。"

#: ../../library/typing.rst:50
msgid ""
"`\"Typing cheat sheet\" <https://mypy.readthedocs.io/en/stable/"
"cheat_sheet_py3.html>`_"
msgstr ""
"`\"型別小抄 (Typing cheat sheet)\" <https://mypy.readthedocs.io/en/stable/"
"cheat_sheet_py3.html>`_"

#: ../../library/typing.rst:50
msgid "A quick overview of type hints (hosted at the mypy docs)"
msgstr ""
msgstr "型別提示的快速預覽(發布於 mypy 的文件中)"

#: ../../library/typing.rst:55
msgid ""
"\"Type System Reference\" section of `the mypy docs <https://mypy."
"readthedocs.io/en/stable/index.html>`_"
msgstr ""
"`mypy 文件 <https://mypy.readthedocs.io/en/stable/index.html>`_\\ 的 \"型別系"
"統參考資料 (Type System Reference)\" 章節"

#: ../../library/typing.rst:53
msgid ""
"The Python typing system is standardised via PEPs, so this reference should "
"broadly apply to most Python type checkers. (Some parts may still be "
"specific to mypy.)"
msgstr ""
"Python 的加註型別系統是基於 PEPs 進行標準化,所以這個參照 (reference) "
"應該在多數 Python 型別檢查器中廣為使用。(某些部分依然是特定給 mypy 使用。)"

#: ../../library/typing.rst:59
msgid ""
"`\"Static Typing with Python\" <https://typing.readthedocs.io/en/latest/>`_"
msgstr ""
"`\"Python 的靜態型別 (Static Typing)\" <https://typing.readthedocs.io/en/"
"latest/>`_"

#: ../../library/typing.rst:58
msgid ""
"Type-checker-agnostic documentation written by the community detailing type "
"system features, useful typing related tools and typing best practices."
msgstr ""
"由社群編寫的跨平台型別檢查器文件 (type-checker-agnostic) 詳細描述加註型別系統"
"的功能、實用的加註型別衍伸工具、以及加註型別的最佳實踐 (best practice)。"

#: ../../library/typing.rst:65
msgid "Relevant PEPs"
msgstr ""
msgstr "相關的 PEPs"

#: ../../library/typing.rst:67
msgid ""
"Since the initial introduction of type hints in :pep:`484` and :pep:`483`, a "
"number of PEPs have modified and enhanced Python's framework for type "
"annotations:"
msgstr ""
"自從 :pep:`484` 及 :pep:`483` 對於型別提示的基礎引入,多個 PEPs 針對型別註釋"
"的 Python 框架進行修訂及加強:"

#: ../../library/typing.rst:77
msgid ":pep:`526`: Syntax for Variable Annotations"
msgstr ""
msgstr ":pep:`526`:變數註釋的語法"

#: ../../library/typing.rst:77
msgid ""
"*Introducing* syntax for annotating variables outside of function "
"definitions, and :data:`ClassVar`"
msgstr ""
msgstr "*引入*\\ 在定義函式之外的變數註釋語法,以及 :data:`ClassVar`"

#: ../../library/typing.rst:80
msgid ":pep:`544`: Protocols: Structural subtyping (static duck typing)"
msgstr ""
":pep:`544`: 協定:建構式子型別 (Structural Subtyping) (靜態鴨子型別,"
"Static Duck Typing)"

#: ../../library/typing.rst:80
msgid ""
"*Introducing* :class:`Protocol` and the :func:"
"`@runtime_checkable<runtime_checkable>` decorator"
msgstr ""
"*引入* :class:`Protocol` 以及 :func:`@runtime_checkable<runtime_checkable>` "
"裝飾器 (decorator)"

#: ../../library/typing.rst:83
msgid ":pep:`585`: Type Hinting Generics In Standard Collections"
msgstr ""
":pep:`585`:基礎彙集 (collection) 中的型別提示泛型 (Type Hinting Generics In "
"Standard Collections)"

#: ../../library/typing.rst:83
msgid ""
"*Introducing* :class:`types.GenericAlias` and the ability to use standard "
"library classes as :ref:`generic types<types-genericalias>`"
msgstr ""
"*引入* :class:`types.GenericAlias` 以及使用基礎函式庫類別 :ref:`generic "
"types<types-genericalias>` 的能力"

#: ../../library/typing.rst:85
msgid ":pep:`586`: Literal Types"
msgstr ""
msgstr ":pep:`586`:文字型別"

#: ../../library/typing.rst:86
msgid "*Introducing* :data:`Literal`"
msgstr ""
msgstr "*引入* :data:`Literal`"

#: ../../library/typing.rst:87
msgid ""
":pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys"
msgstr ""
msgstr ":pep:`589`:TypedDict:含有一組固定 (fixed) 鍵值的型別提示字典"

#: ../../library/typing.rst:88
msgid "*Introducing* :class:`TypedDict`"
msgstr ""
msgstr "*引入* :class:`TypedDict`"

#: ../../library/typing.rst:89
msgid ":pep:`591`: Adding a final qualifier to typing"
msgstr ""
msgstr ":pep:`591`:為型別新增一個最終限定符 (final qualifier)"

#: ../../library/typing.rst:90
msgid "*Introducing* :data:`Final` and the :func:`@final<final>` decorator"
msgstr ""
msgstr "*引入* :data:`Final` 以及 :func:`@final<final>` 裝飾器"

#: ../../library/typing.rst:91
msgid ":pep:`593`: Flexible function and variable annotations"
msgstr ""
msgstr ":pep:`593`:彈性函式及變數註釋"

#: ../../library/typing.rst:92
msgid "*Introducing* :data:`Annotated`"
msgstr ""
msgstr "*引入* :data:`Annotated`"

#: ../../library/typing.rst:95
msgid ":pep:`604`: Allow writing union types as ``X | Y``"
msgstr ""
msgstr ":pep:`604`:允許寫入聯集型別 (union type) 為 ``X | Y``"

#: ../../library/typing.rst:94
msgid ""
"*Introducing* :data:`types.UnionType` and the ability to use the binary-or "
"operator ``|`` to signify a :ref:`union of types<types-union>`"
msgstr ""
"*引入* :data:`types.UnionType` 以及使用 binary-or 運算子 ``|`` 以表示\\ :ref:"
"`型別聯合 <types-union>`\\ 的能力"

#: ../../library/typing.rst:97
msgid ":pep:`612`: Parameter Specification Variables"
msgstr ""
msgstr ":pep:`612`:參數規格變數 (Parameter Specification Variable)"

#: ../../library/typing.rst:98
msgid "*Introducing* :class:`ParamSpec` and :data:`Concatenate`"
msgstr ""
msgstr "*引入* :class:`ParamSpec` 及 :data:`Concatenate`"

#: ../../library/typing.rst:99
msgid ":pep:`613`: Explicit Type Aliases"
msgstr ""
msgstr ":pep:`613`:顯式型別別名 (Explicit Type Alias)"

#: ../../library/typing.rst:100
msgid "*Introducing* :data:`TypeAlias`"
msgstr "*引入* :data:`TypeAlias`"

#: ../../library/typing.rst:101
msgid ":pep:`646`: Variadic Generics"
msgstr ""
msgstr ":pep:`646`:可變參數泛型 (Variadic Generic)"

#: ../../library/typing.rst:102
msgid "*Introducing* :data:`TypeVarTuple`"
msgstr "*引入* :data:`TypeVarTuple`"

#: ../../library/typing.rst:103
msgid ":pep:`647`: User-Defined Type Guards"
msgstr ""
msgstr ":pep:`647`:使用者定義的型別防護 (Type Guard)"

#: ../../library/typing.rst:104
msgid "*Introducing* :data:`TypeGuard`"
Expand All @@ -219,31 +253,31 @@ msgstr "*引入* :data:`TypeGuard`"
msgid ""
":pep:`655`: Marking individual TypedDict items as required or potentially "
"missing"
msgstr ""
msgstr ":pep:`655`:標記個別的 TypedDict 物件為必需的或可能遺失的"

#: ../../library/typing.rst:106
msgid "*Introducing* :data:`Required` and :data:`NotRequired`"
msgstr "*引入* :data:`Required` 和 :data:`NotRequired`"

#: ../../library/typing.rst:107
msgid ":pep:`673`: Self type"
msgstr ""
msgstr ":pep:`673`:Self 型別"

#: ../../library/typing.rst:108
msgid "*Introducing* :data:`Self`"
msgstr "*引入* :data:`Self`"

#: ../../library/typing.rst:109
msgid ":pep:`675`: Arbitrary Literal String Type"
msgstr ""
msgstr ":pep:`675`:任意的文本字串型別 (Arbitrary Literal String Type)"

#: ../../library/typing.rst:110
msgid "*Introducing* :data:`LiteralString`"
msgstr "*引入* :data:`LiteralString`"

#: ../../library/typing.rst:111
msgid ":pep:`681`: Data Class Transforms"
msgstr ""
msgstr ":pep:`681`:資料類別轉換"

#: ../../library/typing.rst:112
msgid ""
Expand All @@ -252,60 +286,70 @@ msgstr "*引入* :func:`@dataclass_transform<dataclass_transform>` 裝飾器"

#: ../../library/typing.rst:114
msgid ":pep:`692`: Using ``TypedDict`` for more precise ``**kwargs`` typing"
msgstr ""
msgstr ":pep:`692`:為更精準的 ``**kwargs`` 型別使用 ``TypedDict``"

#: ../../library/typing.rst:114
msgid ""
"*Introducing* a new way of typing ``**kwargs`` with :data:`Unpack` and :data:"
"`TypedDict`"
msgstr ""
"*引入* 型別 ``**kwargs`` 的新方式 :data:`Unpack` 以及 :data:`TypedDict`"

#: ../../library/typing.rst:116
msgid ":pep:`695`: Type Parameter Syntax"
msgstr ""
msgstr ":pep:`695`:型別參數語法"

#: ../../library/typing.rst:117
msgid ""
"*Introducing* builtin syntax for creating generic functions, classes, and "
"type aliases."
msgstr ""
msgstr "*引入*\\ 建立泛型函式、類別、型別別名的內建語法。"

#: ../../library/typing.rst:119
msgid ":pep:`698`: Adding an override decorator to typing"
msgstr ""
msgstr ":pep:`698`:為型別新增可覆寫的裝飾器"

#: ../../library/typing.rst:119
msgid "*Introducing* the :func:`@override<override>` decorator"
msgstr "*引入* :func:`@override<override>` 裝飾器"

#: ../../library/typing.rst:129
msgid "Type aliases"
msgstr ""
msgstr "型別別名"

#: ../../library/typing.rst:131
msgid ""
"A type alias is defined using the :keyword:`type` statement, which creates "
"an instance of :class:`TypeAliasType`. In this example, ``Vector`` and "
"``list[float]`` will be treated equivalently by static type checkers::"
msgstr ""
"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立了 :class:"
"`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 ``list[float]`` 會被當作"
"和靜態型別檢查器一樣同等對待: ::"

#: ../../library/typing.rst:144
msgid ""
"Type aliases are useful for simplifying complex type signatures. For "
"example::"
msgstr ""
"型別別名對於簡化複雜的型別簽名 (complex type signature) 非常好用。舉例來"
"說: ::"

#: ../../library/typing.rst:162
msgid ""
"The :keyword:`type` statement is new in Python 3.12. For backwards "
"compatibility, type aliases can also be created through simple assignment::"
msgstr ""
":keyword:`type` 陳述式是 Python 3.12 的新功能。為了向後相容性,型別別名可以透"
"過簡單的賦值來建立: ::"

#: ../../library/typing.rst:167
msgid ""
"Or marked with :data:`TypeAlias` to make it explicit that this is a type "
"alias, not a normal variable assignment::"
msgstr ""
"或是用 :data:`TypeAlias` 標記,讓它明確的表示這是一個型別別名,而非一般的變數"
"賦值: ::"

#: ../../library/typing.rst:177
msgid "NewType"
Expand Down Expand Up @@ -407,9 +451,9 @@ msgstr ""

#: ../../library/typing.rst:254 ../../library/typing.rst:2679
msgid "For example:"
msgstr "舉例來說"
msgstr "舉例來說"

#: ../../library/typing.rst:272
#: ../../library/typing.rst:272 ../../library/typing.rst:995
msgid ""
"The subscription syntax must always be used with exactly two values: the "
"argument list and the return type. The argument list must be a list of "
Expand Down Expand Up @@ -992,14 +1036,6 @@ msgid ""
"of type :class:`int` and returns a :class:`str`."
msgstr ""

#: ../../library/typing.rst:995
msgid ""
"The subscription syntax must always be used with exactly two values: the "
"argument list and the return type. The argument list must be a list of "
"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return "
"type must be a single type."
msgstr ""

#: ../../library/typing.rst:1000
msgid ""
"There is no syntax to indicate optional or keyword arguments; such function "
Expand Down