Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71973e0

Browse files
[po] auto sync
1 parent dcf2475 commit 71973e0

1 file changed

Lines changed: 85 additions & 13 deletions

File tree

howto/curses.po

Lines changed: 85 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
# Translators:
77
# Fei Yin <[email protected]>, 2018
88
# Junkai Shao <[email protected]>, 2018
9-
# Freesand Leo <[email protected]>, 2018
109
# ppcfish <[email protected]>, 2019
10+
# Siyuan Xu <[email protected]>, 2020
11+
# Freesand Leo <[email protected]>, 2020
1112
#
1213
#, fuzzy
1314
msgid ""
@@ -16,7 +17,7 @@ msgstr ""
1617
"Report-Msgid-Bugs-To: \n"
1718
"POT-Creation-Date: 2020-02-09 12:40+0000\n"
1819
"PO-Revision-Date: 2017-02-16 17:44+0000\n"
19-
"Last-Translator: ppcfish <ppcfish@gmail.com>, 2019\n"
20+
"Last-Translator: Freesand Leo <yuqinju@163.com>, 2020\n"
2021
"Language-Team: Chinese (China) (https://www.transifex.com/python-doc/teams/5390/zh_CN/)\n"
2122
"MIME-Version: 1.0\n"
2223
"Content-Type: text/plain; charset=UTF-8\n"
@@ -146,6 +147,10 @@ msgid ""
146147
":c:func:`mvwaddstr` into a single :meth:`~curses.window.addstr` method. "
147148
"You'll see this covered in more detail later."
148149
msgstr ""
150+
"此 Python 模块相当简单地封装了 curses 提供的 C 函数;如果你已经熟悉在 C 语言中使用 curses 编程,把这些知识转移的 "
151+
"Python 是非常容易的。最大的差异在于 Python 中的接口通过把不同的 C 函数合并来让事情变得更简单,比如 "
152+
":c:func:`addstr`、:c:func:`mvaddstr` 和 :c:func:`mvwaddstr` 三个 C 函数被并入 "
153+
":meth:`~curses.window.addstr` 这一个方法。下文中会描述更多的细节。"
149154

150155
#: ../../howto/curses.rst:76
151156
msgid ""
@@ -154,6 +159,9 @@ msgid ""
154159
"that, see the Python library guide's section on ncurses, and the C manual "
155160
"pages for ncurses. It will, however, give you the basic ideas."
156161
msgstr ""
162+
"本 HOWTO 是关于使用 curses 和 Python 编写文本模式程序的概述。它并不被设计为一个 curses API "
163+
"的完整指南;如需完整指南,请参见 ncurses 的 Python 库指南章节和 ncurses 的 C 手册页。相对地,本 HOWTO "
164+
"将会给你一些基本思路。"
157165

158166
#: ../../howto/curses.rst:83
159167
msgid "Starting and ending a curses application"
@@ -168,6 +176,9 @@ msgid ""
168176
"object representing the entire screen; this is usually called ``stdscr`` "
169177
"after the name of the corresponding C variable. ::"
170178
msgstr ""
179+
"在做任何事情之前,curses 必须先被初始化。可以通过调用函数 :func:`~curses.initscr` "
180+
"来实现,它将查明终端的类型,向终端发送任何必须的设置代码,并创建多种内部数据结构。如果此操作成功,:func:`initscr` "
181+
"将会返回一个代表整个屏幕的窗口对象;它通常会遵循对应的 C 变量名被称作 ``stdscr``:"
171182

172183
#: ../../howto/curses.rst:96
173184
msgid ""
@@ -176,13 +187,15 @@ msgid ""
176187
" circumstances. This requires calling the :func:`~curses.noecho` function. "
177188
"::"
178189
msgstr ""
190+
"使用 curses 的应用程序通常会关闭按键自动上屏,目的是读取按键并只在特定情况下展示它们。这需要调用函数 "
191+
":func:`~curses.noecho`:"
179192

