Debian Codegraph @

translations/manual/zh_TW/develop.po

raw
1 # SOME DESCRIPTIVE TITLE.
2 # Copyright (C) Kovid Goyal
3 # This file is distributed under the same license as the calibre package.
4 #
5 # Translators:
6 # Dennis Chu, 2023
7 # Wang Hulen, 2022
8 # Simon Lee, 2025
9 msgid ""
10 msgstr ""
11 "Project-Id-Version: calibre\n"
12 "Report-Msgid-Bugs-To: \n"
13 "POT-Creation-Date: 2026-02-17 16:44+0000\n"
14 "PO-Revision-Date: 2014-06-17 08:34+0000\n"
15 "Last-Translator: Simon Lee, 2025\n"
16 "Language-Team: Chinese (Taiwan) (http://app.transifex.com/calibre/calibre/language/zh_TW/)\n"
17 "MIME-Version: 1.0\n"
18 "Content-Type: text/plain; charset=UTF-8\n"
19 "Content-Transfer-Encoding: 8bit\n"
20 "Language: zh_TW\n"
21 "Plural-Forms: nplurals=1; plural=0;\n"
22
23 #: ../../../__w/calibre/calibre/manual/develop.rst:4
24 msgid "Setting up a calibre development environment"
25 msgstr "設定 calibre 開發環境"
26
27 #: ../../../__w/calibre/calibre/manual/develop.rst:6
28 msgid ""
29 "calibre is completely open source, licensed under the `GNU GPL v3 "
30 "<https://www.gnu.org/licenses/gpl.html>`_. This means that you are free to "
31 "download and modify the program to your heart's content. In this section, "
32 "you will learn how to get a calibre development environment set up on the "
33 "operating system of your choice. calibre is written primarily in `Python "
34 "<https://www.python.org>`_ with some C/C++ code for speed and system "
35 "interfacing. Note that calibre requires at least Python 3.8."
36 msgstr "calibre是一个完全意义上的开源程序,它采用`GNU GPL v3<https://www.gnu.org/licenses/gpl.html>_`许可证。这意味着你可以按照自己的想法下载并修改该程序。在本节,你将学会如何在你选择的操作系统下建立calibre开发环境。calibre主要使用`Python <https://www.python.org>`_ 编程,为了兼顾系统接口与速度使用了一些C/C+代码。注意,calibre要求Python 3.8及以上版本。"
37
38 #: ../../../__w/calibre/calibre/manual/develop.rst:14
39 msgid "Contents"
40 msgstr "目錄"
41
42 #: ../../../__w/calibre/calibre/manual/develop.rst:17
43 msgid "Design philosophy"
44 msgstr "設計理念"
45
46 #: ../../../__w/calibre/calibre/manual/develop.rst:19
47 msgid ""
48 "calibre has its roots in the Unix world, which means that its design is "
49 "highly modular. The modules interact with each other via well defined "
50 "interfaces. This makes adding new features and fixing bugs in calibre very "
51 "easy, resulting in a frenetic pace of development. Because of its roots, "
52 "calibre has a comprehensive command line interface for all its functions, "
53 "documented in :doc:`generated/en/cli-index`."
54 msgstr ""
55
56 #: ../../../__w/calibre/calibre/manual/develop.rst:24
57 msgid ""
58 "The modular design of calibre is expressed via ``Plugins``. There is a "
59 ":ref:`tutorial <customize>` on writing calibre plugins. For example, adding "
60 "support for a new device to calibre typically involves writing fewer than "
61 "100 lines of code in the form of a device driver plugin. You can browse the "
62 "`built-in drivers "
63 "<https://github.com/kovidgoyal/calibre/tree/master/src/calibre/devices>`_. "
64 "Similarly, adding support for new conversion formats involves writing "
65 "input/output format plugins. Another example of the modular design is the "
66 ":ref:`recipe system <news>` for fetching news. For more examples of plugins "
67 "designed to add features to calibre, see the `Index of plugins "
68 "<https://www.mobileread.com/forums/showthread.php?p=1362767#post1362767>`_."
69 msgstr ""
70
71 #: ../../../__w/calibre/calibre/manual/develop.rst:34
72 msgid "Code layout"
73 msgstr "代码布局"
74
75 #: ../../../__w/calibre/calibre/manual/develop.rst:36
76 msgid ""
77 "All the calibre Python code is in the ``calibre`` package. This package "
78 "contains the following main sub-packages"
79 msgstr ""
80
81 #: ../../../__w/calibre/calibre/manual/develop.rst:38
82 msgid ""
83 "devices - All the device drivers. Just look through some of the built-in "
84 "drivers to get an idea for how they work."
85 msgstr "设备 -- 所有的设备驱动器。通过浏览部分内置驱动器来获取他们的运作方式。"
86
87 #: ../../../__w/calibre/calibre/manual/develop.rst:40
88 msgid ""
89 "For details, see: ``devices.interface`` which defines the interface "
90 "supported by device drivers and ``devices.usbms`` which defines a generic "
91 "driver that connects to a USBMS device. All USBMS based drivers in calibre "
92 "inherit from it."
93 msgstr "更多细节可以参考,:``devices.interface``。这其中定义了被驱动器支持的接口,。另外``devices.usbms``也值得关注,它定义了一个连接了usbms设备的通用驱动器。 在calibre中,所有的基于usbms的驱动器都继承自它.。"
94
95 #: ../../../__w/calibre/calibre/manual/develop.rst:43
96 msgid ""
97 "e-books - All the e-book conversion/metadata code. A good starting point is"
98 " ``calibre.ebooks.conversion.cli`` which is the module powering the "
99 ":command:`ebook-convert` command. The conversion process is controlled via "
100 "``conversion.plumber``. The format independent code is all in ``ebooks.oeb``"
101 " and the format dependent code is in ``ebooks.format_name``."
102 msgstr "电子书 -- 所有的电子书格式转换/元数据代码。一个好的出发点是``calibre.ebooks.conversion.cli``,这是用于支持电子书转换命令的模块。转换过程通过``conversion.plumber``进行控制。\n格式无关代码全部放在``ebooks.oeb``文件夹中,(文档未更新)格式有关代码放在``ebooks.format_name``中。"
103
104 #: ../../../__w/calibre/calibre/manual/develop.rst:47
105 msgid ""
106 "Metadata reading, writing, and downloading is all in ``ebooks.metadata``"
107 msgstr "元数据读写下载,放在``ebooks.metadata``中"
108
109 #: ../../../__w/calibre/calibre/manual/develop.rst:48
110 msgid ""
111 "Conversion happens in a pipeline, for the structure of the pipeline, see "
112 ":ref:`conversion-introduction`. The pipeline consists of an input plugin, "
113 "various transforms and an output plugin. The code that constructs and drives"
114 " the pipeline is in :file:`plumber.py`. The pipeline works on a "
115 "representation of an e-book that is like an unzipped epub, with manifest, "
116 "spine, toc, guide, html content, etc. The class that manages this "
117 "representation is OEBBook in ``ebooks.oeb.base``. The various "
118 "transformations that are applied to the book during conversions live in "
119 ":file:`oeb/transforms/*.py`. And the input and output plugins live in "
120 ":file:`conversion/plugins/*.py`."
121 msgstr "格式轉換髮生在管道(pipeline)中。有關該結構可以參看:ref:`conversion-introduction`。管道包含一個輸入外掛(plugin),多種轉換方法和一個輸出外掛。構建和驅動管道的程式碼在:file:`plumber.py`中。管道利用一本電子書(未壓縮的equb檔案)的特徵(representation)工作,這裡的特徵是指像一個包含目錄、書脊、toc、指南、html內容等。管理這些特徵的類時OEBBook在``ebooks.oeb.base``。在格式轉換時所用的的轉換方法位於:file:`oeb/transforms/*.py`。輸入與輸出外掛位於:file:`conversion/plugins/*.py`。"
122
123 #: ../../../__w/calibre/calibre/manual/develop.rst:58
124 msgid ""
125 "E-book editing happens using a different container object. It is documented "
126 "in :ref:`polish_api`."
127 msgstr "电子书编辑使用不同的容器对象。详见:ref:`polish_api`。"
128
129 #: ../../../__w/calibre/calibre/manual/develop.rst:61
130 msgid ""
131 "db - The database back-end. See :ref:`db_api` for the interface to the "
132 "calibre library."
133 msgstr "db -- 数据库后端。参考:ref:`db_api`了解calibre的接口。"
134
135 #: ../../../__w/calibre/calibre/manual/develop.rst:63
136 msgid "Content server: ``srv`` is the calibre Content server."
137 msgstr "内容服务器: ``srv`` 是calibre的内容服务器。"
138
139 #: ../../../__w/calibre/calibre/manual/develop.rst:65
140 msgid ""
141 "gui2 - The Graphical User Interface. GUI initialization happens in "
142 "``gui2.main`` and ``gui2.ui``. The e-book-viewer is in ``gui2.viewer``. The "
143 "e-book editor is in ``gui2.tweak_book``."
144 msgstr "gui2 -- 图形用户接口。GUI初始化位于``gui2.main``与``gui2.ui``。电子书浏览器位于``gui2.viewer``。电子书编辑器位于``gui2.tweak_book``。"
145
146 #: ../../../__w/calibre/calibre/manual/develop.rst:67
147 msgid ""
148 "If you want to locate the entry points for all the various calibre "
149 "executables, look at the ``entry_points`` structure in `linux.py "
150 "<https://github.com/kovidgoyal/calibre/blob/master/src/calibre/linux.py>`_."
151 msgstr "如果要定位所有各种Calibre可执行文件的入口点,请在“linux.py <https://github.com/kovidgoyal/calibre/blob/master/src/calibre/linux.py>”中查看``entry_points``结构_。"
152
153 #: ../../../__w/calibre/calibre/manual/develop.rst:71
154 msgid ""
155 "If you need help understanding the code, post in the `development forum "
156 "<https://www.mobileread.com/forums/forumdisplay.php?f=240>`_ and you will "
157 "most likely get help from one of calibre's many developers."
158 msgstr "如果你不理解某些代码,你可以在`development forum <https://www.mobileread.com/forums/forumdisplay.php?f=240>`_中提出,你很可能会得到其他开发者的帮助。"
159
160 #: ../../../__w/calibre/calibre/manual/develop.rst:75
161 msgid "Getting the code"
162 msgstr "得到代码"
163
164 #: ../../../__w/calibre/calibre/manual/develop.rst:77
165 msgid ""
166 "You can get the calibre source code in two ways, using a version control "
167 "system or directly downloading a :website_base:`tarball <dist/src>`."
168 msgstr ""
169
170 #: ../../../__w/calibre/calibre/manual/develop.rst:80
171 msgid ""
172 "calibre uses `Git <https://www.git-scm.com/>`_, a distributed version "
173 "control system. Git is available on all the platforms calibre supports. "
174 "After installing Git, you can get the calibre source code with the command::"
175 msgstr "calibre使用`Git <https://www.git-scm.com/>`_,一个分布式版本控制系统。Git在所有calibre支持的平台上均可用。安装Git后,你就可以通过下面命令获得源码:"
176
177 #: ../../../__w/calibre/calibre/manual/develop.rst:86
178 msgid ""
179 "On Windows you will need the complete path name, that will be something like"
180 " :file:`C:\\\\Program Files\\\\Git\\\\git.exe`."
181 msgstr "在Windows上,你需要完整的路径名,类似于:file:`C:\\\\Program Files\\\\Git\\\\git.exe`。"
182
183 #: ../../../__w/calibre/calibre/manual/develop.rst:88
184 msgid ""
185 "calibre is a very large project with a very long source control history, so "
186 "the above can take a while (10 mins to an hour depending on your internet "
187 "speed)."
188 msgstr "calibre是一个拥有很长时间版本管理历史的大项目,所以下载源码可能需要一点时间(10分钟到1小时,取决于你的网速)。"
189
190 #: ../../../__w/calibre/calibre/manual/develop.rst:91
191 msgid ""
192 "If you want to get the code faster, the source code for the latest release "
193 "is always available as an :website_base:`archive <dist/src>`."
194 msgstr ""
195
196 #: ../../../__w/calibre/calibre/manual/develop.rst:94
197 msgid "To update a branch to the latest code, use the command::"
198 msgstr "升级一个分支到最新版本,可以使用命令:"
199
200 #: ../../../__w/calibre/calibre/manual/develop.rst:98
201 msgid ""
202 "You can also browse the code at `GitHub "
203 "<https://github.com/kovidgoyal/calibre>`_."
204 msgstr "你也可以从`GitHub <https://github.com/kovidgoyal/calibre>`_上获得源码。"
205
206 #: ../../../__w/calibre/calibre/manual/develop.rst:101
207 msgid "Submitting your changes to be included"
208 msgstr "提交要包含的修改"
209
210 #: ../../../__w/calibre/calibre/manual/develop.rst:103
211 msgid ""
212 "If you only plan to make a few small changes, you can make your changes and "
213 "create a \"merge directive\" which you can then attach to a ticket in the "
214 "calibre `bug tracker <https://bugs.launchpad.net/calibre>`_. To do this, "
215 "make your changes, then run::"
216 msgstr "如果您只計劃做一些小修改,您可以做出修改並建立一個\"merge directive\",然後將其附加到calibre的`bug tracker <https://bugs.launchpad.net/calibre>`_中。如果需要這樣做,可以使用下列命令:"
217
218 #: ../../../__w/calibre/calibre/manual/develop.rst:111
219 msgid ""
220 "This will create a :file:`my-changes` file in the current folder, simply "
221 "attach that to a ticket on the calibre `bug tracker "
222 "<https://bugs.launchpad.net/calibre>`_. Note that this will include *all* "
223 "the commits you have made. If you only want to send some commits, you have "
224 "to change ``origin/master`` above. To send only the last commit, use::"
225 msgstr ""
226
227 #: ../../../__w/calibre/calibre/manual/develop.rst:119
228 msgid ""
229 "To send the last *n* commits, replace *1* with *n*, for example, for the "
230 "last 3 commits::"
231 msgstr "上传最后n次提交,用*n*代替*1*。假如提交最后三次提交:"
232
233 #: ../../../__w/calibre/calibre/manual/develop.rst:124
234 msgid "Be careful to not include merges when using ``HEAD~n``."
235 msgstr "当使用``HEAD~n``时,小心不要包含合并。"
236
237 #: ../../../__w/calibre/calibre/manual/develop.rst:126
238 msgid ""
239 "If you plan to do a lot of development on calibre, then the best method is "
240 "to create a `GitHub <https://github.com>`__ account. Below is a basic guide "
241 "to setting up your own fork of calibre in a way that will allow you to "
242 "submit pull requests for inclusion into the main calibre repository:"
243 msgstr "如果你计划为calibre进行长时间开发,那么你最好创建一个`GitHub <https://github.com>`__账号。下面是一个基本教程,它将引导你建立一个自己的calibre分支。这样你就可以向主calibre仓库提交你的pull请求:"
244
245 #: ../../../__w/calibre/calibre/manual/develop.rst:131
246 msgid ""
247 "Setup git on your machine as described in this article: `Setup Git "
248 "<https://help.github.com/articles/set-up-git>`_"
249 msgstr "按这篇文章在你的电脑上安装git:`Setup Git <https://help.github.com/articles/set-up-git>`_"
250
251 #: ../../../__w/calibre/calibre/manual/develop.rst:132
252 msgid ""
253 "Setup ssh keys for authentication to GitHub, as described here: `Generating "
254 "SSH keys <https://help.github.com/articles/generating-ssh-keys>`_"
255 msgstr "設定ssh金鑰以進行GitHub身份驗證,參考這裡:`Generating SSH keys <https://help.github.com/articles/generating-ssh-keys>`_"
256
257 #: ../../../__w/calibre/calibre/manual/develop.rst:133
258 msgid ""
259 "Go to https://github.com/kovidgoyal/calibre and click the :guilabel:`Fork` "
260 "button."
261 msgstr "前往 https://github.com/kovidgoyal/calibre 并点击 :guilabel:`Fork` 按钮。"
262
263 #: ../../../__w/calibre/calibre/manual/develop.rst:134
264 msgid "In a Terminal do::"
265 msgstr "在终端下这样做:"
266
267 #: ../../../__w/calibre/calibre/manual/develop.rst:139
268 msgid ""
269 "Replace <username> above with your GitHub username. That will get your fork "
270 "checked out locally."
271 msgstr "用你的GitHub用户名代替<username>。这将使本地校验你的分支。"
272
273 #: ../../../__w/calibre/calibre/manual/develop.rst:140
274 msgid ""
275 "You can make changes and commit them whenever you like. When you are ready "
276 "to have your work merged, do a::"
277 msgstr "无论何时你都能修改代码并提交。当你准备好待合并部分时,这样做:"
278
279 #: ../../../__w/calibre/calibre/manual/develop.rst:144
280 msgid ""
281 "and go to ``https://github.com/<username>/calibre`` and click the "
282 ":guilabel:`Pull Request` button to generate a pull request that can be "
283 "merged."
284 msgstr "进入 ``https://github.com/<username>/calibre`` 点击 :guilabel:`Pull Request` 按钮,产生一个可被合并的pull请求。"
285
286 #: ../../../__w/calibre/calibre/manual/develop.rst:145
287 msgid ""
288 "You can update your local copy with code from the main repo at any time by "
289 "doing::"
290 msgstr "你能从主仓库中更新你的本地代码副本,使用:"
291
292 #: ../../../__w/calibre/calibre/manual/develop.rst:150
293 msgid ""
294 "You should also keep an eye on the calibre `development forum "
295 "<https://www.mobileread.com/forums/forumdisplay.php?f=240>`_. Before making "
296 "major changes, you should discuss them in the forum or contact Kovid "
297 "directly (his email address is all over the source code)."
298 msgstr "你也应该随时关注calibre的 `development forum <https://www.mobileread.com/forums/forumdisplay.php?f=240>`_ 。在做出重大改变之前,你应该现在论坛中进行讨论或者直接联系Kovid(他的email在源码中可见)。"
299
300 #: ../../../__w/calibre/calibre/manual/develop.rst:156
301 msgid "Windows development environment"
302 msgstr "Windows开发环境"
303
304 #: ../../../__w/calibre/calibre/manual/develop.rst:158
305 #: ../../../__w/calibre/calibre/manual/develop.rst:192
306 #: ../../../__w/calibre/calibre/manual/develop.rst:229
307 msgid ""
308 "You must also get the calibre source code separately as described above."
309 msgstr "你必须想上文所述的那样先得到calibre的源码。"
310
311 #: ../../../__w/calibre/calibre/manual/develop.rst:160
312 msgid ""
313 "Install calibre normally, using the `Windows installer <https://calibre-"
314 "ebook.com/download_windows>`__. Then open a Command Prompt and change to the"
315 " previously checked out calibre code folder. For example::"
316 msgstr ""
317
318 #: ../../../__w/calibre/calibre/manual/develop.rst:165
319 #: ../../../__w/calibre/calibre/manual/develop.rst:241
320 msgid "calibre is the folder that contains the src and resources sub-folders."
321 msgstr ""
322
323 #: ../../../__w/calibre/calibre/manual/develop.rst:167
324 msgid ""
325 "The next step is to set the environment variable ``CALIBRE_DEVELOP_FROM`` to"
326 " the absolute path of the src folder. So, following the example above, it "
327 "would be ``C:\\Users\\kovid\\work\\calibre\\src``. `Here is a short guide "
328 "<https://docs.python.org/using/windows.html#excursus-setting-environment-"
329 "variables>`_ to setting environment variables on Windows."
330 msgstr ""
331
332 #: ../../../__w/calibre/calibre/manual/develop.rst:172
333 msgid ""
334 "Once you have set the environment variable, open a new command prompt and "
335 "check that it was correctly set by using the command::"
336 msgstr "一旦您設定了環境變數,您可以開啟一個新的命令行,透過下面的命令檢查環境變數是否設定成功:"
337
338 #: ../../../__w/calibre/calibre/manual/develop.rst:177
339 #: ../../../__w/calibre/calibre/manual/develop.rst:260
340 msgid ""
341 "Setting this environment variable means that calibre will now load all its "
342 "Python code from the specified location."
343 msgstr "设置环境变量意味着calibre现在可以从指定位置载入它的所有Python代码。"
344
345 #: ../../../__w/calibre/calibre/manual/develop.rst:179
346 msgid ""
347 "That's it! You are now ready to start hacking on the calibre code. For "
348 "example, open the file :file:`src\\\\calibre\\\\__init__.py` in your "
349 "favorite editor and add the line::"
350 msgstr "就是这样!你已经可以开始为calibre编写(hacking)代码了。举例。用你最喜欢的编辑器打开文件 :file:`src\\\\calibre\\\\__init__.py` ,在文件开头添加这么一行:"
351
352 #: ../../../__w/calibre/calibre/manual/develop.rst:184
353 #: ../../../__w/calibre/calibre/manual/develop.rst:267
354 msgid ""
355 "near the top of the file. Now run the command :command:`calibredb`. The very"
356 " first line of output should be ``Hello, world!``."
357 msgstr "现在运行命令 :command:`calibredb` 。输出的第一行应该就是``Hello, world!`` 。"
358
359 #: ../../../__w/calibre/calibre/manual/develop.rst:186
360 msgid ""
361 "You can also setup a calibre development environment inside the free "
362 "Microsoft Visual Studio, if you like, following the instructions `here "
363 "<https://www.mobileread.com/forums/showthread.php?t=251201>`_."
364 msgstr "你也可以通过Microsoft Visual Studio建立calibre开发环境。如果你希望这么做,可以参考这里的教程 `here <https://www.mobileread.com/forums/showthread.php?t=251201>`_ 。"
365
366 #: ../../../__w/calibre/calibre/manual/develop.rst:190
367 msgid "macOS development environment"
368 msgstr "macOS开发环境"
369
370 #: ../../../__w/calibre/calibre/manual/develop.rst:194
371 msgid ""
372 "Install calibre normally using the `provided .dmg <https://calibre-"
373 "ebook.com/download_osx>`__. Then open a Terminal and change to the "
374 "previously checked out calibre code folder, for example::"
375 msgstr ""
376
377 #: ../../../__w/calibre/calibre/manual/develop.rst:199
378 msgid ""
379 "calibre is the folder that contains the src and resources sub-folders. The "
380 "calibre command line tools are found inside the calibre app bundle, in "
381 ":file:`/Applications/calibre.app/Contents/MacOS` you should add this folder "
382 "to your PATH environment variable, if you want to run the command line tools"
383 " easily."
384 msgstr ""
385
386 #: ../../../__w/calibre/calibre/manual/develop.rst:205
387 msgid ""
388 "The next step is to create a bash script that will set the environment "
389 "variable ``CALIBRE_DEVELOP_FROM`` to the absolute path of the src folder "
390 "when running calibre in debug mode."
391 msgstr ""
392
393 #: ../../../__w/calibre/calibre/manual/develop.rst:208
394 msgid "Create a plain text file::"
395 msgstr "创建一个空文件:"
396
397 #: ../../../__w/calibre/calibre/manual/develop.rst:214
398 msgid ""
399 "Save this file as :file:`/usr/local/bin/calibre-develop`, then set its "
400 "permissions so that it can be executed::"
401 msgstr ""
402
403 #: ../../../__w/calibre/calibre/manual/develop.rst:218
404 msgid "Once you have done this, run::"
405 msgstr "一旦你完成上述步骤,然后可以运行:"
406
407 #: ../../../__w/calibre/calibre/manual/develop.rst:222
408 msgid ""
409 "You should see some diagnostic information in the Terminal window as calibre"
410 " starts up, and you should see an asterisk after the version number in the "
411 "GUI window, indicating that you are running from source."
412 msgstr "当calibre启动时,你最好看终端上的诊断信息。你也应该注意到GUI界面的版本后有一个*号,这表示你从源码运行程序。"
413
414 #: ../../../__w/calibre/calibre/manual/develop.rst:227
415 msgid "Linux development environment"
416 msgstr "Linux开发环境"
417
418 #: ../../../__w/calibre/calibre/manual/develop.rst:231
419 msgid ""
420 "calibre is primarily developed on Linux. You have two choices in setting up "
421 "the development environment. You can install the calibre binary as normal "
422 "and use that as a runtime environment to do your development. This approach "
423 "is similar to that used in Windows and macOS. Alternatively, you can install"
424 " calibre from source. Instructions for setting up a development environment "
425 "from source are in the INSTALL file in the source tree. Here we will address"
426 " using the binary as a runtime, which is the recommended method."
427 msgstr "calibre主要开发环境是Linux。你有两种方法配置开发环境。你可以正常安装calibre,在运行时环境下完成开发。这个方法与Windows与macOS开发类似。或者,从源码进行安装calibre。从源码配置开发环境的命令在源码树中的INSTALL文件。接下来我们将使用第一种方法,这也是推荐的方法。"
428
429 #: ../../../__w/calibre/calibre/manual/develop.rst:237
430 msgid ""
431 "Install calibre using the `binary installer <https://calibre-"
432 "ebook.com/download_linux>`_. Then open a terminal and change to the "
433 "previously checked out calibre code folder, for example::"
434 msgstr ""
435
436 #: ../../../__w/calibre/calibre/manual/develop.rst:243
437 msgid ""
438 "The next step is to set the environment variable ``CALIBRE_DEVELOP_FROM`` to"
439 " the absolute path of the src folder. So, following the example above, it "
440 "would be ``/home/kovid/work/calibre/src``. How to set environment variables "
441 "depends on your Linux distribution and what shell you are using."
442 msgstr ""
443
444 #: ../../../__w/calibre/calibre/manual/develop.rst:248
445 msgid ""
446 "It is recommended to use the binary installer provided from upstream. Should"
447 " you insist on using a package provided by your distribution, use the "
448 "``CALIBRE_PYTHON_PATH`` and ``CALIBRE_RESOURCES_PATH`` variables instead. "
449 "You can get these by running ``calibre-debug --paths``. But note that "
450 "distribution calibre packages are often terminally broken and are completely"
451 " unsupported."
452 msgstr ""
453
454 #: ../../../__w/calibre/calibre/manual/develop.rst:255
455 msgid ""
456 "Once you have set the environment variable, open a new terminal and check "
457 "that it was correctly set by using the command::"
458 msgstr "一旦您設定了環境變數,開啟一個新終端,檢查環境變數是否設定正確,使用命令:"
459
460 #: ../../../__w/calibre/calibre/manual/develop.rst:262
461 msgid ""
462 "That's it! You are now ready to start hacking on the calibre code. For "
463 "example, open the file :file:`src/calibre/__init__.py` in your favorite "
464 "editor and add the line::"
465 msgstr "就是这样!你已经可以开始为calibre编写(hacking)代码了。举例。用你最喜欢的编辑器打开文件 :file:`src\\\\calibre\\\\__init__.py` ,在文件开头添加这么一行:"
466
467 #: ../../../__w/calibre/calibre/manual/develop.rst:270
468 msgid ""
469 "Having separate \"normal\" and \"development\" calibre installs on the same "
470 "computer"
471 msgstr "在一台电脑上同时安装正常模式与开发模式的calibre"
472
473 #: ../../../__w/calibre/calibre/manual/develop.rst:272
474 msgid ""
475 "The calibre source tree is very stable and rarely breaks, but if you feel "
476 "the need to run from source on a separate test library and run the released "
477 "calibre version with your everyday library, you can achieve this easily "
478 "using .bat files or shell scripts to launch calibre. The example below shows"
479 " how to do this on Windows using .bat files (the instructions for other "
480 "platforms are the same, just use a shell script instead of a .bat file)"
481 msgstr "calibre源码树非常稳定,很少崩溃,但如果你需要从源码运行一个测试库并且你还要运行released版本的calibre作为日常使用。你能方便地通过批处理文件或者shell脚本启动calibre。下面的例子展示如何在Windows上通过批处理文件启动calibre(其他平台的命令也是一样的,只是用shell脚本代替批处理文件)。"
482
483 #: ../../../__w/calibre/calibre/manual/develop.rst:277
484 msgid "To launch the release version of calibre with your everyday library:"
485 msgstr "用常用库启动release版本的calibre:"
486
487 #: ../../../__w/calibre/calibre/manual/develop.rst:279
488 msgid "calibre-normal.bat::"
489 msgstr "calibre-normal.bat:"
490
491 #: ../../../__w/calibre/calibre/manual/develop.rst:283
492 msgid "calibre-dev.bat::"
493 msgstr "calibre-dev.bat:"
494
495 #: ../../../__w/calibre/calibre/manual/develop.rst:290
496 msgid "Debugging tips"
497 msgstr "Debug技巧"
498
499 #: ../../../__w/calibre/calibre/manual/develop.rst:292
500 msgid ""
501 "Python is a dynamically typed language with excellent facilities for "
502 "introspection. Kovid wrote the core calibre code without once using a "
503 "debugger. There are many strategies to debug calibre code:"
504 msgstr "Python 是一门拥有动态类型的编程语言。它拥有着出色的内省功能。 Kovid 在没有使用调试器的情况下,完成了calibre的核心代码。这里给出一些debug的策略:"
505
506 #: ../../../__w/calibre/calibre/manual/develop.rst:297
507 msgid "Using print statements"
508 msgstr "使用print语句"
509
510 #: ../../../__w/calibre/calibre/manual/develop.rst:299
511 msgid ""
512 "This is Kovid's favorite way to debug. Simply insert print statements at "
513 "points of interest and run your program in the terminal. For example, you "
514 "can start the GUI from the terminal as::"
515 msgstr "这是Kovid最喜欢的Debug方式。只需要在目标点插入print语句,然后在终端运行程序。举例,你能从终端打开GUI界面,像这样:"
516
517 #: ../../../__w/calibre/calibre/manual/develop.rst:304
518 msgid "Similarly, you can start the E-book viewer as::"
519 msgstr ""
520
521 #: ../../../__w/calibre/calibre/manual/develop.rst:308
522 msgid "The e-book editor can be started as::"
523 msgstr ""
524
525 #: ../../../__w/calibre/calibre/manual/develop.rst:313
526 msgid "Using an interactive Python interpreter"
527 msgstr "使用交互式Python解释器"
528
529 #: ../../../__w/calibre/calibre/manual/develop.rst:315
530 msgid ""
531 "You can insert the following two lines of code to start an interactive "
532 "Python session at that point::"
533 msgstr "你可以插入下面两行代码开启一个交互式Python会话:"
534
535 #: ../../../__w/calibre/calibre/manual/develop.rst:320
536 msgid ""
537 "When running from the command line, this will start an interactive Python "
538 "interpreter with access to all locally defined variables (variables in the "
539 "local scope). The interactive prompt even has :kbd:`Tab` completion for "
540 "object properties and you can use the various Python facilities for "
541 "introspection, such as :func:`dir`, :func:`type`, :func:`repr`, etc."
542 msgstr ""
543
544 #: ../../../__w/calibre/calibre/manual/develop.rst:326
545 msgid "Using the Python debugger as a remote debugger"
546 msgstr "使用Python调试器作为远程调试器"
547
548 #: ../../../__w/calibre/calibre/manual/develop.rst:328
549 msgid ""
550 "You can use the builtin Python debugger (pdb) as a remote debugger from the "
551 "command line. First, start the remote debugger at the point in the calibre "
552 "code you are interested in, like this::"
553 msgstr "你可以从命令行中使用内置的Python调试器作为远程调试器。首先,在calibre代码中你关注的位置开启远程调试器,像这样:"
554
555 #: ../../../__w/calibre/calibre/manual/develop.rst:335
556 msgid ""
557 "Then run calibre, either as normal, or using one of the calibre-debug "
558 "commands described in the previous section. Once the above point in the code"
559 " is reached, calibre will freeze, waiting for the debugger to connect."
560 msgstr "然后运行calibre,正常运行,或者使用上文提到的calibre-debug命令。一旦上述代码完成,calibre会停止,等待调试器的连接。"
561
562 #: ../../../__w/calibre/calibre/manual/develop.rst:339
563 msgid ""
564 "Now open a terminal or command prompt and use the following command to start"
565 " the debugging session::"
566 msgstr "現在開啟一個終端或者命令提示字元,使用下列命令開啟debug會話:"
567
568 #: ../../../__w/calibre/calibre/manual/develop.rst:344
569 msgid ""
570 "You can read about how to use the Python debugger in the `Python stdlib docs"
571 " for the pdb module <https://docs.python.org/library/pdb.html#debugger-"
572 "commands>`_."
573 msgstr "您可以在`关于PDB模块的Python stdlib文档<https://docs.python.org/library/pdb.html#debugger-commands>中`了解如何使用Python调试器。"
574
575 #: ../../../__w/calibre/calibre/manual/develop.rst:348
576 msgid ""
577 "By default, the remote debugger will try to connect on port 4444. You can "
578 "change it, by passing the port parameter to both the set_trace() and the "
579 "cli() functions above, like this: ``set_trace(port=1234)`` and "
580 "``cli(port=1234)``."
581 msgstr "默认情况下,远程调试器连接到端口4444。你也可以通过设置 set_trace() 与 cli() 函数更换端口,像这样: ``set_trace(port=1234)`` and ``cli(port=1234)``。"
582
583 #: ../../../__w/calibre/calibre/manual/develop.rst:354
584 msgid ""
585 "The Python debugger cannot handle multiple threads, so you have to call "
586 "set_trace once per thread, each time with a different port number."
587 msgstr "Python调试器不能控制多线程,所以你不得不在每个线程中使用 set_trace 函数一次,每次都得用一个不同的端口号。"
588
589 #: ../../../__w/calibre/calibre/manual/develop.rst:358
590 msgid "Using the debugger in your favorite Python IDE"
591 msgstr "在自己的IDE环境下使用调试器"
592
593 #: ../../../__w/calibre/calibre/manual/develop.rst:360
594 msgid ""
595 "It is possible to use the builtin debugger in your favorite Python IDE, if "
596 "it supports remote debugging. The first step is to add the calibre src "
597 "checkout to the ``PYTHONPATH`` in your IDE. In other words, the folder you "
598 "set as ``CALIBRE_DEVELOP_FROM`` above, must also be in the ``PYTHONPATH`` of"
599 " your IDE."
600 msgstr ""
601
602 #: ../../../__w/calibre/calibre/manual/develop.rst:365
603 msgid ""
604 "Then place the IDE's remote debugger module into the :file:`src` sub-folder "
605 "of the calibre source code checkout. Add whatever code is needed to launch "
606 "the remote debugger to calibre at the point of interest, for example in the "
607 "main function. Then run calibre as normal. Your IDE should now be able to "
608 "connect to the remote debugger running inside calibre."
609 msgstr ""
610
611 #: ../../../__w/calibre/calibre/manual/develop.rst:372
612 msgid "Executing arbitrary scripts in the calibre Python environment"
613 msgstr "在calibre的Python环境中执行任意脚本"
614
615 #: ../../../__w/calibre/calibre/manual/develop.rst:374
616 msgid ""
617 "The :command:`calibre-debug` command provides a couple of handy switches to "
618 "execute your own code, with access to the calibre modules::"
619 msgstr ":command:`calibre-debug` 提供了一些方便的开关来执行你自己的代码,并且可以访问calibre模块:"
620
621 #: ../../../__w/calibre/calibre/manual/develop.rst:379
622 msgid ""
623 "is great for testing a little snippet of code on the command line. It works "
624 "in the same way as the -c switch to the Python interpreter::"
625 msgstr "非常适合在命令行上测试一小段代码。它的工作方式与-c切换至Python解释器的方式相同:"
626
627 #: ../../../__w/calibre/calibre/manual/develop.rst:383
628 msgid ""
629 "can be used to execute your own Python script. It works in the same way as "
630 "passing the script to the Python interpreter, except that the calibre "
631 "environment is fully initialized, so you can use all the calibre code in "
632 "your script. To use command line arguments with your script, use the form::"
633 msgstr "可以用来执行自己的Python脚本。 除了完全初始化calibre环境外,它的工作方式与将脚本传递给Python解释器的方式相同,因此您可以在脚本中使用所有calibre代码。 要在脚本中使用命令行参数,请使用以下格式:"
634
635 #: ../../../__w/calibre/calibre/manual/develop.rst:388
636 msgid ""
637 "The ``--`` causes all subsequent arguments to be passed to your script."
638 msgstr "``--`` 会使后面的所有参数被传到你的脚本里。"
639
640 #: ../../../__w/calibre/calibre/manual/develop.rst:392
641 msgid "Using calibre in your projects"
642 msgstr "在你的项目中使用calibre"
643
644 #: ../../../__w/calibre/calibre/manual/develop.rst:394
645 msgid ""
646 "It is possible to directly use calibre functions/code in your Python "
647 "project. Two ways exist to do this:"
648 msgstr "在你的Python项目中可以直接使用calibre的功能与代码。有两种方法可以这么做:"
649
650 #: ../../../__w/calibre/calibre/manual/develop.rst:397
651 msgid "Binary install of calibre"
652 msgstr "二进制安装calibre"
653
654 #: ../../../__w/calibre/calibre/manual/develop.rst:399
655 msgid ""
656 "If you have a binary install of calibre, you can use the Python interpreter "
657 "bundled with calibre, like this::"
658 msgstr "如果您有calibre的二进制安装,则可以使用calibre附带的Python解释器,如下所示:"
659
660 #: ../../../__w/calibre/calibre/manual/develop.rst:404
661 msgid "Source install on Linux"
662 msgstr "Linux源码安装"
663
664 #: ../../../__w/calibre/calibre/manual/develop.rst:406
665 msgid ""
666 "In addition to using the above technique, if you do a source install on "
667 "Linux, you can also directly import calibre, as follows::"
668 msgstr "除了使用上面的技巧,如果你在Linux中进行源码安装,你可以直接import calibre,就像下面这样:"
669
670 #: ../../../__w/calibre/calibre/manual/develop.rst:414
671 msgid ""
672 "It is essential that you import the init_calibre module before any other "
673 "calibre modules/packages as it sets up the interpreter to run calibre code."
674 msgstr "在将init_calibre模块设置为运行calibre代码的解释器之前,必须先导入init_calibre模块,然后再输入其他calibre模块/软件包。"
675
676 #: ../../../__w/calibre/calibre/manual/develop.rst:418
677 msgid "API documentation for various parts of calibre"
678 msgstr "calibre丰富的API文档"