Skip to content

Commit 06b87f4

Browse files
Copilotmattwang44
andcommitted
Complete translation of all code comments and docstrings
Co-authored-by: mattwang44 <24987826+mattwang44@users.noreply.github.com>
1 parent 969797e commit 06b87f4

File tree

3 files changed

+45
-45
lines changed

3 files changed

+45
-45
lines changed

tutorial/introduction.po

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ msgid ""
221221
" File \"<stdin>\", line 1, in <module>\n"
222222
"NameError: name 'n' is not defined"
223223
msgstr ""
224-
">>> n # try to access an undefined variable\n"
224+
">>> n # 嘗試存取未定義的變數\n"
225225
"Traceback (most recent call last):\n"
226226
" File \"<stdin>\", line 1, in <module>\n"
227227
"NameError: name 'n' is not defined"
@@ -319,11 +319,11 @@ msgid ""
319319
">>> '1975' # digits and numerals enclosed in quotes are also strings\n"
320320
"'1975'"
321321
msgstr ""
322-
">>> 'spam eggs' # single quotes\n"
322+
">>> 'spam eggs' # 單引號\n"
323323
"'spam eggs'\n"
324-
">>> \"Paris rabbit got your back :)! Yay!\" # double quotes\n"
324+
">>> \"Paris rabbit got your back :)! Yay!\" # 雙引號\n"
325325
"'Paris rabbit got your back :)! Yay!'\n"
326-
">>> '1975' # digits and numerals enclosed in quotes are also strings\n"
326+
">>> '1975' # 以引號包含的數字和數值也是字串\n"
327327
"'1975'"
328328

329329
#: ../../tutorial/introduction.rst:158
@@ -349,7 +349,7 @@ msgid ""
349349
msgstr ""
350350
">>> 'doesn\\'t' # use \\' to escape the single quote...\n"
351351
"\"doesn't\"\n"
352-
">>> \"doesn't\" # ...or use double quotes instead\n"
352+
">>> \"doesn't\" # ...或改用雙引號\n"
353353
"\"doesn't\"\n"
354354
">>> '\"Yes,\" they said.'\n"
355355
"'\"Yes,\" they said.'\n"
@@ -378,8 +378,8 @@ msgid ""
378378
"First line.\n"
379379
"Second line."
380380
msgstr ""
381-
">>> s = 'First line.\\nSecond line.' # \\n means newline\n"
382-
">>> s # without print(), special characters are included in the string\n"
381+
">>> s = 'First line.\\nSecond line.' # \\n 表示換行\n"
382+
">>> s # 沒有 print(),特殊字元會包含在字串中\n"
383383
"'First line.\\nSecond line.'\n"
384384
">>> print(s) # with print(), special characters are interpreted, so \\n "
385385
"produces new line\n"
@@ -403,10 +403,10 @@ msgid ""
403403
">>> print(r'C:\\some\\name') # note the r before the quote\n"
404404
"C:\\some\\name"
405405
msgstr ""
406-
">>> print('C:\\some\\name') # here \\n means newline!\n"
406+
">>> print('C:\\some\\name') # 這裡 \\n 表示換行!\n"
407407
"C:\\some\n"
408408
"ame\n"
409-
">>> print(r'C:\\some\\name') # note the r before the quote\n"
409+
">>> print(r'C:\\some\\name') # 注意引號前的 r\n"
410410
"C:\\some\\name"
411411

412412
#: ../../tutorial/introduction.rst:193
@@ -468,7 +468,7 @@ msgid ""
468468
">>> 3 * 'un' + 'ium'\n"
469469
"'unununium'"
470470
msgstr ""
471-
">>> # 3 times 'un', followed by 'ium'\n"
471+
">>> # 3 'un',接著是 'ium'\n"
472472
">>> 3 * 'un' + 'ium'\n"
473473
"'unununium'"
474474

@@ -526,7 +526,7 @@ msgid ""
526526
"SyntaxError: invalid syntax"
527527
msgstr ""
528528
">>> prefix = 'Py'\n"
529-
">>> prefix 'thon' # can't concatenate a variable and a string literal\n"
529+
">>> prefix 'thon' # 無法串接變數和字串字面值\n"
530530
" File \"<stdin>\", line 1\n"
531531
" prefix 'thon'\n"
532532
" ^^^^^^\n"
@@ -568,9 +568,9 @@ msgid ""
568568
"'n'"
569569
msgstr ""
570570
">>> word = 'Python'\n"
571-
">>> word[0] # character in position 0\n"
571+
">>> word[0] # 位置 0 的字元\n"
572572
"'P'\n"
573-
">>> word[5] # character in position 5\n"
573+
">>> word[5] # 位置 5 的字元\n"
574574
"'n'"
575575