180193
#: ../../howto/curses.rst:103
181194
msgid ""
182195
"Applications will also commonly need to react to keys instantly, without "
183196
"requiring the Enter key to be pressed; this is called cbreak mode, as "
184197
"opposed to the usual buffered input mode. ::"
185-
msgstr ""
198+
msgstr "应用程序也会广泛地需要立即响应按键,而不需要按下回车键;这被称为 “cbreak” 模式,与通常的缓冲输入模式相对:"
186199

187200
#: ../../howto/curses.rst:109
188201
msgid ""
@@ -193,19 +206,22 @@ msgid ""
193206
":const:`curses.KEY_LEFT`. To get curses to do the job, you'll have to "
194207
"enable keypad mode. ::"
195208
msgstr ""
209+
"终端通常会以多字节转义序列的形式返回特殊按键,比如光标键和导航键比如 Page Up 键和 Home "
210+
"键。尽管你可以编写你的程序来应对这些序列,curses 能够代替你做到这件事,返回一个特殊值比如 "
211+
":const:`curses.KEY_LEFT`。为了让 curses 做这项工作,你需要启用 keypad 模式:"
196212

197213
#: ../../howto/curses.rst:118
198214
msgid ""
199215
"Terminating a curses application is much easier than starting one. You'll "
200216
"need to call::"
201-
msgstr ""
217+
msgstr "终止一个 curses 应用程序比建立一个容易得多,你只需要调用:"
202218

203219
#: ../../howto/curses.rst:125
204220
msgid ""
205221
"to reverse the curses-friendly terminal settings. Then call the "
206222
":func:`~curses.endwin` function to restore the terminal to its original "
207223
"operating mode. ::"
208-
msgstr ""
224+
msgstr "来还原对终端作出的 curses 友好设置。然后,调用函数 :func:`~curses.endwin` 来将终端还原到它的原始操作模式:"
209225

210226
#: ../../howto/curses.rst:131
211227
msgid ""
@@ -215,12 +231,15 @@ msgid ""
215231
" raises an uncaught exception. Keys are no longer echoed to the screen when"
216232
" you type them, for example, which makes using the shell difficult."
217233
msgstr ""
234+
"调试一个 curses 应用程序时常会发生,一个应用程序还未能还原终端到原本的状态就意外退出了,这会搅乱你的终端。在 Python "
235+
"中这常常会发生在你的代码中有 bug 并引发了一个未捕获的异常。当你尝试输入时按键不会上屏,这使得使用终端变得困难。"
218236

219237
#: ../../howto/curses.rst:137
220238
msgid ""
221239
"In Python you can avoid these complications and make debugging much easier "
222240
"by importing the :func:`curses.wrapper` function and using it like this::"
223241
msgstr ""
242+
"在 Python 中你可以避免这些复杂问题并让调试变得更简单,只需要导入 :func:`curses.wrapper` 函数并像这样使用它:"
224243

225244
#: ../../howto/curses.rst:156
226245
msgid ""
@@ -234,17 +253,21 @@ msgid ""
234253
"be left in a funny state on exception and you'll be able to read the "
235254
"exception's message and traceback."
236255
msgstr ""
256+
"函数 :func:`~curses.wrapper` 接受一个可调用对象并首先进行上述初始化过程,在终端支持着色时还会初始化颜色。接着 "
257+
":func:`wrapper` 运行你提供的可调用对象。当该可调用对象返回时,:func:`wrapper` 会还原终端到初始状态。该可调用对象会在 "
258+
":keyword:`try`...\\ :keyword:`except` "
259+
"这样的结构内被调用,当它捕获到异常时,会先还原终端再重新引发这个异常。所以你的终端不会因为异常而被留在一个搞笑的状态,你也可以正常阅读异常消息和回溯信息。"
237260

238261
#: ../../howto/curses.rst:168
239262
msgid "Windows and Pads"
240-
msgstr "Windows 和 Pad"
263+
msgstr "窗口和面板"
241264

