| 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 |
# Andrea Forlani <[email protected]>, 2016 |
| 7 |
# Giandomenico Gozio <[email protected]>, 2024 |
| 8 |
# Marta Mingolla <[email protected]>, 2017 |
| 9 |
# Michele Galimberti <[email protected]>, 2021-2023 |
| 10 |
# Riccardo Di Maio <[email protected]>, 2015 |
| 11 |
# Vincenzo Reale <[email protected]>, 2014 |
| 12 |
msgid "" |
| 13 |
msgstr "" |
| 14 |
"Project-Id-Version: calibre\n" |
| 15 |
"Report-Msgid-Bugs-To: \n" |
| 16 |
"POT-Creation-Date: 2026-02-17 16:44+0000\n" |
| 17 |
"PO-Revision-Date: 2014-06-17 08:35+0000\n" |
| 18 |
"Last-Translator: Giandomenico Gozio <[email protected]>, 2024\n" |
| 19 |
"Language-Team: Italian (http://app.transifex.com/calibre/calibre/language/it/)\n" |
| 20 |
"MIME-Version: 1.0\n" |
| 21 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 22 |
"Content-Transfer-Encoding: 8bit\n" |
| 23 |
"Language: it\n" |
| 24 |
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" |
| 25 |
|
| 26 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:4 |
| 27 |
msgid "Writing your own plugins to extend calibre's functionality" |
| 28 |
msgstr "Scrivere i propri plugin per estendere le funzionalità di calibre" |
| 29 |
|
| 30 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:6 |
| 31 |
msgid "" |
| 32 |
"calibre has a very modular design. Almost all functionality in calibre comes" |
| 33 |
" in the form of plugins. Plugins are used for conversion, for downloading " |
| 34 |
"news (though these are called recipes), for various components of the user " |
| 35 |
"interface, to connect to different devices, to process files when adding " |
| 36 |
"them to calibre and so on. You can get a complete list of all the built-in " |
| 37 |
"plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`." |
| 38 |
msgstr "calibre ha una struttura estremamente modulare. Quasi tutte le funzionalità di calibre agiscono sotto forma di plugin. Dei plugin sono usati per le conversioni, per scaricare le notizie (sebbene questi siano chiamati ricette), per molte componenti dell'interfaccia utente, per connettersi a svariati dispositivi, per elaborare i file aggiunti a calibre e così via. Puoi ottenere una lista completa dei plugin inclusi in calibre andando in :guilabel:`Preferenze->Avanzate->Plugin`." |
| 39 |
|
| 40 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:8 |
| 41 |
msgid "" |
| 42 |
"Here, we will teach you how to create your own plugins to add new features " |
| 43 |
"to calibre." |
| 44 |
msgstr "Qui, ti insegneremo come creare i tuoi plugin per aggiungere nuove funzioni a calibre." |
| 45 |
|
| 46 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:13 |
| 47 |
msgid "Contents" |
| 48 |
msgstr "Contenuti" |
| 49 |
|
| 50 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:15 |
| 51 |
msgid "This only applies to calibre releases >= 0.8.60" |
| 52 |
msgstr "Si applica solo alle versioni di calibre >= 0.8.60" |
| 53 |
|
| 54 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:18 |
| 55 |
msgid "Anatomy of a calibre plugin" |
| 56 |
msgstr "Anatomia di un plugin di calibre" |
| 57 |
|
| 58 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:20 |
| 59 |
msgid "" |
| 60 |
"A calibre plugin is very simple, it's just a ZIP file that contains some " |
| 61 |
"Python code and any other resources like image files needed by the plugin. " |
| 62 |
"Without further ado, let's see a basic example." |
| 63 |
msgstr "Un plugin di calibre è molto semplice, è solo un file ZIP che contiene del codice in Python e qualsiasi altra risorsa necessaria al plugin, come le immagini. Senza indugiare oltre, vediamo un semplice esempio." |
| 64 |
|
| 65 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:24 |
| 66 |
msgid "" |
| 67 |
"Suppose you have an installation of calibre that you are using to self " |
| 68 |
"publish various e-documents in EPUB and MOBI formats. You would like all " |
| 69 |
"files generated by calibre to have their publisher set as \"Hello world\", " |
| 70 |
"here's how to do it. Create a file named :file:`__init__.py` (this is a " |
| 71 |
"special name and must always be used for the main file of your plugin) and " |
| 72 |
"enter the following Python code into it:" |
| 73 |
msgstr "Immagina di avere un'installazione di calibre che usi per l'autopubblicazione di vari documenti elettronici nei formati EPUB e MOBI. Vorresti fare in modo che tutti i file generati da calibre avessero \"Hello world\" impostato come editore, ecco il modo di farlo. Crea un file con il nome :file:`__init__.py` (questo è un nome speciale che deve sempre essere usato per il file principale del tuo plugin) e inseriscivi il seguente codice Python:" |
| 74 |
|
| 75 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:32 |
| 76 |
msgid "" |
| 77 |
"That's all. To add this code to calibre as a plugin, simply run the " |
| 78 |
"following in the folder in which you created :file:`__init__.py`::" |
| 79 |
msgstr "Questo è tutto. Per aggiungere questo codice a calibre come plugin, devi solo eseguire il comando che segue nella cartella in cui hai creato :file:`__init__.py`::" |
| 80 |
|
| 81 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:38 |
| 82 |
msgid "" |
| 83 |
"On macOS, the command line tools are inside the calibre bundle, for example," |
| 84 |
" if you installed calibre in :file:`/Applications` the command line tools " |
| 85 |
"are in :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 86 |
msgstr "In macOS, gli strumenti da linea di comando si trovano dentro il bundle di calibre, per esempio, se hai installato calibre in :file:`/Applications` gli strumenti si trovano in :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 87 |
|
| 88 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:42 |
| 89 |
msgid "" |
| 90 |
"You can download the Hello World plugin from " |
| 91 |
":download_file:`helloworld_plugin.zip`." |
| 92 |
msgstr "Puoi scaricare il plugin Hello World da :download_file:`helloworld_plugin.zip`." |
| 93 |
|
| 94 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:45 |
| 95 |
msgid "" |
| 96 |
"Every time you use calibre to convert a book, the plugin's :meth:`run` " |
| 97 |
"method will be called and the converted book will have its publisher set to " |
| 98 |
"\"Hello World\". This is a trivial plugin, let's move on to a more complex " |
| 99 |
"example that actually adds a component to the user interface." |
| 100 |
msgstr "" |
| 101 |
|
| 102 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:50 |
| 103 |
msgid "A User Interface plugin" |
| 104 |
msgstr "Un plugin dell'interfaccia utente" |
| 105 |
|
| 106 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:52 |
| 107 |
msgid "" |
| 108 |
"This plugin will be spread over a few files (to keep the code clean). It " |
| 109 |
"will show you how to get resources (images or data files) from the plugin " |
| 110 |
"ZIP file, allow users to configure your plugin, how to create elements in " |
| 111 |
"the calibre user interface and how to access and query the books database in" |
| 112 |
" calibre." |
| 113 |
msgstr "Questo plugin sarà distribuito in pochi file (per mantenere il codice pulito). Vi mostrerà come ottenere risorse (immagini o file di dati) dal file ZIP del plugin, come consentire agli utenti di configurare il plugin, come creare elementi nell'interfaccia utente di calibre e come accedere e interrogare il database dei libri in Calibre." |
| 114 |
|
| 115 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:57 |
| 116 |
msgid "" |
| 117 |
"You can download this plugin from :download_file:`interface_demo_plugin.zip`" |
| 118 |
msgstr "Il plugin può essere scaricato da :download_file:`interface_demo_plugin.zip`." |
| 119 |
|
| 120 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:61 |
| 121 |
msgid "" |
| 122 |
"The first thing to note is that this ZIP file has a lot more files in it, " |
| 123 |
"explained below, pay particular attention to ``plugin-import-name-" |
| 124 |
"interface_demo.txt``." |
| 125 |
msgstr "La prima cosa da notare è che questo file ZIP contiene molti altri file, spiegati di seguito; prestate particolare attenzione a ``plugin-import-name-interface_demo.txt``." |
| 126 |
|
| 127 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:64 |
| 128 |
msgid "**plugin-import-name-interface_demo.txt**" |
| 129 |
msgstr "**plugin-import-name-interface_demo.txt**" |
| 130 |
|
| 131 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:65 |
| 132 |
msgid "" |
| 133 |
"An empty text file used to enable the multi-file plugin magic. This file " |
| 134 |
"must be present in all plugins that use more than one .py file. It should be" |
| 135 |
" empty and its filename must be of the form: ``plugin-import-" |
| 136 |
"name-**some_name**.txt``. The presence of this file allows you to import " |
| 137 |
"code from the .py files present inside the ZIP file, using a statement " |
| 138 |
"like::" |
| 139 |
msgstr "Un file di testo vuoto usato per abilitare la magia dei plugin multi-file. Questo file deve essere presente in tutti i plugin che utilizzano più di un file .py. Deve essere vuoto e il suo nome deve essere della forma: ``plugin-import-name-**some_name**.txt``. La presenza di questo file consente di importare codice dai file .py presenti all'interno del file ZIP, utilizzando un'istruzione del tipo::" |
| 140 |
|
| 141 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:71 |
| 142 |
msgid "" |
| 143 |
"The prefix ``calibre_plugins`` must always be present. ``some_name`` comes " |
| 144 |
"from the filename of the empty text file. ``some_module`` refers to " |
| 145 |
":file:`some_module.py` file inside the ZIP file. Note that this importing is" |
| 146 |
" just as powerful as regular Python imports. You can create packages and " |
| 147 |
"subpackages of .py modules inside the ZIP file, just like you would normally" |
| 148 |
" (by defining __init__.py in each sub-folder), and everything should \"just " |
| 149 |
"work\"." |
| 150 |
msgstr "" |
| 151 |
|
| 152 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:76 |
| 153 |
msgid "" |
| 154 |
"The name you use for ``some_name`` enters a global namespace shared by all " |
| 155 |
"plugins, **so make it as unique as possible**. But remember that it must be " |
| 156 |
"a valid Python identifier (only alphabets, numbers and the underscore)." |
| 157 |
msgstr "Il nome che si usa per ``some_name'' entra in uno spazio dei nomi globale condiviso da tutti i plugin, **quindi deve essere il più unico possibile**. Ma ricordate che deve essere un identificatore Python valido (solo alfabeti, numeri e trattino basso)." |
| 158 |
|
| 159 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:79 |
| 160 |
msgid "**__init__.py**" |
| 161 |
msgstr "**__init__.py**" |
| 162 |
|
| 163 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:80 |
| 164 |
msgid "As before, the file that defines the plugin class" |
| 165 |
msgstr "Come in precedenza, il file che definisce la classe del plugin" |
| 166 |
|
| 167 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:82 |
| 168 |
msgid "**main.py**" |
| 169 |
msgstr "**main.py**" |
| 170 |
|
| 171 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:83 |
| 172 |
msgid "This file contains the actual code that does something useful" |
| 173 |
msgstr "Questo file contiene il codice vero e proprio che fa qualcosa di utile" |
| 174 |
|
| 175 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:85 |
| 176 |
msgid "**ui.py**" |
| 177 |
msgstr "**ui.py**" |
| 178 |
|
| 179 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:86 |
| 180 |
msgid "This file defines the interface part of the plugin" |
| 181 |
msgstr "Questo file definisce la parte dell'interfaccia del plugin" |
| 182 |
|
| 183 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:88 |
| 184 |
msgid "**images/icon.png**" |
| 185 |
msgstr "**images/icon.png**" |
| 186 |
|
| 187 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:89 |
| 188 |
msgid "The icon for this plugin" |
| 189 |
msgstr "L'icona per questo plugin" |
| 190 |
|
| 191 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:91 |
| 192 |
msgid "**about.txt**" |
| 193 |
msgstr "**about.txt**" |
| 194 |
|
| 195 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:92 |
| 196 |
msgid "A text file with information about the plugin" |
| 197 |
msgstr "File di testo con informazioni sul plugin" |
| 198 |
|
| 199 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:94 |
| 200 |
msgid "**translations**" |
| 201 |
msgstr "**traduzioni**" |
| 202 |
|
| 203 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:95 |
| 204 |
msgid "" |
| 205 |
"A folder containing .mo files with the translations of the user interface of" |
| 206 |
" your plugin into different languages. See below for details." |
| 207 |
msgstr "La cartella contiene file .mo con l'interfaccia utente del tuo plugin tradotta in diverse lingue. Guarda più in basso per i dettagli." |
| 208 |
|
| 209 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:99 |
| 210 |
msgid "Now let's look at the code." |
| 211 |
msgstr "Ora diamo un'occhiata al codice." |
| 212 |
|
| 213 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:102 |
| 214 |
msgid "__init__.py" |
| 215 |
msgstr "__init__.py" |
| 216 |
|
| 217 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:104 |
| 218 |
msgid "First, the obligatory ``__init__.py`` to define the plugin metadata:" |
| 219 |
msgstr "Innanzitutto, l'obbligatorio ``__init__.py`` per definire i metadati del plugin:" |
| 220 |
|
| 221 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:109 |
| 222 |
msgid "" |
| 223 |
"The only noteworthy feature is the field :attr:`actual_plugin`. Since " |
| 224 |
"calibre has both command line and GUI interfaces, GUI plugins like this one " |
| 225 |
"should not load any GUI libraries in __init__.py. The actual_plugin field " |
| 226 |
"does this for you, by telling calibre that the actual plugin is to be found " |
| 227 |
"in another file inside your ZIP archive, which will only be loaded in a GUI " |
| 228 |
"context." |
| 229 |
msgstr "L'unica caratteristica degna di nota è il campo :attr:`actual_plugin`. Poiché calibre ha sia un'interfaccia a riga di comando che una GUI, i plugin GUI come questo non dovrebbero caricare alcuna libreria GUI in __init__.py. Il campo actual_plugin fa questo per voi, dicendo a calibre che il plugin vero e proprio si trova in un altro file all'interno dell'archivio ZIP, che verrà caricato solo in un contesto GUI." |
| 230 |
|
| 231 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:114 |
| 232 |
msgid "" |
| 233 |
"Remember that for this to work, you must have a plugin-import-name-" |
| 234 |
"some_name.txt file in your plugin ZIP file, as discussed above." |
| 235 |
msgstr "Ricordare che, per funzionare, è necessario avere un file plugin-import-name-some_name.txt nel file ZIP del plugin, come discusso in precedenza." |
| 236 |
|
| 237 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:117 |
| 238 |
msgid "" |
| 239 |
"Also there are a couple of methods for enabling user configuration of the " |
| 240 |
"plugin. These are discussed below." |
| 241 |
msgstr "Esistono inoltre un paio di metodi per abilitare la configurazione del plugin da parte dell'utente. Questi sono discussi di seguito." |
| 242 |
|
| 243 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:120 |
| 244 |
msgid "ui.py" |
| 245 |
msgstr "ui.py" |
| 246 |
|
| 247 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:122 |
| 248 |
msgid "" |
| 249 |
"Now let's look at ui.py which defines the actual GUI plugin. The source code" |
| 250 |
" is heavily commented and should be self explanatory:" |
| 251 |
msgstr "Ora diamo un'occhiata a ui.py, che definisce il plugin GUI vero e proprio. Il codice sorgente è pesantemente commentato e dovrebbe essere autoesplicativo:" |
| 252 |
|
| 253 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:128 |
| 254 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:220 |
| 255 |
msgid "main.py" |
| 256 |
msgstr "main.py" |
| 257 |
|
| 258 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:130 |
| 259 |
msgid "The actual logic to implement the Interface Plugin Demo dialog." |
| 260 |
msgstr "La logica effettiva per implementare la finestra di dialogo Demo del plugin di interfaccia." |
| 261 |
|
| 262 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:136 |
| 263 |
msgid "Getting resources from the plugin ZIP file" |
| 264 |
msgstr "Ottenere le risorse dal file ZIP del plugin" |
| 265 |
|
| 266 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:138 |
| 267 |
msgid "" |
| 268 |
"calibre's plugin loading system defines a couple of built-in functions that " |
| 269 |
"allow you to conveniently get files from the plugin ZIP file." |
| 270 |
msgstr "Il sistema di caricamento dei plugin di Calibre definisce un paio di funzioni integrate che consentono di ottenere comodamente i file dal file ZIP del plugin." |
| 271 |
|
| 272 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:140 |
| 273 |
msgid "**get_resources(name_or_list_of_names)**" |
| 274 |
msgstr "**get_resources(name_or_list_of_names)**" |
| 275 |
|
| 276 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:141 |
| 277 |
msgid "" |
| 278 |
"This function should be called with a list of paths to files inside the ZIP " |
| 279 |
"file. For example to access the file :file:`icon.png` in the folder images " |
| 280 |
"in the ZIP file, you would use: ``images/icon.png``. Always use a forward " |
| 281 |
"slash as the path separator, even on Windows. When you pass in a single " |
| 282 |
"name, the function will return the raw bytes of that file or None if the " |
| 283 |
"name was not found in the ZIP file. If you pass in more than one name then " |
| 284 |
"it returns a dictionary mapping the names to bytes. If a name is not found," |
| 285 |
" it will not be present in the returned dictionary." |
| 286 |
msgstr "Questa funzione deve essere chiamata con un elenco di percorsi dei file all'interno del file ZIP. Ad esempio, per accedere al file :file:`icon.png` nella cartella images del file ZIP, si deve usare: ``images/icon.png``. Usare sempre una barra in avanti come separatore di percorso, anche su Windows. Quando si passa un solo nome, la funzione restituisce i byte grezzi di quel file o Nessuno se il nome non è stato trovato nel file ZIP. Se si inserisce più di un nome, la funzione restituisce un dizionario che mappa i nomi in byte. Se un nome non viene trovato, non sarà presente nel dizionario restituito." |
| 287 |
|
| 288 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:150 |
| 289 |
msgid "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 290 |
msgstr "**get_icons(nome_o_lista_di_nomi, nome_plugin='')**" |
| 291 |
|
| 292 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:151 |
| 293 |
msgid "" |
| 294 |
"A wrapper for get_resources() that creates QIcon objects from the raw bytes " |
| 295 |
"returned by get_resources. If a name is not found in the ZIP file the " |
| 296 |
"corresponding QIcon will be null. In order to support icon theme-ing, pass " |
| 297 |
"in the human friendly name of your plugin as ``plugin_name``. If the user is" |
| 298 |
" using an icon theme with icons for your plugin, they will be loaded " |
| 299 |
"preferentially." |
| 300 |
msgstr "Un wrapper per get_resources() che crea oggetti QIcon dai byte grezzi restituiti da get_resources. Se un nome non viene trovato nel file ZIP, la QIcon corrispondente sarà nulla. Per supportare la tematizzazione delle icone, passare il nome umano del plugin come ``plugin_name``. Se l'utente utilizza un tema di icone con icone per il plugin, queste verranno caricate in modo preferenziale." |
| 301 |
|
| 302 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:160 |
| 303 |
msgid "Enabling user configuration of your plugin" |
| 304 |
msgstr "Abilitazione della configurazione del plugin da parte dell'utente" |
| 305 |
|
| 306 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:162 |
| 307 |
msgid "" |
| 308 |
"To allow users to configure your plugin, you must define three methods in " |
| 309 |
"your base plugin class, **is_customizable**, **config_widget** and " |
| 310 |
"**save_settings** as shown below:" |
| 311 |
msgstr "Per consentire agli utenti di configurare il plugin, è necessario definire tre metodi nella classe base del plugin, **is_customizable**, **config_widget** e **save_settings**, come mostrato di seguito:" |
| 312 |
|
| 313 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:173 |
| 314 |
msgid "" |
| 315 |
"calibre has many different ways to store configuration data (a legacy of its" |
| 316 |
" long history). The recommended way is to use the **JSONConfig** class, " |
| 317 |
"which stores your configuration information in a .json file." |
| 318 |
msgstr "Calibre ha molti modi diversi per memorizzare i dati di configurazione (un'eredità della sua lunga storia). Il modo consigliato è quello di usare la classe **JSONConfig**, che memorizza le informazioni di configurazione in un file .json." |
| 319 |
|
| 320 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:175 |
| 321 |
msgid "" |
| 322 |
"The code to manage configuration data in the demo plugin is in config.py:" |
| 323 |
msgstr "Il codice per gestire i dati di configurazione nel plugin demo si trova in config.py:" |
| 324 |
|
| 325 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:180 |
| 326 |
msgid "" |
| 327 |
"The ``prefs`` object is now available throughout the plugin code by a " |
| 328 |
"simple::" |
| 329 |
msgstr "L'oggetto ``prefs'' è ora disponibile in tutto il codice del plugin tramite un semplice::" |
| 330 |
|
| 331 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:185 |
| 332 |
msgid "You can see the ``prefs`` object being used in main.py:" |
| 333 |
msgstr "Si può vedere l'oggetto ``prefs'' utilizzato in main.py:" |
| 334 |
|
| 335 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:192 |
| 336 |
msgid "Edit book plugins" |
| 337 |
msgstr "Modifica dei plugin del libro" |
| 338 |
|
| 339 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:194 |
| 340 |
msgid "" |
| 341 |
"Now let's change gears for a bit and look at creating a plugin to add tools " |
| 342 |
"to the calibre book editor. The plugin is available here: " |
| 343 |
":download_file:`editor_demo_plugin.zip`." |
| 344 |
msgstr "Ora cambiamo un po' marcia e vediamo di creare un plugin per aggiungere strumenti all'editor di libri di Calibre. Il plugin è disponibile qui: :download_file:`editor_demo_plugin.zip`." |
| 345 |
|
| 346 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:198 |
| 347 |
msgid "" |
| 348 |
"The first step, as for all plugins is to create the import name empty txt " |
| 349 |
"file, as described :ref:`above <import_name_txt>`. We shall name the file " |
| 350 |
"``plugin-import-name-editor_plugin_demo.txt``." |
| 351 |
msgstr "Il primo passo, come per tutti i plugin, è creare il file txt vuoto con il nome dell'importazione, come descritto :ref:` sopra<import_name_txt>. Chiameremo il file ``plugin-import-name-editor_plugin_demo.txt``." |
| 352 |
|
| 353 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:202 |
| 354 |
msgid "" |
| 355 |
"Now we create the mandatory ``__init__.py`` file that contains metadata " |
| 356 |
"about the plugin -- its name, author, version, etc." |
| 357 |
msgstr "Ora creiamo il file obbligatorio ``__init__.py`` che contiene i metadati sul plugin: il suo nome, l'autore, la versione, ecc." |
| 358 |
|
| 359 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:208 |
| 360 |
msgid "" |
| 361 |
"A single editor plugin can provide multiple tools each tool corresponds to a" |
| 362 |
" single button in the toolbar and entry in the :guilabel:`Plugins` menu in " |
| 363 |
"the editor. These can have sub-menus in case the tool has multiple related " |
| 364 |
"actions." |
| 365 |
msgstr "Un singolo plugin dell'editor può fornire più strumenti, ciascuno dei quali corrisponde a un singolo pulsante nella barra degli strumenti e a una voce nel menu :guilabel:`Plugins` dell'editor. Questi possono avere dei sottomenu nel caso in cui lo strumento abbia più azioni correlate." |
| 366 |
|
| 367 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:212 |
| 368 |
msgid "" |
| 369 |
"The tools must all be defined in the file ``main.py`` in your plugin. Every " |
| 370 |
"tool is a class that inherits from the " |
| 371 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at " |
| 372 |
"``main.py`` from the demo plugin, the source code is heavily commented and " |
| 373 |
"should be self-explanatory. Read the API documents of the " |
| 374 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class for more details." |
| 375 |
msgstr "Gli strumenti devono essere tutti definiti nel file ``main.py`` del plugin. Ogni strumento è una classe che eredita dalla classe :class:`calibre.gui2.tweak_book.plugin.Tool`. Diamo un'occhiata a ``main.py`` del plugin demo; il codice sorgente è pesantemente commentato e dovrebbe essere autoesplicativo. Per maggiori dettagli, leggete i documenti API della classe :class:`calibre.gui2.tweak_book.plugin.Tool`." |
| 376 |
|
| 377 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:222 |
| 378 |
msgid "" |
| 379 |
"Here we will see the definition of a single tool that will multiply all font" |
| 380 |
" sizes in the book by a number provided by the user. This tool demonstrates " |
| 381 |
"various important concepts that you will need in developing your own " |
| 382 |
"plugins, so you should read the (heavily commented) source code carefully." |
| 383 |
msgstr "Qui vedremo la definizione di un singolo strumento che moltiplica tutte le dimensioni dei caratteri del libro per un numero fornito dall'utente. Questo strumento dimostra vari concetti importanti che vi serviranno per sviluppare i vostri plugin, quindi dovreste leggere attentamente il codice sorgente (pesantemente commentato)." |
| 384 |
|
| 385 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:230 |
| 386 |
msgid "" |
| 387 |
"Let's break down ``main.py``. We see that it defines a single tool, named " |
| 388 |
"*Magnify fonts*. This tool will ask the user for a number and multiply all " |
| 389 |
"font sizes in the book by that number." |
| 390 |
msgstr "Analizziamo ``main.py``. Vediamo che definisce un singolo strumento, chiamato *Magnify fonts*. Questo strumento chiede all'utente un numero e moltiplica tutte le dimensioni dei caratteri nel libro per quel numero." |
| 391 |
|
| 392 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:234 |
| 393 |
msgid "" |
| 394 |
"The first important thing is the tool name which you must set to some " |
| 395 |
"relatively unique string as it will be used as the key for this tool." |
| 396 |
msgstr "La prima cosa importante è il nome dello strumento, che deve essere impostato con una stringa relativamente unica, in quanto verrà utilizzato come chiave per questo strumento." |
| 397 |
|
| 398 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:237 |
| 399 |
msgid "" |
| 400 |
"The next important entry point is the " |
| 401 |
":meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method " |
| 402 |
"creates the QAction objects that appear in the plugins toolbar and plugin " |
| 403 |
"menu. It also, optionally, assigns a keyboard shortcut that the user can " |
| 404 |
"customize. The triggered signal from the QAction is connected to the " |
| 405 |
"ask_user() method that asks the user for the font size multiplier, and then " |
| 406 |
"runs the magnification code." |
| 407 |
msgstr "Il prossimo punto di ingresso importante è il metodo :meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. Questo metodo crea gli oggetti QAction che appaiono nella barra degli strumenti e nel menu del plugin. Inoltre, opzionalmente, assegna una scorciatoia da tastiera che l'utente può personalizzare. Il segnale di attivazione della QAction è collegato al metodo ask_user() che chiede all'utente il moltiplicatore della dimensione del carattere e poi esegue il codice di ingrandimento." |
| 408 |
|
| 409 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:245 |
| 410 |
msgid "" |
| 411 |
"The magnification code is well commented and fairly simple. The main things " |
| 412 |
"to note are that you get a reference to the editor window as ``self.gui`` " |
| 413 |
"and the editor *Boss* as ``self.boss``. The *Boss* is the object that " |
| 414 |
"controls the editor user interface. It has many useful methods, that are " |
| 415 |
"documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class." |
| 416 |
msgstr "Il codice dell'ingrandimento è ben commentato e abbastanza semplice. Le cose principali da notare sono che si ottiene un riferimento alla finestra dell'editor come ``self.gui`` e all'editor *Boss* come ``self.boss``. Il *Boss* è l'oggetto che controlla l'interfaccia utente dell'editor. Ha molti metodi utili, documentati nella classe :class:`calibre.gui2.tweak_book.boss.Boss`." |
| 417 |
|
| 418 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:251 |
| 419 |
msgid "" |
| 420 |
"Finally, there is ``self.current_container`` which is a reference to the " |
| 421 |
"book being edited as a " |
| 422 |
":class:`calibre.ebooks.oeb.polish.container.Container` object. This " |
| 423 |
"represents the book as a collection of its constituent HTML/CSS/image files " |
| 424 |
"and has convenience methods for doing many useful things. The container " |
| 425 |
"object and various useful utility functions that can be reused in your " |
| 426 |
"plugin code are documented in :ref:`polish_api`." |
| 427 |
msgstr "Infine, c'è ``self.current_container`` che è un riferimento al libro che si sta editando come oggetto :class:`calibre.ebooks.oeb.polish.container.Container`. Questo rappresenta il libro come un insieme di file HTML/CSS/immagine che lo compongono e dispone di metodi di utilità per fare molte cose utili. L'oggetto container e le varie funzioni di utilità che possono essere riutilizzate nel codice del plugin sono documentate in :ref:`polish_api`." |
| 428 |
|
| 429 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:259 |
| 430 |
msgid "Adding translations to your plugin" |
| 431 |
msgstr "Aggiungi traduzione al tuo plugin" |
| 432 |
|
| 433 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:261 |
| 434 |
msgid "" |
| 435 |
"You can have all the user interface strings in your plugin translated and " |
| 436 |
"displayed in whatever language is set for the main calibre user interface." |
| 437 |
msgstr "È possibile far tradurre tutte le stringhe dell'interfaccia utente del plugin e visualizzarle nella lingua impostata per l'interfaccia utente principale di Calibre." |
| 438 |
|
| 439 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:264 |
| 440 |
msgid "" |
| 441 |
"The first step is to go through your plugin's source code and mark all user " |
| 442 |
"visible strings as translatable, by surrounding them in _(). For example::" |
| 443 |
msgstr "Il primo passo consiste nell'esaminare il codice sorgente del plugin e contrassegnare tutte le stringhe visibili dall'utente come traducibili, circondandole con _(). Ad esempio::" |
| 444 |
|
| 445 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:269 |
| 446 |
msgid "" |
| 447 |
"Then use some program to generate .po files from your plugin source code. " |
| 448 |
"There should be one .po file for every language you want to translate into. " |
| 449 |
"For example: de.po for German, fr.po for French and so on. You can use the " |
| 450 |
"`Poedit <https://poedit.net/>`_ program for this." |
| 451 |
msgstr "Quindi utilizzare un programma per generare file .po dal codice sorgente del plugin. Dovrebbe esserci un file .po per ogni lingua in cui si vuole tradurre. Per esempio: de.po per il tedesco, fr.po per il francese e così via. Si può usare il programma `Poedit <https://poedit.net/>`_ per questo." |
| 452 |
|
| 453 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:274 |
| 454 |
msgid "" |
| 455 |
"Send these .po files to your translators. Once you get them back, compile " |
| 456 |
"them into .mo files. You can again use Poedit for that, or just do::" |
| 457 |
msgstr "Inviate questi file .po ai vostri traduttori. Una volta ricevuti, compilateli in file .mo. A tale scopo si può usare Poedit o semplicemente fare::" |
| 458 |
|
| 459 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:279 |
| 460 |
msgid "Put the .mo files into the ``translations`` folder in your plugin." |
| 461 |
msgstr "Mettere i file .mo nella cartella ``translations`` del plugin." |
| 462 |
|
| 463 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:281 |
| 464 |
msgid "" |
| 465 |
"The last step is to simply call the function `load_translations()` at the " |
| 466 |
"top of your plugin's .py files. For performance reasons you should only call" |
| 467 |
" this function in those .py files that actually have translatable strings. " |
| 468 |
"So in a typical User Interface plugin you would call it at the top of " |
| 469 |
"``ui.py`` but not ``__init__.py``." |
| 470 |
msgstr "L'ultimo passo consiste nel chiamare la funzione `caricare_traduzioni()` all'inizio dei file .py del plugin. Per ragioni di prestazioni, si dovrebbe chiamare questa funzione solo nei file .py che hanno effettivamente stringhe traducibili. Quindi, in un tipico plugin di interfaccia utente, la si dovrebbe chiamare all'inizio di ``ui.py``, ma non di ``__init__.py``." |
| 471 |
|
| 472 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:287 |
| 473 |
msgid "" |
| 474 |
"You can test the translations of your plugins by changing the user interface" |
| 475 |
" language in calibre under :guilabel:`Preferences->Interface->Look & feel` " |
| 476 |
"or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment " |
| 477 |
"variable set. For example::" |
| 478 |
msgstr "È possibile verificare le traduzioni dei propri plugin cambiando la lingua dell'interfaccia utente in calibre sotto :guilabel:`Preferences->Interface->Look & feel` o eseguendo calibre con la variabile d'ambiente ``CALIBRE_OVERRIDE_LANG``. Per esempio::" |
| 479 |
|
| 480 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:293 |
| 481 |
msgid "" |
| 482 |
"Replace ``de`` with the language code of the language you want to test." |
| 483 |
msgstr "Sostituire ``de'' con il codice della lingua che si vuole testare." |
| 484 |
|
| 485 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:295 |
| 486 |
msgid "" |
| 487 |
"For translations with plurals, use the ``ngettext()`` function instead of " |
| 488 |
"``_()``. For example::" |
| 489 |
msgstr "Per le traduzioni con i plurali, utilizzare la funzione ``ngettext()`` invece di ``_()``. Ad esempio::" |
| 490 |
|
| 491 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:301 |
| 492 |
msgid "The plugin API" |
| 493 |
msgstr "API del plugin" |
| 494 |
|
| 495 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:303 |
| 496 |
msgid "" |
| 497 |
"As you may have noticed above, a plugin in calibre is a class. There are " |
| 498 |
"different classes for the different types of plugins in calibre. Details on " |
| 499 |
"each class, including the base class of all plugins can be found in " |
| 500 |
":ref:`plugins`." |
| 501 |
msgstr "Come avrete notato sopra, un plugin in Calibre è una classe. Esistono diverse classi per i diversi tipi di plugin in Calibre. I dettagli su ciascuna classe, compresa la classe base di tutti i plugin, si trovano in :ref:`plugins`." |
| 502 |
|
| 503 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:306 |
| 504 |
msgid "" |
| 505 |
"Your plugin is almost certainly going to use code from calibre. To learn how" |
| 506 |
" to find various bits of functionality in the calibre code base, read the " |
| 507 |
"section on the calibre :ref:`code_layout`." |
| 508 |
msgstr "Il vostro plugin utilizzerà quasi certamente del codice di Calibre. Per sapere come trovare varie funzionalità nella base di codice di Calibre, leggere la sezione sul :ref:`code_layout` di Calibre." |
| 509 |
|
| 510 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:311 |
| 511 |
msgid "Debugging plugins" |
| 512 |
msgstr "Debug dei plugin" |
| 513 |
|
| 514 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:313 |
| 515 |
msgid "" |
| 516 |
"The first, most important step is to run calibre in debug mode. You can do " |
| 517 |
"this from the command line with::" |
| 518 |
msgstr "Il primo passo, il più importante, è quello di eseguire Calibre in modalità debug. È possibile farlo dalla riga di comando con::" |
| 519 |
|
| 520 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:317 |
| 521 |
msgid "" |
| 522 |
"Or from within calibre by right-clicking the :guilabel:`Preferences` button " |
| 523 |
"or using the :kbd:`Ctrl+Shift+R` keyboard shortcut." |
| 524 |
msgstr "Oppure dall'interno di Calibre facendo clic con il tasto destro del mouse sul pulsante :guilabel:`Preferences` o usando la scorciatoia da tastiera :kbd:`Ctrl+Shift+R`." |
| 525 |
|
| 526 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:319 |
| 527 |
msgid "" |
| 528 |
"When running from the command line, debug output will be printed to the " |
| 529 |
"console, when running from within calibre the output will go to a txt file." |
| 530 |
msgstr "Quando si esegue dalla riga di comando, l'output di debug viene stampato sulla console, mentre quando si esegue dall'interno di Calibre l'output viene inviato a un file txt." |
| 531 |
|
| 532 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:321 |
| 533 |
msgid "" |
| 534 |
"You can insert print statements anywhere in your plugin code, they will be " |
| 535 |
"output in debug mode. Remember, this is Python, you really shouldn't need " |
| 536 |
"anything more than print statements to debug ;) I developed all of calibre " |
| 537 |
"using just this debugging technique." |
| 538 |
msgstr "Si possono inserire dichiarazioni di stampa in qualsiasi punto del codice del plugin, che verranno emesse in modalità di debug. Ricordate, questo è Python, non dovrebbe essere necessario altro che dichiarazioni di stampa per il debug ;) Ho sviluppato tutto Calibre utilizzando proprio questa tecnica di debug." |
| 539 |
|
| 540 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:323 |
| 541 |
msgid "" |
| 542 |
"You can quickly test changes to your plugin by using the following command " |
| 543 |
"line::" |
| 544 |
msgstr "È possibile testare rapidamente le modifiche apportate al plugin utilizzando la seguente riga di comando::" |
| 545 |
|
| 546 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:328 |
| 547 |
msgid "" |
| 548 |
"This will shutdown a running calibre, wait for the shutdown to complete, " |
| 549 |
"then update your plugin in calibre and relaunch calibre." |
| 550 |
msgstr "In questo modo si spegne un Calibre in esecuzione, si attende il completamento dello spegnimento, quindi si aggiorna il plugin in Calibre e si rilancia Calibre." |
| 551 |
|
| 552 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:331 |
| 553 |
msgid "More plugin examples" |
| 554 |
msgstr "Più esempi di plugin" |
| 555 |
|
| 556 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:333 |
| 557 |
msgid "" |
| 558 |
"You can find a list of many sophisticated calibre plugins `here " |
| 559 |
"<https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 560 |
msgstr "È possibile trovare un elenco di molti sofisticati plugin di Calibre `qui <https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 561 |
|
| 562 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:336 |
| 563 |
msgid "Sharing your plugins with others" |
| 564 |
msgstr "Condividi i tuoi plugin con gli altri" |
| 565 |
|
| 566 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:338 |
| 567 |
msgid "" |
| 568 |
"If you would like to share the plugins you have created with other users of " |
| 569 |
"calibre, post your plugin in a new thread in the `calibre plugins forum " |
| 570 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |
| 571 |
msgstr "Se vuoi condividere i plugin che hai creato con altri utenti di Calibre, posta il tuo plugin in un nuovo thread nel `calibre plugins forum <https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |