Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit55cf96c

Browse files
authored
Update Translation oflibrary/typing.po (#854)
* feat: finish translate parts
1 parent8af0ec0 commit55cf96c

File tree

1 file changed

+71
-26
lines changed

1 file changed

+71
-26
lines changed

‎library/typing.po

Lines changed: 71 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ msgstr ""
77
"Project-Id-Version:Python 3.12\n"
88
"Report-Msgid-Bugs-To:\n"
99
"POT-Creation-Date:2024-03-06 00:03+0000\n"
10-
"PO-Revision-Date:2023-12-15 14:45+0800\n"
11-
"Last-Translator:RockLeon <therockleona@gmail.com>\n"
10+
"PO-Revision-Date:2024-03-26 11:30+0800\n"
11+
"Last-Translator:Li-Hung Wang <therockleona@gmail.com>\n"
1212
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
1313
"tw)\n"
1414
"Language:zh_TW\n"
@@ -146,8 +146,8 @@ msgstr "*引入*\\ 在定義函式之外的變數註釋語法,以及 :data:`Cl
146146
#:../../library/typing.rst:80
147147
msgid":pep:`544`: Protocols: Structural subtyping (static duck typing)"
148148
msgstr""
149-
":pep:`544`: 協定:建構式子型別 (Structural Subtyping) (靜態鴨子型別,"
150-
"StaticDuck Typing)"
149+
":pep:`544`: 協定:結構子型別 (Structural Subtyping) (靜態鴨子型別,Static"
150+
"Duck Typing)"
151151

152152
#:../../library/typing.rst:80
153153
msgid""
@@ -890,14 +890,16 @@ msgstr ""
890890

891891
#:../../library/typing.rst:767
892892
msgid"Nominal vs structural subtyping"
893-
msgstr""
893+
msgstr"標稱 (nominal) 子型別 vs 結構子型別"
894894

895895
#:../../library/typing.rst:769
896896
msgid""
897897
"Initially :pep:`484` defined the Python static type system as using *nominal "
898898
"subtyping*. This means that a class ``A`` is allowed where a class ``B`` is "
899899
"expected if and only if ``A`` is a subclass of ``B``."
900900
msgstr""
901+
"最初 :pep:`484` 定義 Python 靜態型別系統使用\\ *標稱子型別*。這意味著只有 "
902+
"``A`` 為 ``B`` 的子類別時,``A`` 才被允許使用在預期是類別 ``B`` 出現的地方。"
901903

902904
#:../../library/typing.rst:773
903905
msgid""
@@ -907,6 +909,10 @@ msgid ""
907909
"unlike what one would normally do in idiomatic dynamically typed Python "
908910
"code. For example, this conforms to :pep:`484`::"
909911
msgstr""
912+
"這個需求之前也被運用在抽象基底類別,例如 :class:`~collections.abc.Iterable`。"
913+
"這種方式的問題在於,一個類別需要顯式的標記來支援他們,這並不符合 Python 風"
914+
"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :"
915+
"pep:`484`: ::"
910916

911917
#:../../library/typing.rst:786
912918
msgid""
@@ -916,13 +922,19 @@ msgid ""
916922
"``Iterable[int]`` by static type checkers. This is known as *structural "
917923
"subtyping* (or static duck-typing)::"
918924
msgstr""
925+
":pep:`544` 可以透過使用上方的程式碼,且在類別定義時不用顯式基底類別解決這個問"
926+
"題,讓 ``Bucket`` 被靜態型別檢查器隱性認為是 ``Sized`` 以及 "
927+
"``Iterable[int]`` 兩者的子型別。這就是眾所周知的\\ *結構子型別*\\ (或是靜態"
928+
"鴨子型別): ::"
919929

920930
#:../../library/typing.rst:802
921931
msgid""
922932
"Moreover, by subclassing a special class :class:`Protocol`, a user can "
923933
"define new custom protocols to fully enjoy structural subtyping (see "
924934
"examples below)."
925935
msgstr""
936+
"而且,基於一個特別的型別 :class:`Protocol` 建立子型別時,使用者可以定義新的"
937+
"協定並充份發揮結構子型別的優勢(請見下方範例)。"
926938

927939
#:../../library/typing.rst:807
928940
msgid"Module contents"
@@ -932,54 +944,58 @@ msgstr "模組內容"
932944
msgid""
933945
"The ``typing`` module defines the following classes, functions and "
934946
"decorators."
935-
msgstr""
947+
msgstr"模組 ``typing`` 定義了下列的類別、函式以及裝飾器。"
936948

937949
#:../../library/typing.rst:812
938950
msgid"Special typing primitives"
939-
msgstr""
951+
msgstr"特別型別原語 (primitive)"
940952

941953
#:../../library/typing.rst:815
942954
msgid"Special types"
943-
msgstr""
955+
msgstr"特別型別"
944956

945957
#:../../library/typing.rst:817
946958
msgid""
947959
"These can be used as types in annotations. They do not support subscription "
948960
"using ``[]``."
949-
msgstr""
961+
msgstr"這些可以在註釋中做為型別。他們並不支援 ``[]`` 的下標使用。"
950962

951963
#:../../library/typing.rst:822
952964
msgid"Special type indicating an unconstrained type."
953-
msgstr""
965+
msgstr"特別型別,指出一個不受約束 (unconstrained) 的型別。"
954966

955967
#:../../library/typing.rst:824
956968
msgid"Every type is compatible with :data:`Any`."
957-
msgstr""
969+
msgstr"所有型別皆與 :data:`Any` 相容。"
958970

959971
#:../../library/typing.rst:825
960972
msgid":data:`Any` is compatible with every type."
961-
msgstr""
973+
msgstr":data:`Any` 相容於所有型別。"
962974

963975
#:../../library/typing.rst:827
964976
msgid""
965977
":data:`Any` can now be used as a base class. This can be useful for avoiding "
966978
"type checker errors with classes that can duck type anywhere or are highly "
967979
"dynamic."
968980
msgstr""
981+
":data:`Any` 可以作為一個基礎類別。這對於在任何地方使用鴨子型別或是高度動態的"
982+
"型別,避免型別檢查器的錯誤是非常有用的。"
969983

970984
#:../../library/typing.rst:834
971985
msgid"A :ref:`constrained type variable <typing-constrained-typevar>`."
972-
msgstr""
986+
msgstr"一個\\ :ref:`不受約束的型別變數 <typing-constrained-typevar>`。"
973987

974988
#:../../library/typing.rst:836
975989
msgid"Definition::"
976-
msgstr""
990+
msgstr"定義: ::"
977991

978992
#:../../library/typing.rst:840
979993
msgid""
980994
"``AnyStr`` is meant to be used for functions that may accept :class:`str` "
981995
"or :class:`bytes` arguments but cannot allow the two to mix."
982996
msgstr""
997+
"``AnyStr`` 是對於函式有用的,他可以接受 :class:`str` 或 :class:`bytes` 引數但"
998+
"不可以將此兩種混合。"
983999

9841000
#:../../library/typing.rst:843../../library/typing.rst:934
9851001
#:../../library/typing.rst:953../../library/typing.rst:1010
@@ -997,10 +1013,13 @@ msgid ""
9971013
"`Any` type, nor does it mean\"any string\". In particular, ``AnyStr`` and "
9981014
"``str | bytes`` are different from each other and have different use cases::"
9991015
msgstr""
1016+
"請注意,儘管他的名稱相近,``AnyStr`` 與 :class:`Any` 型別無關,更不代表是「任"
1017+
"何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用"
1018+
"情境: ::"
10001019

10011020
#:../../library/typing.rst:869
10021021
msgid"Special type that includes only literal strings."
1003-
msgstr""
1022+
msgstr"特別型別,只包含文本字串。"
10041023

10051024
#:../../library/typing.rst:871
10061025
msgid""
@@ -1009,13 +1028,13 @@ msgid ""
10091028
"created by composing ``LiteralString``-typed objects is also acceptable as a "
10101029
"``LiteralString``."
10111030
msgstr""
1031+
"任何文本字串都相容於 ``LiteralString``,對於另一個 ``LiteralString`` 亦是如"
1032+
"此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 "
1033+
"``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。"
10121034

10131035
#:../../library/typing.rst:877../../library/typing.rst:1957
10141036
msgid"Example:"
1015-
msgstr""
1016-
"舉例來說:\n"
1017-
"\n"
1018-
"::"
1037+
msgstr"舉例來說: ::"
10191038

10201039
#:../../library/typing.rst:893
10211040
msgid""
@@ -1024,6 +1043,9 @@ msgid ""
10241043
"that generate type checker errors could be vulnerable to an SQL injection "
10251044
"attack."
10261045
msgstr""
1046+
"``LiteralString`` 對於敏感的 API 來說是有用的,其中任意的使用者產生的字串可能"
1047+
"會產生問題。舉例來說,上面兩個案例中產生的型別檢查器錯誤是脆弱的且容易受到 "
1048+
"SQL 注入攻擊。"
10271049

10281050
#:../../library/typing.rst:898
10291051
msgid"See :pep:`675` for more details."
@@ -1034,22 +1056,26 @@ msgid ""
10341056
"The `bottom type <https://en.wikipedia.org/wiki/Bottom_type>`_, a type that "
10351057
"has no members."
10361058
msgstr""
1059+
"`底部型別 (bottom type) <https://en.wikipedia.org/wiki/Bottom_type>`_,為一個"
1060+
"型別但沒有任何的成員。"
10371061

10381062
#:../../library/typing.rst:907
10391063
msgid""
10401064
"This can be used to define a function that should never be called, or a "
10411065
"function that never returns::"
1042-
msgstr""
1066+
msgstr"這可以被用來定義一個不應被呼叫的函式,或是一個不會回傳的函式: ::"
10431067

10441068
#:../../library/typing.rst:927
10451069
msgid""
10461070
"On older Python versions, :data:`NoReturn` may be used to express the same "
10471071
"concept. ``Never`` was added to make the intended meaning more explicit."
10481072
msgstr""
1073+
"在舊的 Python 版本當中,:data:`NoReturn` 可以用來當作一樣的概念使用。新增 "
1074+
"``Never`` 之後,則讓這個含義變得更為明確。"
10491075

10501076
#:../../library/typing.rst:932
10511077
msgid"Special type indicating that a function never returns."
1052-
msgstr""
1078+
msgstr"特別型別,指出一個永不回傳的函式。"
10531079

10541080
#:../../library/typing.rst:941
10551081
msgid""
@@ -1058,16 +1084,19 @@ msgid ""
10581084
"the :data:`Never` type should be used for this concept instead. Type "
10591085
"checkers should treat the two equivalently."
10601086
msgstr""
1087+
"``NoReturn`` 可以用來作為一個\\ `底部型別 <https://en.wikipedia.org/wiki/"
1088+
"Bottom_type>`_,一個沒有值的型別。從 Python 3.11 開始,型別 :data:`Never` 應"
1089+
"該改用這個概念。型別檢查器應該將這兩種型別視為相等的。"
10611090

10621091
#:../../library/typing.rst:951
10631092
msgid"Special type to represent the current enclosed class."
1064-
msgstr""
1093+
msgstr"特別型別,用來表示當前類別之內 (enclosed class)。"
10651094

10661095
#:../../library/typing.rst:967
10671096
msgid""
10681097
"This annotation is semantically equivalent to the following, albeit in a "
10691098
"more succinct fashion::"
1070-
msgstr""
1099+
msgstr"這個註釋在語意上相等於下列內容,且形式更為簡潔: ::"
10711100

10721101
#:../../library/typing.rst:979
10731102
msgid""
@@ -1077,26 +1106,34 @@ msgid ""
10771106
"object returned from ``SubclassOfFoo.return_self`` as being of type ``Foo`` "
10781107
"rather than ``SubclassOfFoo``."
10791108
msgstr""
1109+
"一般來說,如果某個東西回傳 ``self`` 如上方的範例所示,你則應該使用 ``Self`` "
1110+
"做為回傳值的註釋。若 ``Foo.return_self`` 被註釋為回傳 ``\"Foo\"``,則型別檢查"
1111+
"器應該推論這個從 ``SubclassOfFoo.return_self`` 回傳的物件為 ``Foo`` 型別,而"
1112+
"並非回傳 ``SubclassOfFoo`` 型別。"
10801113

10811114
#:../../library/typing.rst:985
10821115
msgid"Other common use cases include:"
1083-
msgstr""
1116+
msgstr"其他常見的使用案例包含: ::"
10841117

10851118
#:../../library/typing.rst:987
10861119
msgid""
10871120
":class:`classmethod`\\s that are used as alternative constructors and return "
10881121
"instances of the ``cls`` parameter."
10891122
msgstr""
1123+
":class:`classmethod` 被用來作為替代的建構函式 (constructor) 並回傳 ``cls`` 參"
1124+
"數的實例。"
10901125

10911126
#:../../library/typing.rst:989
10921127
msgid"Annotating an :meth:`~object.__enter__` method which returns self."
1093-
msgstr""
1128+
msgstr"註釋一個回傳自己的 :meth:`~object.__enter__` 方法。"
10941129

10951130
#:../../library/typing.rst:991
10961131
msgid""
10971132
"You should not use ``Self`` as the return annotation if the method is not "
10981133
"guaranteed to return an instance of a subclass when the class is subclassed::"
10991134
msgstr""
1135+
"當類別被子類別化時,若方法不保證回傳一個子類別的實例,你不應該使用 ``Self`` "
1136+
"作為回傳註釋: ::"
11001137

11011138
#:../../library/typing.rst:1002
11021139
msgid"See :pep:`673` for more details."
@@ -1106,14 +1143,17 @@ msgstr "更多細節請見 :pep:`673`。"
11061143
msgid""
11071144
"Special annotation for explicitly declaring a :ref:`type alias <type-"
11081145
"aliases>`."
1109-
msgstr""
1146+
msgstr"做為明確宣告一個\\ :ref:`型別別名 <type-aliases>` 的特別註釋。"
11101147

11111148
#:../../library/typing.rst:1016
11121149
msgid""
11131150
"``TypeAlias`` is particularly useful on older Python versions for annotating "
11141151
"aliases that make use of forward references, as it can be hard for type "
11151152
"checkers to distinguish these from normal variable assignments:"
11161153
msgstr""
1154+
"``TypeAlias`` 在舊的 Python 版本中特別有用,其註釋別名可以用來進行傳遞參照 "
1155+
"(forward reference),因為對於型別檢查器來說,分辨這些別名與一般的變數賦值相當"
1156+
"困難: ::"
11171157

11181158
#:../../library/typing.rst:1036
11191159
msgid"See :pep:`613` for more details."
@@ -1129,6 +1169,11 @@ msgid ""
11291169
"`TypeAlias` is not currently planned, but users are encouraged to migrate "
11301170
"to :keyword:`type` statements."
11311171
msgstr""
1172+
":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建立 :class:"
1173+
"`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖然 :data:"
1174+
"`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名稱,他們"
1175+
"是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓"
1176+
"勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。"
11321177

11331178
#:../../library/typing.rst:1051
11341179
msgid"Special forms"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp