-
-
Notifications
You must be signed in to change notification settings - Fork 219
translate library/re.po Regular Expression Syntax #1147
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
base: 3.14
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review the first half
"further information and a gentler presentation, consult the :ref:`regex-" | ||
"howto`." | ||
msgstr "" | ||
"一個簡短的正規表示式格式解釋如下。如需更多資訊和一個更詳細的示範,請參" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gentler presentation
應該是想表達 regex howto 文章會有更加易讀易懂的解釋方式,翻成「更詳細的示範」感覺不太貼切
"rest of this section, we'll write RE's in ``this special style``, usually " | ||
"without quotes, and strings to be matched ``'in single quotes'``.)" | ||
msgstr "" | ||
"正規表示式可以包含特殊和一般字元。大多數一般字元,如 ``'A'``、``'a'``,或 " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"正規表示式可以包含特殊和一般字元。大多數一般字元,如 ``'A'``、``'a'``,或 " | |
"正規表示式可以包含特殊和一般字元。大多數一般字元,如 ``'A'``、``'a'`` 或 " |
"``last`` 匹配字串 ``'last'``。(在本節的其餘部分,我們會用 ``這種特殊模式`` " | ||
"表示正規表示式,通常沒有引號,而字串會 ``'在單引號中'`` 被匹配。)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"``last`` 匹配字串 ``'last'``。(在本節的其餘部分,我們會用 ``這種特殊模式`` " | |
"表示正規表示式,通常沒有引號,而字串會 ``'在單引號中'`` 被匹配。)" | |
"``last`` 匹配字串 ``'last'``。(在本節的其餘部分,我們會用通常沒有引號的 " | |
"``這種特殊樣式`` 來書寫正規表示式,而被匹配的字串會 ``'在單引號中'``。)" |
"either stand for classes of ordinary characters, or affect how the regular " | ||
"expressions around them are interpreted." | ||
msgstr "" | ||
"某些字元,像 ``'|'`` 或 ``'('``,是特殊的。特殊字元會代表一般字元的類別,或是" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"某些字元,像 ``'|'`` 或 ``'('``,是特殊的。特殊字元會代表一般字元的類別,或是" | |
"某些字元是特殊的,像 ``'|'`` 或 ``'('``。特殊字元會代表一般字元的類別,或是" |
"``'a'`` characters." | ||
msgstr "" | ||
"重複運算子或量詞 (quantifiers)(``*``, ``+``, ``?``, ``{m,n}`` 等)不能直接嵌" | ||
"套使用。這樣避免了和非貪婪修飾符號 ``?`` 和其他實作中的修飾符號的模糊性。要在" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"套使用。這樣避免了和非貪婪修飾符號 ``?`` 和其他實作中的修飾符號的模糊性。要在" | |
"套使用。這樣避免了和非貪婪修飾符號後綴 ``?`` 和其他實作中的修飾符號的模糊性。要在" |
"be used first in the expression string." | ||
msgstr "" | ||
"(這些旗標在 :ref:`contents-of-module-re` 中說明。)如果你想將旗標當作正規表" | ||
"示式的一部分,而不是傳遞一個*旗標*引數給 :func:`re.compile` 函式的話,這會有" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"示式的一部分,而不是傳遞一個*旗標*引數給 :func:`re.compile` 函式的話,這會有" | |
"示式的一部分,而不是傳遞一個 *flag* 引數給 :func:`re.compile` 函式的話,這會有" |
"pattern." | ||
msgstr "" | ||
"一個非捕捉版本的普通括號。匹配括號內的任意正規表示式,但是被群組匹配到的子字" | ||
"串\\ *不能*\\ 在執行匹配後被取得,或是在之後的模式被引用。" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"串\\ *不能*\\ 在執行匹配後被取得,或是在之後的模式被引用。" | |
"串\\ *不能*\\ 在執行匹配後被取得,或是在之後的模式被參照。" |
"合使用或是接在 ``'-'`` 後面。相反地,當它們其中一個出現在嵌入群組時,它會覆蓋" | ||
"括號中群組的匹配模式。在 Unicode 模式中,``(?a:...)`` 會切換到僅匹配 ASCII 模" | ||
"式,且 ``(?u:...)`` 會切換到 Unicode 匹配模式(預設)。在位元組模式,``(?" | ||
"L:...)`` 會切換到依賴區域 (locale) 設定的匹配,且 ``(?a:...)`` 會切換到僅匹" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"L:...)`` 會切換到依賴區域 (locale) 設定的匹配,且 ``(?a:...)`` 會切換到僅匹" | |
"L:...)`` 會切換到依賴區域設定 (locale) 的匹配,且 ``(?a:...)`` 會切換到僅匹" |
"would thus fail to match." | ||
msgstr "" | ||
"嘗試匹配 ``...`` 如同它是一個獨立的正規表示式,並且如果成功的話,會繼續匹配跟" | ||
"隨在後面的正規表示式。如果接續的模式匹配失敗,stack 只能回溯 (unwound) 到 " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- stack 要翻譯嗎
- unwind 的翻譯可以跟前面的 backtrack 做出區別嗎
"嘗試匹配 ``...`` 如同它是一個獨立的正規表示式,並且如果成功的話,會繼續匹配跟" | ||
"隨在後面的正規表示式。如果接續的模式匹配失敗,stack 只能回溯 (unwound) 到 " | ||
"``(?>...)`` *之前*,因為一旦退出了,這個被叫做\\ :dfn:`原子群組` (atomic " | ||
"group) 的正規表示式,已經丟棄了它自己的所有回溯點 (stack point)。因此,``(?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stack 也是翻成回溯?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review part 2
"a regular expression. A symbolic group is also a numbered group, just as if " | ||
"the group were not named." | ||
msgstr "" | ||
"類似於一般的括號,但是這個群組匹配的子字串可以透過群組名稱符號 *name* 存取。" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"類似於一般的括號,但是這個群組匹配的子字串可以透過群組名稱符號 *name* 存取。" | |
"類似於一般的括號,但是這個群組匹配的子字串可以透過符號群組名稱 *name* 存取。" |
"the group were not named." | ||
msgstr "" | ||
"類似於一般的括號,但是這個群組匹配的子字串可以透過群組名稱符號 *name* 存取。" | ||
"群組名稱必須是有效的 Python 識別符 (identifier),並且在 :class:`bytes` 模式" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"群組名稱必須是有效的 Python 識別符 (identifier),並且在 :class:`bytes` 模式" | |
"群組名稱必須是有效的 Python 識別字 (identifier),並且在 :class:`bytes` 模式" |
"命名群組 (named groups) 可以在三種情境下被引用。如果該模式是 ``(?" | ||
"P<quote>['\"]).*?(?P=quote)``\\ (也就是匹配一個用單引號或雙引號包圍的字" | ||
"串):" | ||
|
||
#: ../../library/re.rst:429 | ||
msgid "Context of reference to group \"quote\"" | ||
msgstr "" | ||
msgstr "引用 \"quote\" 群組的情境" | ||
|
||
#: ../../library/re.rst:429 | ||
msgid "Ways to reference it" | ||
msgstr "" | ||
msgstr "引用方式" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
引用 -> 參照
後面就不再指出了,麻煩幫忙修正所有出現的地方
"if it's *not* followed by ``'Asimov'``." | ||
msgstr "" | ||
"如果字串接下來不匹配 ``...``,才會成功匹配。這是一個 :dfn:`negative " | ||
"lookahead assertion`\\ 。例如,``Isaac (?!Asimov)`` 只在後面\\ *不*\\ 跟著 " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
"lookahead assertion`\\ 。例如,``Isaac (?!Asimov)`` 只在後面\\ *不*\\ 跟著 " | |
"lookahead assertion`。例如,``Isaac (?!Asimov)`` 只在後面\\ *不*\\ 跟著 " |
"assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only " | ||
"if it's *not* followed by ``'Asimov'``." | ||
msgstr "" | ||
"如果字串接下來不匹配 ``...``,才會成功匹配。這是一個 :dfn:`negative " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
positive/negative lookahead/lookbehind assertion 可以翻譯嗎?
"Inside a character range, ``\\b`` represents the backspace character, for " | ||
"compatibility with Python's string literals." | ||
msgstr "" | ||
"在字元範圍中,為了與 Python 的字串文本的兼容性,``\\b`` 表示 backspace 字元。" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backspace 可以翻譯嗎
"在字元範圍中,為了與 Python 的字串文本的兼容性,``\\b`` 表示 backspace 字元。" | |
"在字元範圍中,為了與 Python 的字串文本的相容性,``\\b`` 表示 backspace 字元。" |
"請注意 ``\\B`` 不會匹配一個空字串,不同於其他程式語言的正規表示式實作,像是 " | ||
"Perl。這個行為是為了相容性原因而保留的。" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
後面超譯?
"characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " | ||
"(``_``)." | ||
msgstr "" | ||
"匹配 Unicode 單字字元;這包含全部 Unicode 的字母數字 (alphanumeric) 字元" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alphanumeric 改為在首次出現之處標示原文
"string literals are also accepted by the regular expression parser::" | ||
msgstr "" | ||
"大多數 Python 的字串文本支援的\\ :ref:`跳脫序列 <escape-sequences>`\\ 也能被" | ||
"正規表示式解析器接受: ::" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"正規表示式解析器接受: ::" | |
"正規表示式剖析器接受: ::" |
"用位元 OR(bitwise OR、``|`` 運算子)組合。" | ||
|
||
#: ../../library/re.rst:903 | ||
msgid "The sequence ::" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前翻譯錯誤,改成序列
這個我修掉了,可以再 rebase 到最新的 3.14 上 |
#631
pre-commit 的 powrap 有動到一些我沒有翻譯的文字,如果需要將它們改回原本的樣子,我也可以修改