576576
#: ../../tutorial/introduction.rst:264
@@ -587,9 +587,9 @@ msgid ""
587587
">>> word[-6]\n"
588588
"'P'"
589589
msgstr ""
590-
">>> word[-1] # last character\n"
590+
">>> word[-1] # 最後一個字元\n"
591591
"'n'\n"
592-
">>> word[-2] # second-last character\n"
592+
">>> word[-2] # 倒數第二個字元\n"
593593
"'o'\n"
594594
">>> word[-6]\n"
595595
"'P'"
@@ -614,9 +614,9 @@ msgid ""
614614
">>> word[2:5] # characters from position 2 (included) to 5 (excluded)\n"
615615
"'tho'"
616616
msgstr ""
617-
">>> word[0:2] # characters from position 0 (included) to 2 (excluded)\n"
617+
">>> word[0:2] # 從位置 0 (包含) 到 2 (不包含) 的字元\n"
618618
"'Py'\n"
619-
">>> word[2:5] # characters from position 2 (included) to 5 (excluded)\n"
619+
">>> word[2:5] # 從位置 2 (包含) 到 5 (不包含) 的字元\n"
620620
"'tho'"
621621

622622
#: ../../tutorial/introduction.rst:283
@@ -636,11 +636,11 @@ msgid ""
636636
">>> word[-2:] # characters from the second-last (included) to the end\n"
637637
"'on'"
638638
msgstr ""
639-
">>> word[:2] # character from the beginning to position 2 (excluded)\n"
639+
">>> word[:2] # 從開頭到位置 2 (不包含) 的字元\n"
640640
"'Py'\n"
641-
">>> word[4:] # characters from position 4 (included) to the end\n"
641+
">>> word[4:] # 從位置 4 (包含) 到結尾的字元\n"
642642
"'on'\n"
643-
">>> word[-2:] # characters from the second-last (included) to the end\n"
643+
">>> word[-2:] # 從倒數第二個 (包含) 到結尾的字元\n"
644644
"'on'"
645645

646646
#: ../../tutorial/introduction.rst:293
@@ -889,11 +889,11 @@ msgid ""
889889
">>> squares[-3:] # slicing returns a new list\n"
890890
"[9, 16, 25]"
891891
msgstr ""
892-
">>> squares[0] # indexing returns the item\n"
892+
">>> squares[0] # 索引回傳項目\n"
893893
"1\n"
894894
">>> squares[-1]\n"
895895
"25\n"
896-
">>> squares[-3:] # slicing returns a new list\n"
896+
">>> squares[-3:] # 切片回傳新列表\n"
897897
"[9, 16, 25]"
898898

899899
#: ../../tutorial/introduction.rst:407
@@ -925,10 +925,10 @@ msgid ""
925925
">>> cubes\n"
926926
"[1, 8, 27, 64, 125]"
927927
msgstr ""
928-
">>> cubes = [1, 8, 27, 65, 125] # something's wrong here\n"
929-
">>> 4 ** 3 # the cube of 4 is 64, not 65!\n"
928+
">>> cubes = [1, 8, 27, 65, 125] # 這裡有問題\n"
929+
">>> 4 ** 3 # 4 的立方是 64,不是 65!\n"
930930
"64\n"
931-
">>> cubes[3] = 64 # replace the wrong value\n"
931+
">>> cubes[3] = 64 # 替換錯誤的值\n"
932932
">>> cubes\n"
933933
"[1, 8, 27, 64, 125]"
934934

@@ -947,8 +947,8 @@ msgid ""
947947
">>> cubes\n"
948948
"[1, 8, 27, 64, 125, 216, 343]"
949949
msgstr ""
950-
">>> cubes.append(216) # add the cube of 6\n"
951-
">>> cubes.append(7 ** 3) # and the cube of 7\n"
950+
">>> cubes.append(216) # 加入 6 的立方\n"
951+
">>> cubes.append(7 ** 3) # 以及 7 的立方\n"
952952
">>> cubes\n"
953953
"[1, 8, 27, 64, 125, 216, 343]"
954954