242265
#: ../../howto/curses.rst:170
243266
msgid ""
244267
"Windows are the basic abstraction in curses. A window object represents a "
245268
"rectangular area of the screen, and supports methods to display text, erase "
246269
"it, allow the user to input strings, and so forth."
247-
msgstr ""
270+
msgstr "窗口是 curses 中的基本抽象。一个窗口对象表示了屏幕上的一个矩形区域,并且提供方法来显示文本、擦除文本、允许用户输入字符串等等。"
248271

249272
#: ../../howto/curses.rst:174
250273
msgid ""
@@ -255,6 +278,9 @@ msgid ""
255278
":func:`~curses.newwin` function creates a new window of a given size, "
256279
"returning the new window object. ::"
257280
msgstr ""
281+
"函数 :func:`~curses.initscr` 返回的 ``stdscr`` "
282+
"对象覆盖整个屏幕。许多程序可能只需要这一个窗口,但你可能希望把屏幕分割为多个更小的窗口,来分别重绘或者清楚它们。函数 "
283+
":func:`~curses.newwin` 根据给定的尺寸创建一个新窗口,并返回这个新的窗口对象:"
258284

259285
#: ../../howto/curses.rst:185
260286
msgid ""
@@ -265,6 +291,8 @@ msgid ""
265291
"difference from most other computer applications, but it's been part of "
266292
"curses since it was first written, and it's too late to change things now."
267293
msgstr ""
294+
"注意 curses 使用的坐标系统与寻常的不同。坐标始终是以 *y,x* 的顺序传递,并且左上角是坐标 (0,0)。这打破了正常的坐标处理约定,即 "
295+
"*x* 坐标在前。这是一个与其他计算机应用程序糟糕的差异,但这从 curses 最初被编写出来就已是它的一部分,现在想要修改它已为时已晚。"
268296

269297
#: ../../howto/curses.rst:193
270298
msgid ""
@@ -273,6 +301,8 @@ msgid ""
273301
" *x* sizes. Legal coordinates will then extend from ``(0,0)`` to "
274302
"``(curses.LINES - 1, curses.COLS - 1)``."
275303
msgstr ""
304+
"你的应用程序能够查明屏幕的尺寸,:data:`curses.LINES` 和 :data:`curses.COLS` 分别代表了 *y* 和 *x* "
305+
"方向上的尺寸。合理的坐标应位于 ``(0,0)`` 到 ``(curses.LINES - 1, curses.COLS - 1)`` 范围内。"
276306

277307
#: ../../howto/curses.rst:198
278308
msgid ""
@@ -281,6 +311,8 @@ msgid ""
281311
":meth:`~curses.window.refresh` method of window objects to update the "
282312
"screen."
283313
msgstr ""
314+
"当你调用一个方法来显示或擦除文本时,效果并不会立即显示。相反,你必须调用窗口对象的 :meth:`~curses.window.refresh` "
315+
"方法来更新屏幕。"
284316

285317
#: ../../howto/curses.rst:203
286318
msgid ""
@@ -292,6 +324,9 @@ msgid ""
292324
"window and then clears the window, there's no need to send the original text"
293325
" because they're never visible."
294326
msgstr ""
327+
"这是因为 curses 最初是为 300 波特的龟速终端连接编写的;在这些终端上,压制重绘屏幕的时间就非常重要。相对地,当你调用 "
328+
":meth:`refresh` 时,curses "
329+
"会累积屏幕的修改并以效率最高的方式显示它们。打个比方,如果你的程序在一个窗口内显示一些文本然后清楚了这个窗口,那么这些原始文本不需要被发送,因为它们甚至不曾能被看见。"
295330

296331
#: ../../howto/curses.rst:212
297332
msgid ""
@@ -303,6 +338,9 @@ msgid ""
303338
"``stdscr.refresh()`` or the :meth:`refresh` method of some other relevant "
304339
"window."
305340
msgstr ""
341+
"在实践中,显式地告诉 curses 来重绘一个窗口并不会太复杂化 curses "
342+
"编程。大部分程序会显示一堆内容然后等待按键或者其他某些用户侧动作。你要做的事情就是,保证屏幕在暂停并等待用户输入前被重绘,只需要先调用 "
343+
"``stdscr.refresh()`` 或者其他相关窗口的 :meth:`refresh` 方法。"
306344

