Skip to content

Commit

Permalink
Update translation for library/enum, library/exceptions and howto/sor…
Browse files Browse the repository at this point in the history
…ting (#1010)
  • Loading branch information
mindihx authored Dec 23, 2024
1 parent cc66b14 commit e7b5675
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 100 deletions.
51 changes: 42 additions & 9 deletions howto/sorting.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-03 11:11+0800\n"
"PO-Revision-Date: 2023-08-12 15:09+0800\n"
"PO-Revision-Date: 2024-12-20 19:16+0800\n"
"Last-Translator: Li-Hung Wang <[email protected]>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand Down Expand Up @@ -128,6 +128,8 @@ msgid ""
">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n"
"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']"
msgstr ""
">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n"
"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']"

#: ../../howto/sorting.rst:61
msgid ""
Expand Down Expand Up @@ -157,6 +159,13 @@ msgid ""
">>> sorted(student_tuples, key=lambda student: student[2]) # sort by age\n"
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
msgstr ""
">>> student_tuples = [\n"
"... ('john', 'A', 15),\n"
"... ('jane', 'B', 12),\n"
"... ('dave', 'B', 10),\n"
"... ]\n"
">>> sorted(student_tuples, key=lambda student: student[2]) # 依照年齡排序\n"
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"

#: ../../howto/sorting.rst:79
msgid ""
Expand All @@ -182,6 +191,22 @@ msgid ""
"age\n"
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
msgstr ""
">>> class Student:\n"
"... def __init__(self, name, grade, age):\n"
"... self.name = name\n"
"... self.grade = grade\n"
"... self.age = age\n"
"... def __repr__(self):\n"
"... return repr((self.name, self.grade, self.age))\n"
"\n"
">>> student_objects = [\n"
"... Student('john', 'A', 15),\n"
"... Student('jane', 'B', 12),\n"
"... Student('dave', 'B', 10),\n"
"... ]\n"
">>> sorted(student_objects, key=lambda student: student.age) # 依照年齡排"
"序\n"
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"

#: ../../howto/sorting.rst:99
msgid ""
Expand Down Expand Up @@ -363,6 +388,10 @@ msgid ""
"primary key, descending\n"
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"
msgstr ""
">>> s = sorted(student_objects, key=attrgetter('age')) # 依照次要鍵排序\n"
">>> sorted(s, key=attrgetter('grade'), reverse=True) # 現在依照主要鍵降"
"冪排序\n"
"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]"

#: ../../howto/sorting.rst:193
msgid ""
Expand Down Expand Up @@ -436,6 +465,11 @@ msgid ""
">>> [student for grade, i, student in decorated] # undecorate\n"
"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]"
msgstr ""
">>> decorated = [(student.grade, i, student) for i, student in "
"enumerate(student_objects)]\n"
">>> decorated.sort()\n"
">>> [student for grade, i, student in decorated] # 移除裝飾\n"
"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]"

#: ../../howto/sorting.rst:231
msgid ""
Expand Down Expand Up @@ -532,7 +566,7 @@ msgstr ""

#: ../../howto/sorting.rst:273
msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order"
msgstr ""
msgstr "sorted(words, key=cmp_to_key(strcoll)) # 理解語系的排序順序"

#: ../../howto/sorting.rst:276
msgid "Odds and Ends"
Expand Down Expand Up @@ -605,10 +639,10 @@ msgid ""
"six comparison methods be implemented. The :func:`~functools.total_ordering` "
"decorator is provided to make that task easier."
msgstr ""
"然而,請注意,當 :meth:`~object.__lt__` 沒有被實做時,``<`` 可以回退 (fall "
"然而,請注意,當 :meth:`~object.__lt__` 沒有被實作時,``<`` 可以回退 (fall "
"back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請看 :func:`object."
"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝飾"
" :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。"
"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。"
"飾器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。"

#: ../../howto/sorting.rst:314
msgid ""
Expand Down Expand Up @@ -672,7 +706,6 @@ msgid ""
"position ``0``. These functions are suitable for implementing priority "
"queues which are commonly used for task scheduling."
msgstr ""
":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資料"
"排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優先"
"佇列。"

":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資"
"料排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優"
"先佇列。"
Loading

0 comments on commit e7b5675

Please sign in to comment.