tutorial/modules.po

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,13 +1070,13 @@ msgid ""
10701070
" return msg[::-1] # in the case of a 'from sound.effects import *'"
10711071
msgstr ""
10721072
"__all__ = [\n"
1073-
" \"echo\", # refers to the 'echo.py' file\n"
1074-
" \"surround\", # refers to the 'surround.py' file\n"
1075-
" \"reverse\", # !!! refers to the 'reverse' function now !!!\n"
1073+
" \"echo\", # 指向 'echo.py' 檔案\n"
1074+
" \"surround\", # 指向 'surround.py' 檔案\n"
1075+
" \"reverse\", # !!! 現在指向 'reverse' 函式 !!!\n"
10761076
"]\n"
10771077
"\n"
1078-
"def reverse(msg: str): # <-- this name shadows the 'reverse.py' submodule\n"
1079-
" return msg[::-1] # in the case of a 'from sound.effects import *'"
1078+
"def reverse(msg: str): # <-- 這個名稱遮蔽了 'reverse.py' 子模組\n"
1079+
" return msg[::-1] # 'from sound.effects import *' 的情況下"
10801080

10811081
#: ../../tutorial/modules.rst:534
10821082
msgid ""

tutorial/stdlib2.po

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ msgstr ""
148148
">>> import locale\n"
149149
">>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')\n"
150150
"'English_United States.1252'\n"
151-
">>> conv = locale.localeconv() # get a mapping of conventions\n"
151+
">>> conv = locale.localeconv() # 取得慣例的對映\n"
152152
">>> x = 1234567.8\n"
153153
">>> locale.format_string(\"%d\", x, grouping=True)\n"
154154
"'1,234,567'\n"
@@ -337,7 +337,7 @@ msgstr ""
337337
" data = f.read()\n"
338338
"\n"
339339
"start = 0\n"
340-
"for i in range(3): # show the first 3 file headers\n"
340+
"for i in range(3): # 顯示前 3 個檔案標頭\n"
341341
" start += 14\n"
342342
" fields = struct.unpack('<IIIHH', data[start:start+16])\n"
343343
" crc32, comp_size, uncomp_size, filenamesize, extra_size = fields\n"
@@ -348,7 +348,7 @@ msgstr ""
348348
" extra = data[start:start+extra_size]\n"
349349
" print(filename, hex(crc32), comp_size, uncomp_size)\n"
350350
"\n"
351-
" start += extra_size + comp_size # skip to the next header"
351+
" start += extra_size + comp_size # 跳到下一個標頭"
352352

353353
#: ../../tutorial/stdlib2.rst:167
354354
msgid "Multi-threading"
@@ -578,18 +578,18 @@ msgstr ""
578578
"... def __repr__(self):\n"
579579
"... return str(self.value)\n"
580580
"...\n"
581-
">>> a = A(10) # create a reference\n"
581+
">>> a = A(10) # 建立一個參考\n"
582582
">>> d = weakref.WeakValueDictionary()\n"
583-
">>> d['primary'] = a # does not create a reference\n"
584-
">>> d['primary'] # fetch the object if it is still alive\n"
583+
">>> d['primary'] = a # 不會建立參考\n"
584+
">>> d['primary'] # 如果物件仍然存在則取得它\n"
585585
"10\n"
586-
">>> del a # remove the one reference\n"
587-
">>> gc.collect() # run garbage collection right away\n"
586+
">>> del a # 移除一個參考\n"
587+
">>> gc.collect() # 立即執行垃圾回收\n"
588588
"0\n"
589-
">>> d['primary'] # entry was automatically removed\n"
589+
">>> d['primary'] # 項目被自動移除\n"
590590
"Traceback (most recent call last):\n"
591591
" File \"<stdin>\", line 1, in <module>\n"
592-
" d['primary'] # entry was automatically removed\n"
592+
" d['primary'] # 項目被自動移除\n"
593593
" File \"C:/python313/lib/weakref.py\", line 46, in __getitem__\n"
594594
" o = self.data[key]()\n"
595595
"KeyError: 'primary'"
@@ -725,9 +725,9 @@ msgid ""
725725
msgstr ""
726726
">>> from heapq import heapify, heappop, heappush\n"
727727
">>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n"
728-
">>> heapify(data) # rearrange the list into heap order\n"
729-
">>> heappush(data, -5) # add a new entry\n"
730-
">>> [heappop(data) for i in range(3)] # fetch the three smallest entries\n"
728+
">>> heapify(data) # 將列表重新排列為堆積順序\n"
729+
">>> heappush(data, -5) # 加入新項目\n"
730+
">>> [heappop(data) for i in range(3)] # 取得三個最小的項目\n"
731731
"[-5, 0, 1]"
732732

733733
#: ../../tutorial/stdlib2.rst:356

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy