Debian Codegraph @

translations/manual/en_GB/creating_plugins.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 # Andi Chandler <[email protected]>, 2022-2024,2026
7 # Isabell Long <[email protected]>, 2016
8 msgid ""
9 msgstr ""
10 "Project-Id-Version: calibre\n"
11 "Report-Msgid-Bugs-To: \n"
12 "POT-Creation-Date: 2026-07-30 18:07+0000\n"
13 "PO-Revision-Date: 2014-06-17 08:35+0000\n"
14 "Last-Translator: Andi Chandler <[email protected]>, 2022-2024,2026\n"
15 "Language-Team: English (United Kingdom) (http://app.transifex.com/calibre/calibre/language/en_GB/)\n"
16 "MIME-Version: 1.0\n"
17 "Content-Type: text/plain; charset=UTF-8\n"
18 "Content-Transfer-Encoding: 8bit\n"
19 "Language: en_GB\n"
20 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
21
22 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:4
23 msgid "Writing your own plugins to extend calibre's functionality"
24 msgstr "Writing your own plugins to extend calibre's functionality"
25
26 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:6
27 msgid ""
28 "calibre has a very modular design. Almost all functionality in calibre comes"
29 " in the form of plugins. Plugins are used for conversion, for downloading "
30 "news (though these are called recipes), for various components of the user "
31 "interface, to connect to different devices, to process files when adding "
32 "them to calibre and so on. You can get a complete list of all the built-in "
33 "plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`."
34 msgstr "calibre has a very modular design. Almost all functionality in calibre comes in the form of plugins. Plugins are used for conversion, for downloading news (though these are called recipes), for various components of the user interface, to connect to different devices, to process files when adding them to calibre and so on. You can get a complete list of all the built-in plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`."
35
36 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:8
37 msgid ""
38 "Here, we will teach you how to create your own plugins to add new features "
39 "to calibre."
40 msgstr "Here, we will teach you how to create your own plugins to add new features to calibre."
41
42 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:13
43 msgid "Contents"
44 msgstr "Contents"
45
46 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:15
47 msgid "This only applies to calibre releases >= 0.8.60"
48 msgstr "This only applies to calibre releases >= 0.8.60"
49
50 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:18
51 msgid "Anatomy of a calibre plugin"
52 msgstr "Anatomy of a calibre plugin"
53
54 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:20
55 msgid ""
56 "A calibre plugin is very simple, it's just a ZIP file that contains some "
57 "Python code and any other resources like image files needed by the plugin. "
58 "Without further ado, let's see a basic example."
59 msgstr "A calibre plugin is very simple, it's just a ZIP file that contains some Python code and any other resources like image files needed by the plugin. Without further ado, let's see a basic example."
60
61 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:24
62 msgid ""
63 "Suppose you have an installation of calibre that you are using to self "
64 "publish various e-documents in EPUB and MOBI formats. You would like all "
65 "files generated by calibre to have their publisher set as \"Hello world\", "
66 "here's how to do it. Create a file named :file:`__init__.py` (this is a "
67 "special name and must always be used for the main file of your plugin) and "
68 "enter the following Python code into it:"
69 msgstr "Suppose you have an installation of calibre that you are using to self publish various e-documents in EPUB and MOBI formats. You would like all files generated by calibre to have their publisher set as \"Hello world\", here's how to do it. Create a file named :file:`__init__.py` (this is a special name and must always be used for the main file of your plugin) and enter the following Python code into it:"
70
71 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:32
72 msgid ""
73 "That's all. To add this code to calibre as a plugin, simply run the "
74 "following in the folder in which you created :file:`__init__.py`::"
75 msgstr "That's all. To add this code to calibre as a plugin, simply run the following in the folder in which you created :file:`__init__.py`::"
76
77 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:38
78 msgid ""
79 "On macOS, the command line tools are inside the calibre bundle, for example,"
80 " if you installed calibre in :file:`/Applications` the command line tools "
81 "are in :file:`/Applications/calibre.app/Contents/MacOS/`."
82 msgstr "On macOS, the command line tools are inside the calibre bundle, for example, if you installed calibre in :file:`/Applications` the command line tools are in :file:`/Applications/calibre.app/Contents/MacOS/`."
83
84 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:42
85 msgid ""
86 "You can download the Hello World plugin from "
87 ":download_file:`helloworld_plugin.zip`."
88 msgstr "You can download the Hello World plugin from :download_file:`helloworld_plugin.zip`."
89
90 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:45
91 msgid ""
92 "Every time you use calibre to convert a book, the plugin's :meth:`run` "
93 "method will be called and the converted book will have its publisher set to "
94 "\"Hello World\". This is a trivial plugin, let's move on to a more complex "
95 "example that actually adds a component to the user interface."
96 msgstr "Every time you use calibre to convert a book, the plugin's :meth:`run` method will be called and the converted book will have its publisher set to \"Hello World\". This is a trivial plugin, let's move on to a more complex example that actually adds a component to the user interface."
97
98 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:50
99 msgid "A User Interface plugin"
100 msgstr "A User Interface plugin"
101
102 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:52
103 msgid ""
104 "This plugin will be spread over a few files (to keep the code clean). It "
105 "will show you how to get resources (images or data files) from the plugin "
106 "ZIP file, allow users to configure your plugin, how to create elements in "
107 "the calibre user interface and how to access and query the books database in"
108 " calibre."
109 msgstr "This plugin will be spread over a few files (to keep the code clean). It will show you how to get resources (images or data files) from the plugin ZIP file, allow users to configure your plugin, how to create elements in the calibre user interface and how to access and query the books database in calibre."
110
111 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:57
112 msgid ""
113 "You can download this plugin from :download_file:`interface_demo_plugin.zip`"
114 msgstr "You can download this plugin from :download_file:`interface_demo_plugin.zip`"
115
116 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:61
117 msgid ""
118 "The first thing to note is that this ZIP file has a lot more files in it, "
119 "explained below, pay particular attention to ``plugin-import-name-"
120 "interface_demo.txt``."
121 msgstr "The first thing to note is that this ZIP file has a lot more files in it, explained below, pay particular attention to ``plugin-import-name-interface_demo.txt``."
122
123 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:64
124 msgid "**plugin-import-name-interface_demo.txt**"
125 msgstr "**plugin-import-name-interface_demo.txt**"
126
127 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:65
128 msgid ""
129 "An empty text file used to enable the multi-file plugin magic. This file "
130 "must be present in all plugins that use more than one .py file. It should be"
131 " empty and its filename must be of the form: ``plugin-import-"
132 "name-**some_name**.txt``. The presence of this file allows you to import "
133 "code from the .py files present inside the ZIP file, using a statement "
134 "like::"
135 msgstr "An empty text file used to enable the multi-file plugin magic. This file must be present in all plugins that use more than one .py file. It should be empty and its filename must be of the form: ``plugin-import-name-**some_name**.txt``. The presence of this file allows you to import code from the .py files present inside the ZIP file, using a statement like::"
136
137 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:71
138 msgid ""
139 "The prefix ``calibre_plugins`` must always be present. ``some_name`` comes "
140 "from the filename of the empty text file. ``some_module`` refers to "
141 ":file:`some_module.py` file inside the ZIP file. Note that this importing is"
142 " just as powerful as regular Python imports. You can create packages and "
143 "subpackages of .py modules inside the ZIP file, just like you would normally"
144 " (by defining __init__.py in each sub-folder), and everything should \"just "
145 "work\"."
146 msgstr "The prefix ``calibre_plugins`` must always be present. ``some_name`` comes from the filename of the empty text file. ``some_module`` refers to :file:`some_module.py` file inside the ZIP file. Note that this importing is just as powerful as regular Python imports. You can create packages and subpackages of .py modules inside the ZIP file, just like you would normally (by defining __init__.py in each sub-folder), and everything should \"just work\"."
147
148 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:76
149 msgid ""
150 "The name you use for ``some_name`` enters a global namespace shared by all "
151 "plugins, **so make it as unique as possible**. But remember that it must be "
152 "a valid Python identifier (only alphabets, numbers and the underscore)."
153 msgstr "The name you use for ``some_name`` enters a global namespace shared by all plugins, **so make it as unique as possible**. But remember that it must be a valid Python identifier (only alphabets, numbers and the underscore)."
154
155 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:79
156 msgid "**__init__.py**"
157 msgstr "**__init__.py**"
158
159 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:80
160 msgid "As before, the file that defines the plugin class"
161 msgstr "As before, the file that defines the plugin class"
162
163 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:82
164 msgid "**main.py**"
165 msgstr "**main.py**"
166
167 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:83
168 msgid "This file contains the actual code that does something useful"
169 msgstr "This file contains the actual code that does something useful"
170
171 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:85
172 msgid "**ui.py**"
173 msgstr "**ui.py**"
174
175 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:86
176 msgid "This file defines the interface part of the plugin"
177 msgstr "This file defines the interface part of the plugin"
178
179 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:88
180 msgid "**images/icon.png**"
181 msgstr "**images/icon.png**"
182
183 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:89
184 msgid "The icon for this plugin"
185 msgstr "The icon for this plugin"
186
187 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:91
188 msgid "**about.txt**"
189 msgstr "**about.txt**"
190
191 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:92
192 msgid "A text file with information about the plugin"
193 msgstr "A text file with information about the plugin"
194
195 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:94
196 msgid "**translations**"
197 msgstr "**translations**"
198
199 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:95
200 msgid ""
201 "A folder containing .mo files with the translations of the user interface of"
202 " your plugin into different languages. See below for details."
203 msgstr "A folder containing .mo files with the translations of the user interface of your plugin into different languages. See below for details."
204
205 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:99
206 msgid "Now let's look at the code."
207 msgstr "Now let's look at the code."
208
209 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:102
210 msgid "__init__.py"
211 msgstr "__init__.py"
212
213 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:104
214 msgid "First, the obligatory ``__init__.py`` to define the plugin metadata:"
215 msgstr "First, the obligatory ``__init__.py`` to define the plugin metadata:"
216
217 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:109
218 msgid ""
219 "The only noteworthy feature is the field :attr:`actual_plugin`. Since "
220 "calibre has both command line and GUI interfaces, GUI plugins like this one "
221 "should not load any GUI libraries in __init__.py. The actual_plugin field "
222 "does this for you, by telling calibre that the actual plugin is to be found "
223 "in another file inside your ZIP archive, which will only be loaded in a GUI "
224 "context."
225 msgstr "The only noteworthy feature is the field :attr:`actual_plugin`. Since calibre has both command line and GUI interfaces, GUI plugins like this one should not load any GUI libraries in __init__.py. The actual_plugin field does this for you, by telling calibre that the actual plugin is to be found in another file inside your ZIP archive, which will only be loaded in a GUI context."
226
227 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:114
228 msgid ""
229 "Remember that for this to work, you must have a plugin-import-name-"
230 "some_name.txt file in your plugin ZIP file, as discussed above."
231 msgstr "Remember that for this to work, you must have a plugin-import-name-some_name.txt file in your plugin ZIP file, as discussed above."
232
233 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:117
234 msgid ""
235 "Also there are a couple of methods for enabling user configuration of the "
236 "plugin. These are discussed below."
237 msgstr "Also there are a couple of methods for enabling user configuration of the plugin. These are discussed below."
238
239 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:120
240 msgid "ui.py"
241 msgstr "ui.py"
242
243 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:122
244 msgid ""
245 "Now let's look at ui.py which defines the actual GUI plugin. The source code"
246 " is heavily commented and should be self explanatory:"
247 msgstr "Now let's look at ui.py which defines the actual GUI plugin. The source code is heavily commented and should be self explanatory:"
248
249 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:128
250 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:220
251 msgid "main.py"
252 msgstr "main.py"
253
254 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:130
255 msgid "The actual logic to implement the Interface Plugin Demo dialog."
256 msgstr "The actual logic to implement the Interface Plugin Demo dialog."
257
258 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:136
259 msgid "Getting resources from the plugin ZIP file"
260 msgstr "Getting resources from the plugin ZIP file"
261
262 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:138
263 msgid ""
264 "calibre's plugin loading system defines a couple of built-in functions that "
265 "allow you to conveniently get files from the plugin ZIP file."
266 msgstr "calibre's plugin loading system defines a couple of built-in functions that allow you to conveniently get files from the plugin ZIP file."
267
268 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:140
269 msgid "**get_resources(name_or_list_of_names)**"
270 msgstr "**get_resources(name_or_list_of_names)**"
271
272 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:141
273 msgid ""
274 "This function should be called with a list of paths to files inside the ZIP "
275 "file. For example to access the file :file:`icon.png` in the folder images "
276 "in the ZIP file, you would use: ``images/icon.png``. Always use a forward "
277 "slash as the path separator, even on Windows. When you pass in a single "
278 "name, the function will return the raw bytes of that file or None if the "
279 "name was not found in the ZIP file. If you pass in more than one name then "
280 "it returns a dictionary mapping the names to bytes. If a name is not found,"
281 " it will not be present in the returned dictionary."
282 msgstr "This function should be called with a list of paths to files inside the ZIP file. For example to access the file :file:`icon.png` in the folder images in the ZIP file, you would use: ``images/icon.png``. Always use a forward slash as the path separator, even on Windows. When you pass in a single name, the function will return the raw bytes of that file or None if the name was not found in the ZIP file. If you pass in more than one name then it returns a dictionary mapping the names to bytes. If a name is not found, it will not be present in the returned dictionary."
283
284 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:150
285 msgid "**get_icons(name_or_list_of_names, plugin_name='')**"
286 msgstr "**get_icons(name_or_list_of_names, plugin_name='')**"
287
288 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:151
289 msgid ""
290 "A wrapper for get_resources() that creates QIcon objects from the raw bytes "
291 "returned by get_resources. If a name is not found in the ZIP file the "
292 "corresponding QIcon will be null. In order to support icon theme-ing, pass "
293 "in the human friendly name of your plugin as ``plugin_name``. If the user is"
294 " using an icon theme with icons for your plugin, they will be loaded "
295 "preferentially."
296 msgstr "A wrapper for get_resources() that creates QIcon objects from the raw bytes returned by get_resources. If a name is not found in the ZIP file the corresponding QIcon will be null. In order to support icon theme-ing, pass in the human friendly name of your plugin as ``plugin_name``. If the user is using an icon theme with icons for your plugin, they will be loaded preferentially."
297
298 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:160
299 msgid "Enabling user configuration of your plugin"
300 msgstr "Enabling user configuration of your plugin"
301
302 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:162
303 msgid ""
304 "To allow users to configure your plugin, you must define three methods in "
305 "your base plugin class, **is_customizable**, **config_widget** and "
306 "**save_settings** as shown below:"
307 msgstr "To allow users to configure your plugin, you must define three methods in your base plugin class, **is_customizable**, **config_widget** and **save_settings** as shown below:"
308
309 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:173
310 msgid ""
311 "calibre has many different ways to store configuration data (a legacy of its"
312 " long history). The recommended way is to use the **JSONConfig** class, "
313 "which stores your configuration information in a .json file."
314 msgstr "calibre has many different ways to store configuration data (a legacy of its long history). The recommended way is to use the **JSONConfig** class, which stores your configuration information in a .json file."
315
316 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:175
317 msgid ""
318 "The code to manage configuration data in the demo plugin is in config.py:"
319 msgstr "The code to manage configuration data in the demo plugin is in config.py:"
320
321 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:180
322 msgid ""
323 "The ``prefs`` object is now available throughout the plugin code by a "
324 "simple::"
325 msgstr "The ``prefs`` object is now available throughout the plugin code by a simple::"
326
327 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:185
328 msgid "You can see the ``prefs`` object being used in main.py:"
329 msgstr "You can see the ``prefs`` object being used in main.py:"
330
331 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:192
332 msgid "Edit book plugins"
333 msgstr "Edit book plugins"
334
335 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:194
336 msgid ""
337 "Now let's change gears for a bit and look at creating a plugin to add tools "
338 "to the calibre book editor. The plugin is available here: "
339 ":download_file:`editor_demo_plugin.zip`."
340 msgstr "Now let's change gears for a bit and look at creating a plugin to add tools to the calibre book editor. The plugin is available here: :download_file:`editor_demo_plugin.zip`."
341
342 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:198
343 msgid ""
344 "The first step, as for all plugins is to create the import name empty txt "
345 "file, as described :ref:`above <import_name_txt>`. We shall name the file "
346 "``plugin-import-name-editor_plugin_demo.txt``."
347 msgstr "The first step, as for all plugins is to create the import name empty txt file, as described :ref:`above <import_name_txt>`. We shall name the file ``plugin-import-name-editor_plugin_demo.txt``."
348
349 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:202
350 msgid ""
351 "Now we create the mandatory ``__init__.py`` file that contains metadata "
352 "about the plugin -- its name, author, version, etc."
353 msgstr "Now we create the mandatory ``__init__.py`` file that contains metadata about the plugin -- its name, author, version, etc."
354
355 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:208
356 msgid ""
357 "A single editor plugin can provide multiple tools each tool corresponds to a"
358 " single button in the toolbar and entry in the :guilabel:`Plugins` menu in "
359 "the editor. These can have sub-menus in case the tool has multiple related "
360 "actions."
361 msgstr "A single editor plugin can provide multiple tools each tool corresponds to a single button in the toolbar and entry in the :guilabel:`Plugins` menu in the editor. These can have sub-menus in case the tool has multiple related actions."
362
363 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:212
364 msgid ""
365 "The tools must all be defined in the file ``main.py`` in your plugin. Every "
366 "tool is a class that inherits from the "
367 ":class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at "
368 "``main.py`` from the demo plugin, the source code is heavily commented and "
369 "should be self-explanatory. Read the API documents of the "
370 ":class:`calibre.gui2.tweak_book.plugin.Tool` class for more details."
371 msgstr "The tools must all be defined in the file ``main.py`` in your plugin. Every tool is a class that inherits from the :class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at ``main.py`` from the demo plugin, the source code is heavily commented and should be self-explanatory. Read the API documents of the :class:`calibre.gui2.tweak_book.plugin.Tool` class for more details."
372
373 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:222
374 msgid ""
375 "Here we will see the definition of a single tool that will multiply all font"
376 " sizes in the book by a number provided by the user. This tool demonstrates "
377 "various important concepts that you will need in developing your own "
378 "plugins, so you should read the (heavily commented) source code carefully."
379 msgstr "Here we will see the definition of a single tool that will multiply all font sizes in the book by a number provided by the user. This tool demonstrates various important concepts that you will need in developing your own plugins, so you should read the (heavily commented) source code carefully."
380
381 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:230
382 msgid ""
383 "Let's break down ``main.py``. We see that it defines a single tool, named "
384 "*Magnify fonts*. This tool will ask the user for a number and multiply all "
385 "font sizes in the book by that number."
386 msgstr "Let's break down ``main.py``. We see that it defines a single tool, named *Magnify fonts*. This tool will ask the user for a number and multiply all font sizes in the book by that number."
387
388 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:234
389 msgid ""
390 "The first important thing is the tool name which you must set to some "
391 "relatively unique string as it will be used as the key for this tool."
392 msgstr "The first important thing is the tool name which you must set to some relatively unique string as it will be used as the key for this tool."
393
394 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:237
395 msgid ""
396 "The next important entry point is the "
397 ":meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method "
398 "creates the QAction objects that appear in the plugins toolbar and plugin "
399 "menu. It also, optionally, assigns a keyboard shortcut that the user can "
400 "customize. The triggered signal from the QAction is connected to the "
401 "ask_user() method that asks the user for the font size multiplier, and then "
402 "runs the magnification code."
403 msgstr "The next important entry point is the :meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method creates the QAction objects that appear in the plugins toolbar and plugin menu. It also, optionally, assigns a keyboard shortcut that the user can customize. The triggered signal from the QAction is connected to the ask_user() method that asks the user for the font size multiplier, and then runs the magnification code."
404
405 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:245
406 msgid ""
407 "The magnification code is well commented and fairly simple. The main things "
408 "to note are that you get a reference to the editor window as ``self.gui`` "
409 "and the editor *Boss* as ``self.boss``. The *Boss* is the object that "
410 "controls the editor user interface. It has many useful methods, that are "
411 "documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class."
412 msgstr "The magnification code is well commented and fairly simple. The main things to note are that you get a reference to the editor window as ``self.gui`` and the editor *Boss* as ``self.boss``. The *Boss* is the object that controls the editor user interface. It has many useful methods, that are documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class."
413
414 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:251
415 msgid ""
416 "Finally, there is ``self.current_container`` which is a reference to the "
417 "book being edited as a "
418 ":class:`calibre.ebooks.oeb.polish.container.Container` object. This "
419 "represents the book as a collection of its constituent HTML/CSS/image files "
420 "and has convenience methods for doing many useful things. The container "
421 "object and various useful utility functions that can be reused in your "
422 "plugin code are documented in :ref:`polish_api`."
423 msgstr "Finally, there is ``self.current_container`` which is a reference to the book being edited as a :class:`calibre.ebooks.oeb.polish.container.Container` object. This represents the book as a collection of its constituent HTML/CSS/image files and has convenience methods for doing many useful things. The container object and various useful utility functions that can be reused in your plugin code are documented in :ref:`polish_api`."
424
425 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:259
426 msgid "Adding translations to your plugin"
427 msgstr "Adding translations to your plugin"
428
429 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:261
430 msgid ""
431 "You can have all the user interface strings in your plugin translated and "
432 "displayed in whatever language is set for the main calibre user interface."
433 msgstr "You can have all the user interface strings in your plugin translated and displayed in whatever language is set for the main calibre user interface."
434
435 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:264
436 msgid ""
437 "The first step is to go through your plugin's source code and mark all user "
438 "visible strings as translatable, by surrounding them in _(). For example::"
439 msgstr "The first step is to go through your plugin's source code and mark all user visible strings as translatable, by surrounding them in _(). For example::"
440
441 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:269
442 msgid ""
443 "Then use some program to generate .po files from your plugin source code. "
444 "There should be one .po file for every language you want to translate into. "
445 "For example: de.po for German, fr.po for French and so on. You can use the "
446 "`Poedit <https://poedit.net/>`_ program for this."
447 msgstr "Then use some program to generate .po files from your plugin source code. There should be one .po file for every language you want to translate into. For example: de.po for German, fr.po for French and so on. You can use the `Poedit <https://poedit.net/>`_ program for this."
448
449 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:274
450 msgid ""
451 "Send these .po files to your translators. Once you get them back, compile "
452 "them into .mo files. You can again use Poedit for that, or just do::"
453 msgstr "Send these .po files to your translators. Once you get them back, compile them into .mo files. You can again use Poedit for that, or just do::"
454
455 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:279
456 msgid "Put the .mo files into the ``translations`` folder in your plugin."
457 msgstr "Put the .mo files into the ``translations`` folder in your plugin."
458
459 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:281
460 msgid ""
461 "The last step is to simply call the function `load_translations()` at the "
462 "top of your plugin's .py files. For performance reasons you should only call"
463 " this function in those .py files that actually have translatable strings. "
464 "So in a typical User Interface plugin you would call it at the top of "
465 "``ui.py`` but not ``__init__.py``."
466 msgstr "The last step is to simply call the function `load_translations()` at the top of your plugin's .py files. For performance reasons you should only call this function in those .py files that actually have translatable strings. So in a typical User Interface plugin you would call it at the top of ``ui.py`` but not ``__init__.py``."
467
468 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:287
469 msgid ""
470 "You can test the translations of your plugins by changing the user interface"
471 " language in calibre under :guilabel:`Preferences->Interface->Look & feel` "
472 "or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment "
473 "variable set. For example::"
474 msgstr "You can test the translations of your plugins by changing the user interface language in calibre under :guilabel:`Preferences->Interface->Look & feel` or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment variable set. For example::"
475
476 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:293
477 msgid ""
478 "Replace ``de`` with the language code of the language you want to test."
479 msgstr "Replace ``de`` with the language code of the language you want to test."
480
481 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:295
482 msgid ""
483 "For translations with plurals, use the ``ngettext()`` function instead of "
484 "``_()``. For example::"
485 msgstr "For translations with plurals, use the ``ngettext()`` function instead of ``_()``. For example::"
486
487 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:301
488 msgid "The plugin API"
489 msgstr "The plugin API"
490
491 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:303
492 msgid ""
493 "As you may have noticed above, a plugin in calibre is a class. There are "
494 "different classes for the different types of plugins in calibre. Details on "
495 "each class, including the base class of all plugins can be found in "
496 ":ref:`plugins`."
497 msgstr "As you may have noticed above, a plugin in calibre is a class. There are different classes for the different types of plugins in calibre. Details on each class, including the base class of all plugins can be found in :ref:`plugins`."
498
499 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:306
500 msgid ""
501 "Your plugin is almost certainly going to use code from calibre. To learn how"
502 " to find various bits of functionality in the calibre code base, read the "
503 "section on the calibre :ref:`code_layout`."
504 msgstr "Your plugin is almost certainly going to use code from calibre. To learn how to find various bits of functionality in the calibre code base, read the section on the calibre :ref:`code_layout`."
505
506 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:311
507 msgid "Debugging plugins"
508 msgstr "Debugging plugins"
509
510 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:313
511 msgid ""
512 "The first, most important step is to run calibre in debug mode. You can do "
513 "this from the command line with::"
514 msgstr "The first, most important step is to run calibre in debug mode. You can do this from the command line with::"
515
516 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:317
517 msgid ""
518 "Or from within calibre by right-clicking the :guilabel:`Preferences` button "
519 "or using the :kbd:`Ctrl+Shift+R` keyboard shortcut."
520 msgstr "Or from within calibre by right-clicking the :guilabel:`Preferences` button or using the :kbd:`Ctrl+Shift+R` keyboard shortcut."
521
522 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:319
523 msgid ""
524 "When running from the command line, debug output will be printed to the "
525 "console, when running from within calibre the output will go to a txt file."
526 msgstr "When running from the command line, debug output will be printed to the console, when running from within calibre the output will go to a txt file."
527
528 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:321
529 msgid ""
530 "You can insert print statements anywhere in your plugin code, they will be "
531 "output in debug mode. Remember, this is Python, you really shouldn't need "
532 "anything more than print statements to debug ;) I developed all of calibre "
533 "using just this debugging technique."
534 msgstr "You can insert print statements anywhere in your plugin code, they will be output in debug mode. Remember, this is Python, you really shouldn't need anything more than print statements to debug ;) I developed all of calibre using just this debugging technique."
535
536 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:323
537 msgid ""
538 "You can quickly test changes to your plugin by using the following command "
539 "line::"
540 msgstr "You can quickly test changes to your plugin by using the following command line::"
541
542 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:328
543 msgid ""
544 "This will shutdown a running calibre, wait for the shutdown to complete, "
545 "then update your plugin in calibre and relaunch calibre."
546 msgstr "This will shutdown a running calibre, wait for the shutdown to complete, then update your plugin in calibre and relaunch calibre."
547
548 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:331
549 msgid "More plugin examples"
550 msgstr "More plugin examples"
551
552 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:333
553 msgid ""
554 "You can find a list of many sophisticated calibre plugins `here "
555 "<https://www.mobileread.com/forums/showthread.php?t=118764>`_."
556 msgstr "You can find a list of many sophisticated calibre plugins `here <https://www.mobileread.com/forums/showthread.php?t=118764>`_."
557
558 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:336
559 msgid "Sharing your plugins with others"
560 msgstr "Sharing your plugins with others"
561
562 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:338
563 msgid ""
564 "If you would like to share the plugins you have created with other users of "
565 "calibre, post your plugin in a new thread in the `calibre plugins forum "
566 "<https://www.mobileread.com/forums/forumdisplay.php?f=237>`_."
567 msgstr "If you would like to share the plugins you have created with other users of calibre, post your plugin in a new thread in the `calibre plugins forum <https://www.mobileread.com/forums/forumdisplay.php?f=237>`_."