From 1fc40409812fb645022e70497fc996ba818b8714 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Mon, 22 May 2023 13:23:24 +0800 Subject: [PATCH] feat: translate library/html.parser.po --- library/html.parser.po | 126 ++++++++++++++++++++++++++++++++++------- 1 file changed, 106 insertions(+), 20 deletions(-) diff --git a/library/html.parser.po b/library/html.parser.po index b0698b90f0..4305da1965 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -1,15 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2023, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Matt Wang , 2023 msgid "" msgstr "" "Project-Id-Version: Python 3.11\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-02-18 00:10+0000\n" -"PO-Revision-Date: 2018-05-23 16:03+0000\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2023-05-04 22:54+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,10 +17,11 @@ msgstr "" "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.2\n" #: ../../library/html.parser.rst:2 msgid ":mod:`html.parser` --- Simple HTML and XHTML parser" -msgstr "" +msgstr ":mod:`html.parser` --- 簡單的 HTML 和 XHTML 剖析器" #: ../../library/html.parser.rst:7 msgid "**Source code:** :source:`Lib/html/parser.py`" @@ -32,10 +33,12 @@ msgid "" "for parsing text files formatted in HTML (HyperText Mark-up Language) and " "XHTML." msgstr "" +"該模組定義了一個類別 :class:`HTMLParser`,是剖析 (parse) HTML(HyperText " +"Mark-up Language、超文本標記語言)和 XHTML 格式文本檔案的基礎。" #: ../../library/html.parser.rst:20 msgid "Create a parser instance able to parse invalid markup." -msgstr "" +msgstr "建立一個能夠剖析無效標記的剖析器實例。" #: ../../library/html.parser.rst:22 msgid "" @@ -43,6 +46,8 @@ msgid "" "(except the ones in ``script``/``style`` elements) are automatically " "converted to the corresponding Unicode characters." msgstr "" +"如果 *convert_charrefs* 為 ``True`` (預設值),所有字元參照 (reference)" +"( ``script``/``style`` 元素中的參照除外)將自動轉換為相應的 Unicode 字元。" #: ../../library/html.parser.rst:26 msgid "" @@ -51,6 +56,9 @@ msgid "" "encountered. The user should subclass :class:`.HTMLParser` and override its " "methods to implement the desired behavior." msgstr "" +":class:`.HTMLParser` 實例被提供 HTML 資料,並在遇到開始標籤、結束標籤、文本、" +"註解和其他標記元素時呼叫處理程式 (handler) 方法。使用者應該繼承 :class:`." +"HTMLParser` 並覆蓋其方法以實作所需的行為。" #: ../../library/html.parser.rst:31 msgid "" @@ -58,18 +66,20 @@ msgid "" "tag handler for elements which are closed implicitly by closing an outer " "element." msgstr "" +"此剖析器不檢查結束標籤是否與開始標籤匹配,也不會為透過結束外部元素來隱晦地被" +"結束的元素呼叫結束標籤處理程式。" #: ../../library/html.parser.rst:34 msgid "*convert_charrefs* keyword argument added." -msgstr "" +msgstr "新增關鍵字引數 *convert_charrefs*。" #: ../../library/html.parser.rst:37 msgid "The default value for argument *convert_charrefs* is now ``True``." -msgstr "" +msgstr "引數 *convert_charrefs* 的預設值現在是 ``True``。" #: ../../library/html.parser.rst:42 msgid "Example HTML Parser Application" -msgstr "" +msgstr "HTML 剖析器應用程式範例" #: ../../library/html.parser.rst:44 msgid "" @@ -77,18 +87,22 @@ msgid "" "`HTMLParser` class to print out start tags, end tags, and data as they are " "encountered::" msgstr "" +"以下的基礎範例是一個簡單的 HTML 剖析器,它使用 :class:`HTMLParser` 類別,當遇" +"到開始標籤、結束標籤和資料時將它們印出:\n" +"\n" +"::" #: ../../library/html.parser.rst:64 msgid "The output will then be:" -msgstr "" +msgstr "輸出將是:" #: ../../library/html.parser.rst:83 msgid ":class:`.HTMLParser` Methods" -msgstr "" +msgstr ":class:`.HTMLParser` 方法" #: ../../library/html.parser.rst:85 msgid ":class:`HTMLParser` instances have the following methods:" -msgstr "" +msgstr ":class:`HTMLParser` 實例具有以下方法:" #: ../../library/html.parser.rst:90 msgid "" @@ -96,6 +110,8 @@ msgid "" "complete elements; incomplete data is buffered until more data is fed or :" "meth:`close` is called. *data* must be :class:`str`." msgstr "" +"向剖析器提供一些文本。只要它由完整的元素組成,它就會被處理;不完整的資料會被" +"緩衝,直到輸入更多資料或呼叫 :meth:`close`。 *data* 必須是 :class:`str`。" #: ../../library/html.parser.rst:97 msgid "" @@ -104,16 +120,19 @@ msgid "" "additional processing at the end of the input, but the redefined version " "should always call the :class:`HTMLParser` base class method :meth:`close`." msgstr "" +"強制處理所有緩衝資料,如同它後面跟有文件結束標籤一樣。此方法可能有被衍生類別" +"重新定義,以在輸入末尾定義額外的處理,但重新定義的版本仍應要呼叫 :class:" +"`HTMLParser` 基底類別方法 :meth:`close`。" #: ../../library/html.parser.rst:105 msgid "" "Reset the instance. Loses all unprocessed data. This is called implicitly " "at instantiation time." -msgstr "" +msgstr "重置實例。丟棄所有未處理的資料。這在實例化時被會隱晦地呼叫。" #: ../../library/html.parser.rst:111 msgid "Return current line number and offset." -msgstr "" +msgstr "回傳當前列號 (line number) 和偏移量 (offset)。" #: ../../library/html.parser.rst:116 msgid "" @@ -122,6 +141,9 @@ msgid "" "with HTML \"as deployed\" or for re-generating input with minimal changes " "(whitespace between attributes can be preserved, etc.)." msgstr "" +"回傳最近開啟 (open) 的開始標籤的文本。這對於結構化處理通常不必要,但在處理" +"「已部署」的 HTML 或以最少的更改重新生成輸入(可以保留屬性之間的空白等)時可" +"能很有用。" #: ../../library/html.parser.rst:122 msgid "" @@ -130,12 +152,14 @@ msgid "" "class implementations do nothing (except for :meth:`~HTMLParser." "handle_startendtag`):" msgstr "" +"當遇到資料或標記元素時將呼叫以下方法,並且它們應在子類別中被覆蓋。基底類別實" +"作什麼都不做(除了 :meth:`~HTMLParser.handle_startendtag`):" #: ../../library/html.parser.rst:129 msgid "" "This method is called to handle the start tag of an element (e.g. ``
``)." -msgstr "" +msgstr "呼叫此方法來處理元素的開始標籤(例如 ``
``)。" #: ../../library/html.parser.rst:131 msgid "" @@ -145,6 +169,9 @@ msgid "" "translated to lower case, and quotes in the *value* have been removed, and " "character and entity references have been replaced." msgstr "" +"*tag* 引數是轉換為小寫的標籤名稱。 *attrs* 引數是一個 ``(name, value)`` 對的" +"列表,包含在標籤的 ``<>`` 括號內找到的屬性。 *name* 將被轉成小寫,*value* 中" +"的引號會被刪除,字元和實體參照也會被替換。" #: ../../library/html.parser.rst:137 msgid "" @@ -152,21 +179,23 @@ msgid "" "would be called as ``handle_starttag('a', [('href', 'https://www.cwi." "nl/')])``." msgstr "" +"例如,對於標籤 ````,這個方法會以 " +"``handle_starttag('a', [('href', 'https://www.cwi.nl/')])`` 的形式被呼叫。" #: ../../library/html.parser.rst:140 msgid "" "All entity references from :mod:`html.entities` are replaced in the " "attribute values." -msgstr "" +msgstr "在屬性值中來自 :mod:`html.entities` 的所有實體參照都會被替換。" #: ../../library/html.parser.rst:146 msgid "" "This method is called to handle the end tag of an element (e.g. ``
``)." -msgstr "" +msgstr "呼叫此方法來處理元素的結束標籤(例如 ``
``)。" #: ../../library/html.parser.rst:148 msgid "The *tag* argument is the name of the tag converted to lower case." -msgstr "" +msgstr "*tag* 引數是轉換為小寫的標籤名稱。" #: ../../library/html.parser.rst:153 msgid "" @@ -176,12 +205,18 @@ msgid "" "implementation simply calls :meth:`handle_starttag` and :meth:" "`handle_endtag`." msgstr "" +"與 :meth:`handle_starttag` 類似,但在剖析器遇到 XHTML 樣式的空標籤 " +"(````) 時呼叫。這個方法可能被需要這個特定詞彙資訊 (lexical " +"information) 的子類別覆蓋;預設實作只是呼叫 :meth:`handle_starttag` 和 :meth:" +"`handle_endtag`。" #: ../../library/html.parser.rst:161 msgid "" "This method is called to process arbitrary data (e.g. text nodes and the " "content of ```` and ````)." msgstr "" +"呼叫此方法來處理任意資料(例如文本節點與 ```` 和 " +"```` 的內容)。" #: ../../library/html.parser.rst:167 msgid "" @@ -189,6 +224,9 @@ msgid "" "``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g. " "``'gt'``). This method is never called if *convert_charrefs* is ``True``." msgstr "" +"呼叫此方法來處理形式為 ``&name;`` (例如 ``>``)的附名字元參照,其中 " +"*name* 是一般實體參照(例如 ``'gt'``)。如果 *convert_charrefs* 為 ``True``," +"則永遠不會呼叫此方法。" #: ../../library/html.parser.rst:175 msgid "" @@ -198,18 +236,24 @@ msgid "" "in this case the method will receive ``'62'`` or ``'x3E'``. This method is " "never called if *convert_charrefs* is ``True``." msgstr "" +"呼叫此方法來處理 ``#NNN;`` 和 ``&#xNNN;`` 形式的十進位和十六進位數字字元參" +"照。例如,``>`` 的十進位等效為 ``>``,而十六進位為 ``>``;在這種" +"情況下,該方法將收到 ``'62'`` 或 ``'x3E'``。如果 *convert_charrefs* 為 " +"``True``,則永遠不會呼叫此方法。" #: ../../library/html.parser.rst:184 msgid "" "This method is called when a comment is encountered (e.g. ````)。" #: ../../library/html.parser.rst:186 msgid "" "For example, the comment ```` will cause this method to be " "called with the argument ``' comment '``." msgstr "" +"舉例來說,註解 ```` 會使得此方法被以引數 ``' comment '`` 來呼" +"叫。" #: ../../library/html.parser.rst:189 msgid "" @@ -218,18 +262,25 @@ msgid "" "[endif]-->``, this method will receive ``'[if IE 9]>IE9-specific contentIE9-specific content`` 為例," +"這個方法將會收到 ``'[if IE 9]>IE9-specific content``)." msgstr "" +"呼叫此方法來處理 HTML 文件類型聲明 (doctype declaration)(例如 ````)。" #: ../../library/html.parser.rst:199 msgid "" "The *decl* parameter will be the entire contents of the declaration inside " "the ```` markup (e.g. ``'DOCTYPE html'``)." msgstr "" +"*decl* 參數將是 ```` 標記內聲明部分的全部內容(例如 ``'DOCTYPE " +"html'``)。" #: ../../library/html.parser.rst:205 msgid "" @@ -239,6 +290,10 @@ msgid "" "called as ``handle_pi(\"proc color='red'\")``. It is intended to be " "overridden by a derived class; the base class implementation does nothing." msgstr "" +"遇到處理指示 (processing instruction) 時會呼叫的方法。 *data* 參數將包含整個" +"處理指示。例如,對於處理指示 ````,這個方法將以 " +"``handle_pi(\"proc color='red'\")`` 形式被呼叫。它旨在被衍生類別覆蓋;基底類" +"別實作中什麼都不做。" #: ../../library/html.parser.rst:213 msgid "" @@ -246,11 +301,13 @@ msgid "" "instructions. An XHTML processing instruction using the trailing ``'?'`` " "will cause the ``'?'`` to be included in *data*." msgstr "" +":class:`HTMLParser` 類別使用 SGML 語法規則來處理指示。使用有 ``?`` 跟隨在後面" +"的 XHTML 處理指示將導致 ``?`` 被包含在 *data* 中。" #: ../../library/html.parser.rst:220 msgid "" "This method is called when an unrecognized declaration is read by the parser." -msgstr "" +msgstr "當剖析器讀取無法識別的聲明時會呼叫此方法。" #: ../../library/html.parser.rst:222 msgid "" @@ -258,6 +315,8 @@ msgid "" "the ```` markup. It is sometimes useful to be overridden by a " "derived class. The base class implementation does nothing." msgstr "" +"*data* 參數將是 ```` 標記內聲明的全部內容。有時被衍生類別被覆蓋會是好" +"用的。在基底類別實作中什麼都不做。" #: ../../library/html.parser.rst:230 msgid "Examples" @@ -268,30 +327,49 @@ msgid "" "The following class implements a parser that will be used to illustrate more " "examples::" msgstr "" +"以下類別實作了一個剖析器,將用於解說更多範例:\n" +"\n" +"::" #: ../../library/html.parser.rst:269 msgid "Parsing a doctype::" msgstr "" +"剖析文件類型:\n" +"\n" +"::" #: ../../library/html.parser.rst:275 msgid "Parsing an element with a few attributes and a title::" msgstr "" +"剖析一個具有一些屬性和標題的元素:\n" +"\n" +"::" #: ../../library/html.parser.rst:287 msgid "" "The content of ``script`` and ``style`` elements is returned as is, without " "further parsing::" msgstr "" +"``script`` 和 ``style`` 元素的內容按原樣回傳,無需進一步剖析:\n" +"\n" +"::" #: ../../library/html.parser.rst:303 msgid "Parsing comments::" msgstr "" +"剖析註解:\n" +"\n" +"::" #: ../../library/html.parser.rst:310 msgid "" "Parsing named and numeric character references and converting them to the " "correct char (note: these 3 references are all equivalent to ``'>'``)::" msgstr "" +"剖析附名 (named) 且為數值的 (numeric) 字元參照,並將它們轉換為正確的字元(注" +"意:這 3 個參照都等同於 ``'>'``):\n" +"\n" +"::" #: ../../library/html.parser.rst:318 msgid "" @@ -299,7 +377,15 @@ msgid "" "`~HTMLParser.handle_data` might be called more than once (unless " "*convert_charrefs* is set to ``True``)::" msgstr "" +"將不完整的區塊提供給 :meth:`~HTMLParser.feed` 是可行的,但是 :meth:" +"`~HTMLParser.handle_data` 可能會被多次呼叫(除非 *convert_charrefs* 設定為 " +"``True``):\n" +"\n" +"::" #: ../../library/html.parser.rst:331 msgid "Parsing invalid HTML (e.g. unquoted attributes) also works::" msgstr "" +"也能夠剖析無效的 HTML(例如未加引號的屬性):\n" +"\n" +"::"