Skip to content

Commit

Permalink
Translate library/re.po intro part (#635)
Browse files Browse the repository at this point in the history
* Translate library/re.po intro part

* Update re.po according to suggestion

* Update string literal translation in library/re.po

---------

Co-authored-by: Leo Wang <[email protected]>
  • Loading branch information
ascodeasice and Leo Wang authored Sep 5, 2023
1 parent af9f3ef commit d2f1a53
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions library/re.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is distributed under the same license as the Python package.
#
# Translators:
# Leo Wang <[email protected]>, 2023
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
Expand Down Expand Up @@ -32,6 +33,7 @@ msgid ""
"This module provides regular expression matching operations similar to those "
"found in Perl."
msgstr ""
"此模組提供類似於 Perl 中正規表示式的配對操作。"

#: ../../library/re.rst:17
msgid ""
Expand All @@ -42,6 +44,10 @@ msgid ""
"substitution, the replacement string must be of the same type as both the "
"pattern and the search string."
msgstr ""
"被搜尋的模式 (pattern) 與字串可以是 Unicode 字串 (:class:`str`),也可以是 8-bit "
"字串 (:class:`bytes`)。然而,Unicode 字串和 8-bit 字串不能混用:也就是,你不能用 "
"byte 模式配對 Unicode 字串,反之亦然;同樣地,替換時,用來替換的字串必須與模式和搜尋"
"字串是相同的型別 (type)。"

#: ../../library/re.rst:24
msgid ""
Expand All @@ -57,6 +63,13 @@ msgid ""
"future this will become a :exc:`SyntaxError`. This behaviour will happen "
"even if it is a valid escape sequence for a regular expression."
msgstr ""
"正規表示式使用反斜線字元 (``'\\'``) 表示特別的形式,或是使用特殊字元而不調用"
"它們的特殊意義。這與 Python 在字串文本 (literal) 中,為了一樣的目的使用同一個字元的"
"目的相衝突;舉例來說,為了配對一個反斜線文字,一個人可能需要寫 ``'\\\\\\\\'`` 當作"
"模式字串,因為正規表示式必須是 ``\\\\``,而且每個反斜線在一個普通的 Python 字串文本中"
"必須表示為 ``\\\\``。另外,請注意在 Python 的字串文本中使用反斜線的任何無效跳脫序列"
"目前會產生一個 :exc:`SyntaxWarning`,而在未來這會變成一個 :exc:`SyntaxError`。"
"儘管它對正規表示式是一個有效的跳脫序列,這種行為也會發生。"

#: ../../library/re.rst:36
msgid ""
Expand All @@ -67,6 +80,10 @@ msgid ""
"a newline. Usually patterns will be expressed in Python code using this raw "
"string notation."
msgstr ""
"解決方法是對正規表示式模式使用 Python 的原始字串符號;反斜線在一個以 ``'r'`` 為前綴"
"的字串文本中不會被用任何特別的方式處理。所以 ``r\"\\n\"`` 是一個兩個字元的字串,包含"
" ``'\\'`` 和 ``'n'``,同時 ``\"\\n\"`` 是一個單個字元的字串,包含一個換行符號。通常"
"模式在 Python 程式中會使用這個原始字串符號表示。"

#: ../../library/re.rst:43
msgid ""
Expand All @@ -75,13 +92,18 @@ msgid ""
"expressions <re-objects>`. The functions are shortcuts that don't require "
"you to compile a regex object first, but miss some fine-tuning parameters."
msgstr ""
"請務必注意到大部分的正規表示式操作是可以在模組層級的函式和 :ref:`"
"compiled regular expressions <re-objects>` 中的方法使用的。這些函式是個捷徑"
"且讓你不需要先編譯一個正規表示式物件,但是會缺少一些微調參數。"

#: ../../library/re.rst:51
msgid ""
"The third-party `regex <https://pypi.org/project/regex/>`_ module, which has "
"an API compatible with the standard library :mod:`re` module, but offers "
"additional functionality and a more thorough Unicode support."
msgstr ""
"第三方的 `regex <https://pypi.org/project/regex/>`_ 模組,有著和標準函式庫"
" :mod:`re` 模組相容的 API,但是提供額外的功能以及更完整的 Unicode 支援。"

#: ../../library/re.rst:59
msgid "Regular Expression Syntax"
Expand Down

0 comments on commit d2f1a53

Please sign in to comment.