307345
#: ../../howto/curses.rst:220
308346
msgid ""
@@ -312,6 +350,7 @@ msgid ""
312350
"giving the coordinates of the on-screen area where a subsection of the pad "
313351
"will be displayed. ::"
314352
msgstr ""
353+
"一个面板是一种特殊的窗口,它可以比实际的显示屏幕更大,并且能只显示它的一部分。创建面板需要指定面板的高度和宽度,但刷新一个面板需要给出屏幕坐标和面板的需要显示的局部。"
315354

316355
#: ../../howto/curses.rst:241
317356
msgid ""
@@ -321,31 +360,35 @@ msgid ""
321360
"Beyond that difference, pads are exactly like ordinary windows and support "
322361
"the same methods."
323362
msgstr ""
363+
"此 :meth:`refresh` 调用会在屏幕坐标 (5,5) 到坐标 (20,75) 的矩形范围内显示面板的一个部分,被显示的部分在面板上的坐标是 "
364+
"(0,0)。除了上述差异,面板与常规的窗口相同,也支持相同的方法。"
324365

325366
#: ../../howto/curses.rst:247
326367
msgid ""
327368
"If you have multiple windows and pads on screen there is a more efficient "
328369
"way to update the screen and prevent annoying screen flicker as each part of"
329370
" the screen gets updated. :meth:`refresh` actually does two things:"
330371
msgstr ""
372+
"如果你在屏幕上有多个窗口和面板,有一个更有效率的方法来更新窗口,避免每个部分单独更新时烦人的屏幕闪烁。:meth:`refresh` 实际上做了两件事:"
331373

332374
#: ../../howto/curses.rst:252
333375
msgid ""
334376
"Calls the :meth:`~curses.window.noutrefresh` method of each window to update"
335377
" an underlying data structure representing the desired state of the screen."
336-
msgstr ""
378+
msgstr "调用每个窗口的 :meth:`~curses.window.noutrefresh` 方法来更新一个表达屏幕期望状态的底层的数据结构。"
337379

338380
#: ../../howto/curses.rst:255
339381
msgid ""
340382
"Calls the function :func:`~curses.doupdate` function to change the physical "
341383
"screen to match the desired state recorded in the data structure."
342-
msgstr ""
384+
msgstr "调用函数 :func:`~curses.doupdate` 来改变物理屏幕来符合这个数据结构中记录的期望状态。"
343385

344386
#: ../../howto/curses.rst:258
345387
msgid ""
346388
"Instead you can call :meth:`noutrefresh` on a number of windows to update "
347389
"the data structure, and then call :func:`doupdate` to update the screen."
348390
msgstr ""
391+
"你可以改为调用在多个窗口上 :meth:`noutrefresh` 方法来更新该数据结构,然后调用函数 :func:`doupdate` 来更新屏幕。"
349392

350393
#: ../../howto/curses.rst:264
351394
msgid "Displaying Text"
@@ -361,6 +404,10 @@ msgid ""
361404
"allows specifying a window to use instead of using ``stdscr`` by default. "
362405
":c:func:`mvwaddstr` allows specifying both a window and a coordinate."
363406
msgstr ""
407+
"从一名 C 语言程序员的视角来看,curses 有时看起来就像是一堆略有差异的函数组成的扭曲迷宫。举个例子,:c:func:`addstr` 在 "
408+
"``stdscr`` 窗口的当前光标位置显示一个字符串,而 :c:func:`mvaddstr` 则是先移动到一个给定的 y,x "
409+
"坐标再显示字符串。:c:func:`waddstr` 与 :c:func:`addstr` 类似,但允许指定一个窗口而非默认的 "
410+
"``stdscr``。:c:func:`mvwaddstr` 允许同时指定一个窗口和一个坐标。"
364411

