Skip to content

Translate c-api/hash.po - #1259

Open
lilwad-0730 wants to merge 3 commits into
python:3.15from
lilwad-0730:c-api/hash
Open

lilwad-0730 wants to merge 3 commits into
python:3.15from
lilwad-0730:c-api/hash

Conversation

@lilwad-0730

Copy link
Copy Markdown

完成 c-api/hash.po 中原先未翻譯的 6 筆條目,涵蓋雜湊演算法識別值、短緩衝區最佳化,以及緩衝區雜湊函式的說明。保留 reST 引用標記並修正最後一筆譯文的成員引用格式。

Closes #1257

驗證:

  • sphinx-lint c-api/hash.po 通過。
  • PO 解析通過,40 筆內容均已翻譯,無 fuzzy 標記。
  • 與官方 3.15 比對,英文原文字串未變,所有行皆不超過 79 字元。
  • git diff --check 通過。
  • 尚未執行完整 Sphinx 文件建置。

@ken71301 ken71301 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the translation! I rendered c-api/hash.po against 3.15 and checked the 6 new entries (Py_HASH_ALGORITHM, Py_HASH_FNV/SIPHASH*, Py_HASH_CUTOFF x2, Py_HashBuffer x2). They all render correctly, with the reST roles and links intact, and the terminology (雜湊, 緩衝區, 緩衝協定, 門檻值, 不可變物件) is consistent with the glossary. The meaning matches the English source.

Two suggestions:

  1. Stray space after 。 — several paragraphs render with a space after a full-width period, e.g. …雜湊演算法。 雜湊演算法可透過…, …設為 7,…。 若在… and …一致。 此雜湊值…. This is probably a space left at a wrapped line join in the PO. Removing it (or running make wrap) should fix it.
  2. Optional wording — the second Py_HashBuffer paragraph, 「對透過 tp_richcompare 函式與另一個物件的緩衝區進行比較的不可變物件實作其雜湊功能」, is a long chain of modifiers. Something like 「用於為不可變物件實作雜湊,其 tp_richcompare 函式會與另一個物件的緩衝區進行比較」 may read more easily.

Nothing blocking. I only checked how the changed entries render, not the rest of the file.

Remove literal newlines inside msgstr that rendered as a stray space
after full-width periods, keep the :ref: role separated with "\ " now
that the newline before it is gone, and reword the Py_HashBuffer
paragraph to avoid a long chain of modifiers. Also fix the typo
"演算式名稱" to "演算法名稱".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread c-api/hash.po
Comment on lines +43 to +44
"用一個數值,表示用於對 :class:`str`、:class:`bytes` 和 :class:`memoryview` 進"
"行雜湊的演算法。"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"用一個數值,表示用於對 :class:`str`、:class:`bytes` 和 :class:`memoryview` 進"
"行雜湊的演算法。"
"一個用來表示是以何種演算法對 :class:`str`、:class:`bytes` 和 :class:`memoryview` "
"進行雜湊的數值。"

Comment thread c-api/hash.po
"via the configure :option:`--with-hash-algorithm` option."
msgstr ""
"用來與 :c:macro:`Py_HASH_ALGORITHM` 比較的數值,以判斷使用哪一種雜湊演算法。"
"雜湊演算法可透過 configure 的 :option:`--with-hash-algorithm` 選項設定。"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configure 沒翻譯的原因?

Comment thread c-api/hash.po
"it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms "
"and 5 on 32-bit platforms should provide a decent safety margin."
msgstr ""
"32 位元的平台應使用比 64 位元的平台更小的門檻值,因為在 32 位元平台上更容易建"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cutoff 翻譯成「門檻值」的緣由為何?不會被讀者誤解為 threshold 嗎?

Comment thread c-api/hash.po
msgstr ""
"計算並回傳從位址 *ptr* 開始、長度為 *len* 位元組的緩衝區之雜湊值。此雜湊值會"
"保證與 :class:`bytes`、:class:`memoryview` 及其他實作\\ :ref:`緩衝協定 "
"<bufferobjects>` 的內建物件之雜湊值一致。"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"<bufferobjects>` 的內建物件之雜湊值一致。"
"<bufferobjects>`\\ 的內建物件之雜湊值一致。"

Comment thread c-api/hash.po
"implement the :ref:`buffer protocol <bufferobjects>`."
msgstr ""
"計算並回傳從位址 *ptr* 開始、長度為 *len* 位元組的緩衝區之雜湊值。此雜湊值會"
"保證與 :class:`bytes`、:class:`memoryview` 及其他實作\\ :ref:`緩衝協定 "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"保證與 :class:`bytes`、:class:`memoryview` 及其他實作\\ :ref:`緩衝協定 "
"保證與 :class:`bytes`、:class:`memoryview` 及其他有實作\\ :ref:`緩衝協定 "

Comment thread c-api/hash.po
Comment on lines +205 to +206
"使用此函式為不可變物件實作雜湊,這類物件的 "
":c:member:`~PyTypeObject.tp_richcompare` 函式會與另一個物件的緩衝區進行比較。"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"使用此函式為不可變物件實作雜湊,這類物件的 "
":c:member:`~PyTypeObject.tp_richcompare` 函式會與另一個物件的緩衝區進行比較。"
"對於其 :c:member:`~PyTypeObject.tp_richcompare` 函式會與另一個物件之緩衝區進行比較的"
"不可變物件,用此函式來為這類物件實作雜湊。"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translate c-api/hash.po

3 participants