365412
#: ../../howto/curses.rst:275
366413
msgid ""
@@ -369,6 +416,8 @@ msgid ""
369416
":meth:`~curses.window.addstr` accept multiple argument forms. Usually there"
370417
" are four different forms."
371418
msgstr ""
419+
"幸运的是,Python 接口隐藏了所有这些细节。``stdscr`` 和其他任何窗口一样是一个窗口对象,并且诸如 "
420+
":meth:`~curses.window.addstr` 之类的方法接受多种参数形式。通常有四种形式。"
372421

373422
#: ../../howto/curses.rst:281
374423
msgid "Form"
@@ -419,7 +468,7 @@ msgid ""
419468
"Attributes allow displaying text in highlighted forms such as boldface, "
420469
"underline, reverse code, or in color. They'll be explained in more detail "
421470
"in the next subsection."
422-
msgstr ""
471+
msgstr "属性允许以突出显示形态显示文本,比如加粗、下划线、反相或添加颜色。这些属性将来下一小节细说。"
423472

424473
#: ../../howto/curses.rst:302
425474
msgid ""
@@ -429,12 +478,16 @@ msgid ""
429478
"window's :attr:`encoding` attribute; this defaults to the default system "
430479
"encoding as returned by :func:`locale.getpreferredencoding`."
431480
msgstr ""
481+
"方法 :meth:`~curses.window.addstr` 接受一个 Python "
482+
"字符串或字节串作为用于显示的值。字节串的内容会被原样发送到终端。字符串会使用窗口的 :attr:`encoding` 属性值编码为字节,它默认为 "
483+
":func:`locale.getpreferredencoding` 返回的系统默认编码。"
432484

433485
#: ../../howto/curses.rst:309
434486
msgid ""
435487
"The :meth:`~curses.window.addch` methods take a character, which can be "
436488
"either a string of length 1, a bytestring of length 1, or an integer."
437489
msgstr ""
490+
"方法 :meth:`~curses.window.addch` 接受一个字符,可以是长度为 1 的字符串,长度为 1 的字节串或者一个整数。"
438491

439492
#: ../../howto/curses.rst:312
440493
msgid ""
@@ -443,6 +496,8 @@ msgid ""
443496
"symbol, and :const:`ACS_ULCORNER` is the upper left corner of a box (handy "
444497
"for drawing borders). You can also use the appropriate Unicode character."
445498
msgstr ""
499+
"对于特殊扩展字符有一些常量,这些常量是大于 255 的整数。比如,:const:`ACS_PLMINUS` 是一个 “加减” "
500+
"符号,:const:`ACS_ULCORNER` 是一个框的左上角(方便绘制边界)。你也可以使用正确的 Unicode 字符。"
446501

447502
#: ../../howto/curses.rst:318
448503
msgid ""
@@ -454,6 +509,8 @@ msgid ""
454509
"some location where it won't be distracting; it can be confusing to have the"
455510
" cursor blinking at some apparently random location."
456511
msgstr ""
512+
"窗口会记住上次操作之后光标所在位置,所以如果你忽略 *y,x* 坐标,字符串和字符会出现在上次操作结束的位置。你也可以通过 ``move(y,x)`` "
513+
"的方法来移动光标。因为一些终端始终会显示一个闪烁的光标,你可能会想要保证光标处于一些不会让人感到分心的位置。在看似随机的位置出现一个闪烁的光标会令人非常迷惑。"
457514

458515
#: ../../howto/curses.rst:326
459516
msgid ""
@@ -464,6 +521,9 @@ msgid ""
464521
"attempt to suppress the flashing cursor, and you won't need to worry about "
465522
"leaving it in odd locations."
466523
msgstr ""
524+
"如果你的应用程序完全不需要一个闪烁的光标,你可以调用 ``curs_set(False)`` 来使它隐形。为与旧版本 curses "
525+
"的兼容性的关系,有函数 ``leaveok(bool)`` 作为 :func:`~curses.curs_set` 的等价替换。如果 *bool* "
526+
"是真值,curses 库会尝试移除闪烁光标,并且你也不必担心它会留在一些奇怪的位置。"
467527

468528
#: ../../howto/curses.rst:335
469529
msgid "Attributes and Color"
@@ -476,6 +536,8 @@ msgid ""
476536
"to highlight certain words. curses supports this by allowing you to specify"
477537
" an attribute for each cell on the screen."
478538
msgstr ""
539+
"字符可以以不同的方式显示。基于文本的应用程序常常以反相显示状态行,一个文本查看器可能需要突出显示某些单词。为了支持这种用法,curses "
540+
"允许你为屏幕上的每个单元指定一个属性值。"
479541

480542
#: ../../howto/curses.rst:342
481543
msgid ""
@@ -486,6 +548,8 @@ msgid ""
486548
"being used, so it's safest to stick to the most commonly available "
487549
"attributes, listed here."
488550
msgstr ""
551+
"属性值是一个整数,它的每一个二进制位代表一个不同的属性。你可以尝试以多种不属性位组合来显示文本,但 curses "
552+
"不保证所有的组合都是有效的,或者看上去有明显不同。这一点取决于用户终端的能力,所以最稳妥的方式是只采用最常见的有效属性,见下表。"
489553

490554
#: ../../howto/curses.rst:350
491555
msgid "Attribute"
@@ -521,7 +585,7 @@ msgstr ":const:`A_REVERSE`"
521585

522586
#: ../../howto/curses.rst:358
523587
msgid "Reverse-video text"
524-
msgstr "反向视频文本"
588+
msgstr "反相显示文本"
525589

526590
#: ../../howto/curses.rst:360
527591
msgid ":const:`A_STANDOUT`"
@@ -543,14 +607,15 @@ msgstr "带下划线的文字"
543607
msgid ""
544608
"So, to display a reverse-video status line on the top line of the screen, "
545609
"you could code::"
546-
msgstr ""
610+
msgstr "所以,为了在屏幕顶部显示一个反相的状态行,你可以这么编写:"
547611

548612
#: ../../howto/curses.rst:372
549613
msgid ""
550614
"The curses library also supports color on those terminals that provide it. "
551615
"The most common such terminal is probably the Linux console, followed by "
552616
"color xterms."
553617
msgstr ""
618+
"curses 库还支持在提供了颜色功能的终端上显示颜色的功能。最常见的提供颜色的终端很可能是 Linux 控制台,采用了 xterms 配色方案。"
554619

555620
#: ../../howto/curses.rst:376
556621
msgid ""
@@ -563,6 +628,10 @@ msgid ""
563628
" to the British spelling, you'll have to resign yourself to misspelling it "
564629
"for the sake of these functions.)"
565630
msgstr ""
631+
"为了使用颜色,你必须在调用完函数 :func:`~curses.initscr` 后尽快调用函数 "
632+
":func:`~curses.start_color`,来初始化默认颜色集 (:func:`curses.wrapper` 函数自动完成了这一点)。 "
633+
"当它完成后,如果使用中的终端支持显示颜色, :func:`~curses.has_colors` 会返回真值。 (注意:curses 使用美式拼写 "
634+
"“color”,而不是英式/加拿大拼写 “colour”。如果你习惯了英式拼写,你需要避免自己在这些函数上拼写错误。)"
566635

567636
#: ../../howto/curses.rst:386
568637
msgid ""
@@ -573,10 +642,13 @@ msgid ""
573642
"attributes such as :const:`A_REVERSE`, but again, such combinations are not "
574643
"guaranteed to work on all terminals."
575644
msgstr ""
645+
"curses 库维护一个有限数量的颜色对,包括一个前景(文本)色和一个背景色。你可以使用函数 :func:`~curses.color_pair` "
646+
"获得一个颜色对对应的属性值。它可以通过按位或运算与其他属性,比如 :const:`A_REVERSE` "
647+
"组合。但再说明一遍,这种组合并不保证在所有终端上都有效。"
576648

577649
#: ../../howto/curses.rst:393
578650
msgid "An example, which displays a line of text using color pair 1::"
579-
msgstr ""
651+
msgstr "一个样例,用 1 号颜色对显示一行文本:"
580652

581653
#: ../../howto/curses.rst:398
582654
msgid ""

0 commit comments

Comments
 (0)