| 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 |
# Anders Jonsson <[email protected]>, 2022 |
| 7 |
# efef6ec5b435a041fce803c7f8af77d2_2341d43, 2018,2020 |
| 8 |
# efef6ec5b435a041fce803c7f8af77d2_2341d43, 2020 |
| 9 |
# Jonatan Nyberg, 2026 |
| 10 |
# Jonatan Nyberg, 2016-2017,2021-2026 |
| 11 |
# Jonatan Nyberg, 2018-2021 |
| 12 |
# efef6ec5b435a041fce803c7f8af77d2_2341d43, 2018 |
| 13 |
# Jonatan Nyberg, 2026 |
| 14 |
# Merarom <[email protected]>, 2014-2015,2017 |
| 15 |
msgid "" |
| 16 |
msgstr "" |
| 17 |
"Project-Id-Version: calibre\n" |
| 18 |
"Report-Msgid-Bugs-To: \n" |
| 19 |
"POT-Creation-Date: 2026-07-30 18:07+0000\n" |
| 20 |
"PO-Revision-Date: 2014-06-17 08:35+0000\n" |
| 21 |
"Last-Translator: Jonatan Nyberg, 2026\n" |
| 22 |
"Language-Team: Swedish (http://app.transifex.com/calibre/calibre/language/sv/)\n" |
| 23 |
"MIME-Version: 1.0\n" |
| 24 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 25 |
"Content-Transfer-Encoding: 8bit\n" |
| 26 |
"Language: sv\n" |
| 27 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
| 28 |
|
| 29 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:4 |
| 30 |
msgid "Writing your own plugins to extend calibre's functionality" |
| 31 |
msgstr "Skriv dina egna insticksmoduler för att utöka calibres funktionalitet" |
| 32 |
|
| 33 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:6 |
| 34 |
msgid "" |
| 35 |
"calibre has a very modular design. Almost all functionality in calibre comes" |
| 36 |
" in the form of plugins. Plugins are used for conversion, for downloading " |
| 37 |
"news (though these are called recipes), for various components of the user " |
| 38 |
"interface, to connect to different devices, to process files when adding " |
| 39 |
"them to calibre and so on. You can get a complete list of all the built-in " |
| 40 |
"plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`." |
| 41 |
msgstr "calibre är en väldigt modulär konstruktion. Nästan alla funktioner i calibre kommer i form av insticksmoduler. Insticksmoduler används för konvertering, för hämtning av nyheter (även om dessa kallas för recept), för diverse komponenter av användargränssnitt, för anslutning av olika enheter, för bearbetning av filer när de läggs till calibre och så vidare. Du kan få en komplett lista med alla inbyggda insticksmoduler i calibre genom att gå till :guilabel:`Inställningar->Avancerat->Insticksmoduler`." |
| 42 |
|
| 43 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:8 |
| 44 |
msgid "" |
| 45 |
"Here, we will teach you how to create your own plugins to add new features " |
| 46 |
"to calibre." |
| 47 |
msgstr "Här kommer vi att lära dig att skapa dina egna insticksmoduler för att lägga till nya funktioner i calibre." |
| 48 |
|
| 49 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:13 |
| 50 |
msgid "Contents" |
| 51 |
msgstr "Innehåll" |
| 52 |
|
| 53 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:15 |
| 54 |
msgid "This only applies to calibre releases >= 0.8.60" |
| 55 |
msgstr "Detta gäller bara calibre-utgåvor >= 0.8.60" |
| 56 |
|
| 57 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:18 |
| 58 |
msgid "Anatomy of a calibre plugin" |
| 59 |
msgstr "Anatomi av en calibre-insticksmodul" |
| 60 |
|
| 61 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:20 |
| 62 |
msgid "" |
| 63 |
"A calibre plugin is very simple, it's just a ZIP file that contains some " |
| 64 |
"Python code and any other resources like image files needed by the plugin. " |
| 65 |
"Without further ado, let's see a basic example." |
| 66 |
msgstr "En calibre-insticksmodul är väldigt enkel, det är bara en ZIP-fil som innehåller lite Python-kod och andra resurser som bildfiler som behövs av insticksmodulen. Utan vidare, låt oss se ett grundläggande exempel." |
| 67 |
|
| 68 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:24 |
| 69 |
msgid "" |
| 70 |
"Suppose you have an installation of calibre that you are using to self " |
| 71 |
"publish various e-documents in EPUB and MOBI formats. You would like all " |
| 72 |
"files generated by calibre to have their publisher set as \"Hello world\", " |
| 73 |
"here's how to do it. Create a file named :file:`__init__.py` (this is a " |
| 74 |
"special name and must always be used for the main file of your plugin) and " |
| 75 |
"enter the following Python code into it:" |
| 76 |
msgstr "Anta att du har en installation av calibre som du använder för att själv publicera olika e-dokument i EPUB- och MOBI-format. Du vill att alla filer som genereras av calibre har förläggaren inställd som \"Hej världen\", här är hur man gör det. Skapa en fil med namnet :file:`__init__.py` (detta är ett speciellt namn och ska alltid användas för huvudfilen för din insticksmodul) och ange följande Python-kod i den:" |
| 77 |
|
| 78 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:32 |
| 79 |
msgid "" |
| 80 |
"That's all. To add this code to calibre as a plugin, simply run the " |
| 81 |
"following in the folder in which you created :file:`__init__.py`::" |
| 82 |
msgstr "Det är allt. För att lägga till den här koden i calibre som en insticksmodul, kör helt enkelt följande i mappen där du skapade :file:`__init__.py`::" |
| 83 |
|
| 84 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:38 |
| 85 |
msgid "" |
| 86 |
"On macOS, the command line tools are inside the calibre bundle, for example," |
| 87 |
" if you installed calibre in :file:`/Applications` the command line tools " |
| 88 |
"are in :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 89 |
msgstr "I macOS finns kommandoradsverktygen inuti calibre paketet, till exempel om du installerade calibre i :file:`/Applications` kommandoradsverktygen finns i :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 90 |
|
| 91 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:42 |
| 92 |
msgid "" |
| 93 |
"You can download the Hello World plugin from " |
| 94 |
":download_file:`helloworld_plugin.zip`." |
| 95 |
msgstr "Du kan hämta insticksmodulen Hello World från :download_file:`helloworld_plugin.zip`." |
| 96 |
|
| 97 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:45 |
| 98 |
msgid "" |
| 99 |
"Every time you use calibre to convert a book, the plugin's :meth:`run` " |
| 100 |
"method will be called and the converted book will have its publisher set to " |
| 101 |
"\"Hello World\". This is a trivial plugin, let's move on to a more complex " |
| 102 |
"example that actually adds a component to the user interface." |
| 103 |
msgstr "Varje gång du använder calibre för att konvertera en bok, kommer plugin-programmets :meth:`run`-metod att anropas och den konverterade boken kommer att ha sin utgivare inställd på \"Hello World\". Detta är ett trivialt plugin, låt oss gå vidare till ett mer komplext exempel som faktiskt lägger till en komponent i användargränssnittet." |
| 104 |
|
| 105 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:50 |
| 106 |
msgid "A User Interface plugin" |
| 107 |
msgstr "En användargränssnitts insticksmodul" |
| 108 |
|
| 109 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:52 |
| 110 |
msgid "" |
| 111 |
"This plugin will be spread over a few files (to keep the code clean). It " |
| 112 |
"will show you how to get resources (images or data files) from the plugin " |
| 113 |
"ZIP file, allow users to configure your plugin, how to create elements in " |
| 114 |
"the calibre user interface and how to access and query the books database in" |
| 115 |
" calibre." |
| 116 |
msgstr "Denna insticksmodul kommer att spridas över några filer (för att hålla koden ren). Den kommer att visa dig hur du får resurser (bilder eller datafiler) från insticksmodulens ZIP-fil, tillåter användare att anpassa din insticksmodul, hur man skapar element i calibre-användargränssnittet och hur man får åtkomst till och söker i bokdatabasen i calibre." |
| 117 |
|
| 118 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:57 |
| 119 |
msgid "" |
| 120 |
"You can download this plugin from :download_file:`interface_demo_plugin.zip`" |
| 121 |
msgstr "Du kan hämta denna insticksmodul från :download_file:`interface_demo_plugin.zip`" |
| 122 |
|
| 123 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:61 |
| 124 |
msgid "" |
| 125 |
"The first thing to note is that this ZIP file has a lot more files in it, " |
| 126 |
"explained below, pay particular attention to ``plugin-import-name-" |
| 127 |
"interface_demo.txt``." |
| 128 |
msgstr "Det första att observera är att denna ZIP-filen har många fler filer i sig, som förklaras nedan, ta särskild hänsyn till ``plugin-import-name-interface_demo.txt``." |
| 129 |
|
| 130 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:64 |
| 131 |
msgid "**plugin-import-name-interface_demo.txt**" |
| 132 |
msgstr "**plugin-import-name-interface_demo.txt**" |
| 133 |
|
| 134 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:65 |
| 135 |
msgid "" |
| 136 |
"An empty text file used to enable the multi-file plugin magic. This file " |
| 137 |
"must be present in all plugins that use more than one .py file. It should be" |
| 138 |
" empty and its filename must be of the form: ``plugin-import-" |
| 139 |
"name-**some_name**.txt``. The presence of this file allows you to import " |
| 140 |
"code from the .py files present inside the ZIP file, using a statement " |
| 141 |
"like::" |
| 142 |
msgstr "En tom textfil som används för att aktivera insticksmodulsmagin för flera filer. Den här filen måste finnas i alla insticksmoduler som använder mer än en .py-fil. Den ska vara tom och filnamnet måste ha formen: ``plugin-import-name-**some_name**.txt``. Förekomsten av den här filen låter dig importera kod från .py-filerna som finns i ZIP-filen med en sats som::" |
| 143 |
|
| 144 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:71 |
| 145 |
msgid "" |
| 146 |
"The prefix ``calibre_plugins`` must always be present. ``some_name`` comes " |
| 147 |
"from the filename of the empty text file. ``some_module`` refers to " |
| 148 |
":file:`some_module.py` file inside the ZIP file. Note that this importing is" |
| 149 |
" just as powerful as regular Python imports. You can create packages and " |
| 150 |
"subpackages of .py modules inside the ZIP file, just like you would normally" |
| 151 |
" (by defining __init__.py in each sub-folder), and everything should \"just " |
| 152 |
"work\"." |
| 153 |
msgstr "Prefixet ``calibre_plugins`` måste alltid finnas. ``some_name`` kommer från filnamnet på den tomma textfilen. ``some_module`` refererar till :file:`some_module.py`-filen inuti ZIP-filen. Observera att denna import är lika kraftfull som vanlig Python-import. Du kan skapa paket och underpaket av .py-moduler inuti ZIP-filen, precis som du normalt skulle göra (genom att definiera __init__.py i varje undermapp), och allt borde \"bara fungera\"." |
| 154 |
|
| 155 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:76 |
| 156 |
msgid "" |
| 157 |
"The name you use for ``some_name`` enters a global namespace shared by all " |
| 158 |
"plugins, **so make it as unique as possible**. But remember that it must be " |
| 159 |
"a valid Python identifier (only alphabets, numbers and the underscore)." |
| 160 |
msgstr "Namnet du använda för ``some_name`` går in i en globala namnrymden delas av alla insticksmodul, **så gör det så unikt som möjligt**. Men kom ihåg att det måste vara en giltigt Python-identifierare (endast alfabet, siffror och understreck)." |
| 161 |
|
| 162 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:79 |
| 163 |
msgid "**__init__.py**" |
| 164 |
msgstr "**__init__.py**" |
| 165 |
|
| 166 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:80 |
| 167 |
msgid "As before, the file that defines the plugin class" |
| 168 |
msgstr "Som tidigare, filen som definierar insticksmodulsklassen" |
| 169 |
|
| 170 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:82 |
| 171 |
msgid "**main.py**" |
| 172 |
msgstr "**main.py**" |
| 173 |
|
| 174 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:83 |
| 175 |
msgid "This file contains the actual code that does something useful" |
| 176 |
msgstr "Den här filen innehåller den faktiska koden som gör något användbart" |
| 177 |
|
| 178 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:85 |
| 179 |
msgid "**ui.py**" |
| 180 |
msgstr "**ui.py**" |
| 181 |
|
| 182 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:86 |
| 183 |
msgid "This file defines the interface part of the plugin" |
| 184 |
msgstr "Denna fil definierar gränssnittsdelen av insticksmodulen" |
| 185 |
|
| 186 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:88 |
| 187 |
msgid "**images/icon.png**" |
| 188 |
msgstr "**bilder/ikon.png**" |
| 189 |
|
| 190 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:89 |
| 191 |
msgid "The icon for this plugin" |
| 192 |
msgstr "Ikonen för denna insticksmodul" |
| 193 |
|
| 194 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:91 |
| 195 |
msgid "**about.txt**" |
| 196 |
msgstr "**about.txt**" |
| 197 |
|
| 198 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:92 |
| 199 |
msgid "A text file with information about the plugin" |
| 200 |
msgstr "En textfil med information om insticksmodulen" |
| 201 |
|
| 202 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:94 |
| 203 |
msgid "**translations**" |
| 204 |
msgstr "**översättningar**" |
| 205 |
|
| 206 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:95 |
| 207 |
msgid "" |
| 208 |
"A folder containing .mo files with the translations of the user interface of" |
| 209 |
" your plugin into different languages. See below for details." |
| 210 |
msgstr "En mapp innehåller .mo-filer med översättningar av användargränssnittet av din insticksmodul till olika språk. Se nedan för detaljer." |
| 211 |
|
| 212 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:99 |
| 213 |
msgid "Now let's look at the code." |
| 214 |
msgstr "Låt oss nu titta på koden." |
| 215 |
|
| 216 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:102 |
| 217 |
msgid "__init__.py" |
| 218 |
msgstr "__init__.py" |
| 219 |
|
| 220 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:104 |
| 221 |
msgid "First, the obligatory ``__init__.py`` to define the plugin metadata:" |
| 222 |
msgstr "Först det obligatoriska ``__init__.py`` för att definiera insticksmodulens metadata:" |
| 223 |
|
| 224 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:109 |
| 225 |
msgid "" |
| 226 |
"The only noteworthy feature is the field :attr:`actual_plugin`. Since " |
| 227 |
"calibre has both command line and GUI interfaces, GUI plugins like this one " |
| 228 |
"should not load any GUI libraries in __init__.py. The actual_plugin field " |
| 229 |
"does this for you, by telling calibre that the actual plugin is to be found " |
| 230 |
"in another file inside your ZIP archive, which will only be loaded in a GUI " |
| 231 |
"context." |
| 232 |
msgstr "Den enda anmärkningsvärda funktionen är fältet :attr:`actual_plugin`. Eftersom calibre har både ett kommandoradsgränssnitt och ett grafiskt gränssnitt bör GUI-insticksmoduler som denna inte läsa in några GUI-bibliotek i __init__.py. Fältet actual_plugin hanterar detta genom att tala om för calibre att den egentliga insticksmodulen finns i en annan fil i ZIP-arkivet. Den filen läses endast in i ett GUI-sammanhang." |
| 233 |
|
| 234 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:114 |
| 235 |
msgid "" |
| 236 |
"Remember that for this to work, you must have a plugin-import-name-" |
| 237 |
"some_name.txt file in your plugin ZIP file, as discussed above." |
| 238 |
msgstr "Kom ihåg att för att detta ska fungera måste du ha en plugin-import-name-some_name.txt fil i din insticksmoduls ZIP-fil, som diskuterats ovan." |
| 239 |
|
| 240 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:117 |
| 241 |
msgid "" |
| 242 |
"Also there are a couple of methods for enabling user configuration of the " |
| 243 |
"plugin. These are discussed below." |
| 244 |
msgstr "Också finns det ett par olika metoder för att möjliggöra användarkonfiguration av insticksmodulen. Dessa diskuteras nedan." |
| 245 |
|
| 246 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:120 |
| 247 |
msgid "ui.py" |
| 248 |
msgstr "ui.py" |
| 249 |
|
| 250 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:122 |
| 251 |
msgid "" |
| 252 |
"Now let's look at ui.py which defines the actual GUI plugin. The source code" |
| 253 |
" is heavily commented and should be self explanatory:" |
| 254 |
msgstr "Låt oss nu titta på ui.py som definierar själva användargränssnitts insticksmodul. Källkoden är kraftigt kommenterade och bör vara självförklarande:" |
| 255 |
|
| 256 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:128 |
| 257 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:220 |
| 258 |
msgid "main.py" |
| 259 |
msgstr "main.py" |
| 260 |
|
| 261 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:130 |
| 262 |
msgid "The actual logic to implement the Interface Plugin Demo dialog." |
| 263 |
msgstr "Den faktiska logiken för att implementera dialogrutan insticksmodulsdemo för gränssnittet." |
| 264 |
|
| 265 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:136 |
| 266 |
msgid "Getting resources from the plugin ZIP file" |
| 267 |
msgstr "Få resurser från insticksmodulens ZIP-fil" |
| 268 |
|
| 269 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:138 |
| 270 |
msgid "" |
| 271 |
"calibre's plugin loading system defines a couple of built-in functions that " |
| 272 |
"allow you to conveniently get files from the plugin ZIP file." |
| 273 |
msgstr "calibres insticksmodulsladdningssystem definierar ett par inbyggda funktioner som gör att du bekvämt kan hämta filer från insticksmodulens ZIP-fil." |
| 274 |
|
| 275 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:140 |
| 276 |
msgid "**get_resources(name_or_list_of_names)**" |
| 277 |
msgstr "**get_resources(name_or_list_of_names)**" |
| 278 |
|
| 279 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:141 |
| 280 |
msgid "" |
| 281 |
"This function should be called with a list of paths to files inside the ZIP " |
| 282 |
"file. For example to access the file :file:`icon.png` in the folder images " |
| 283 |
"in the ZIP file, you would use: ``images/icon.png``. Always use a forward " |
| 284 |
"slash as the path separator, even on Windows. When you pass in a single " |
| 285 |
"name, the function will return the raw bytes of that file or None if the " |
| 286 |
"name was not found in the ZIP file. If you pass in more than one name then " |
| 287 |
"it returns a dictionary mapping the names to bytes. If a name is not found," |
| 288 |
" it will not be present in the returned dictionary." |
| 289 |
msgstr "Den här funktionen bör anropas med en lista av sökvägar till filer i ZIP-filen. Till exempel för att komma åt filen :file:`icon.png` i mappbilderna i ZIP-filen, skulle du använda: ``images/icon.png``. Använd alltid ett framåt snedstreck som sökvägsavskiljare, även i Windows. När du anger ett enda namn kommer funktionen att returnera råa byte för filen eller None om namnet inte hittades i ZIP-filen. Om du anger mer än ett namn så returneras en ordbok som mappar namnen till byte. Om ett namn inte hittas kommer det inte att finnas i den returnerade ordboken." |
| 290 |
|
| 291 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:150 |
| 292 |
msgid "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 293 |
msgstr "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 294 |
|
| 295 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:151 |
| 296 |
msgid "" |
| 297 |
"A wrapper for get_resources() that creates QIcon objects from the raw bytes " |
| 298 |
"returned by get_resources. If a name is not found in the ZIP file the " |
| 299 |
"corresponding QIcon will be null. In order to support icon theme-ing, pass " |
| 300 |
"in the human friendly name of your plugin as ``plugin_name``. If the user is" |
| 301 |
" using an icon theme with icons for your plugin, they will be loaded " |
| 302 |
"preferentially." |
| 303 |
msgstr "En wrapper för get_resources() som skapar QIcon-objekt från de råbyte som returneras av get_resources. Om ett namn inte hittas i ZIP-filen kommer motsvarande QIcon att vara null. För att stödja ikontema, skicka in det människovänliga namnet på din insticksmodul som ``plugin_name``. Om användaren använder ett ikontema med ikoner för din insticksmodul, kommer de att läsas in med företräde." |
| 304 |
|
| 305 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:160 |
| 306 |
msgid "Enabling user configuration of your plugin" |
| 307 |
msgstr "Aktivera användarkonfiguration för din insticksmodul" |
| 308 |
|
| 309 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:162 |
| 310 |
msgid "" |
| 311 |
"To allow users to configure your plugin, you must define three methods in " |
| 312 |
"your base plugin class, **is_customizable**, **config_widget** and " |
| 313 |
"**save_settings** as shown below:" |
| 314 |
msgstr "För att tillåta användare att anpassa din insticksmodul måste du definiera tre metoder i din bas insticksmodulsklass, **is_customizable**, **config_widget** och **save_settings** enligt nedan:" |
| 315 |
|
| 316 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:173 |
| 317 |
msgid "" |
| 318 |
"calibre has many different ways to store configuration data (a legacy of its" |
| 319 |
" long history). The recommended way is to use the **JSONConfig** class, " |
| 320 |
"which stores your configuration information in a .json file." |
| 321 |
msgstr "calibre har många olika sätt att lagra konfigurationsdata (ett arv av sin långa historia). Det rekommenderade sättet är att använda **JSONConfig** klass, som lagrar din konfigurationsinformation i en .json-fil." |
| 322 |
|
| 323 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:175 |
| 324 |
msgid "" |
| 325 |
"The code to manage configuration data in the demo plugin is in config.py:" |
| 326 |
msgstr "Koden för att hantera konfigurationsdata i demo-insticksmodulen finns i config.py:" |
| 327 |
|
| 328 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:180 |
| 329 |
msgid "" |
| 330 |
"The ``prefs`` object is now available throughout the plugin code by a " |
| 331 |
"simple::" |
| 332 |
msgstr "``prefs``-objekt äret nu tillgängligt i hela insticksmodulskoden med en enkel::" |
| 333 |
|
| 334 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:185 |
| 335 |
msgid "You can see the ``prefs`` object being used in main.py:" |
| 336 |
msgstr "Du kan se ``prefs``-objekt som används i main.py:" |
| 337 |
|
| 338 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:192 |
| 339 |
msgid "Edit book plugins" |
| 340 |
msgstr "Redigera bokinsticksmodul" |
| 341 |
|
| 342 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:194 |
| 343 |
msgid "" |
| 344 |
"Now let's change gears for a bit and look at creating a plugin to add tools " |
| 345 |
"to the calibre book editor. The plugin is available here: " |
| 346 |
":download_file:`editor_demo_plugin.zip`." |
| 347 |
msgstr "Låt oss nu byta växel för ett tag och se hur man skapar en insticksmodul för att lägga till verktyg till calibres bokredigerare. Instickmodulen finns här: :download_file:`editor_demo_plugin.zip`." |
| 348 |
|
| 349 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:198 |
| 350 |
msgid "" |
| 351 |
"The first step, as for all plugins is to create the import name empty txt " |
| 352 |
"file, as described :ref:`above <import_name_txt>`. We shall name the file " |
| 353 |
"``plugin-import-name-editor_plugin_demo.txt``." |
| 354 |
msgstr "Det första steget, som för alla insticksmodul är att skapa importnamnet tom TXT-fil, som beskrivs :ref:`ovan <import_name_txt>`. Vi ska namnge filen ``plugin-import-name-editor_plugin_demo.txt``." |
| 355 |
|
| 356 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:202 |
| 357 |
msgid "" |
| 358 |
"Now we create the mandatory ``__init__.py`` file that contains metadata " |
| 359 |
"about the plugin -- its name, author, version, etc." |
| 360 |
msgstr "Nu skapar vi den obligatoriska ``__init__.py`` filen som innehåller metadata om insticksmodulen -- dess namn, utvecklare, version etc." |
| 361 |
|
| 362 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:208 |
| 363 |
msgid "" |
| 364 |
"A single editor plugin can provide multiple tools each tool corresponds to a" |
| 365 |
" single button in the toolbar and entry in the :guilabel:`Plugins` menu in " |
| 366 |
"the editor. These can have sub-menus in case the tool has multiple related " |
| 367 |
"actions." |
| 368 |
msgstr "En enda insticksmodul redigerare kan ge flera verktyg varje verktyg motsvarar en knapp i verktygsfältet och posten i :guilabel:`Insticksmoduler`-menyn i redigeraren. Dessa kan ha undermenyer om verktyget har flera relaterade åtgärder." |
| 369 |
|
| 370 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:212 |
| 371 |
msgid "" |
| 372 |
"The tools must all be defined in the file ``main.py`` in your plugin. Every " |
| 373 |
"tool is a class that inherits from the " |
| 374 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at " |
| 375 |
"``main.py`` from the demo plugin, the source code is heavily commented and " |
| 376 |
"should be self-explanatory. Read the API documents of the " |
| 377 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class for more details." |
| 378 |
msgstr "Verktygen bör definieras i filen ``main.py`` i din insticksmodul. Varje verktyg är en klass som ärvs från klassen :class:`calibre.gui2.tweak_book.plugin.Tool`. Låt oss titta på ``main.py`` från demo-insticksmodulen, källkoden är tungt kommenterade och bör vara självförklarande. Läs API-dokumenten av klassen :class:`calibre.gui2.tweak_book.plugin.Tool` för mer detaljer." |
| 379 |
|
| 380 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:222 |
| 381 |
msgid "" |
| 382 |
"Here we will see the definition of a single tool that will multiply all font" |
| 383 |
" sizes in the book by a number provided by the user. This tool demonstrates " |
| 384 |
"various important concepts that you will need in developing your own " |
| 385 |
"plugins, so you should read the (heavily commented) source code carefully." |
| 386 |
msgstr "Här definierar vi ett verktyg som multiplicerar alla teckensnittsstorlekar i boken med ett tal som användaren anger. Verktyget visar flera viktiga begrepp som du behöver när du utvecklar egna insticksmoduler, så läs den utförligt kommenterade källkoden noggrant." |
| 387 |
|
| 388 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:230 |
| 389 |
msgid "" |
| 390 |
"Let's break down ``main.py``. We see that it defines a single tool, named " |
| 391 |
"*Magnify fonts*. This tool will ask the user for a number and multiply all " |
| 392 |
"font sizes in the book by that number." |
| 393 |
msgstr "Låt oss bryta ner ``main.py``. Vi ser att den definierar ett enda verktyg, som heter *Förstora teckensnitt*. Detta verktyg kommer att be användaren om ett nummer och multiplicera alla teckensnittsstorlekar i boken med det numret." |
| 394 |
|
| 395 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:234 |
| 396 |
msgid "" |
| 397 |
"The first important thing is the tool name which you must set to some " |
| 398 |
"relatively unique string as it will be used as the key for this tool." |
| 399 |
msgstr "Det första viktiga är verktygsnamnet som du måste ställa in till någon relativt unik sträng eftersom det kommer att användas som nyckel för detta verktyg." |
| 400 |
|
| 401 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:237 |
| 402 |
msgid "" |
| 403 |
"The next important entry point is the " |
| 404 |
":meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method " |
| 405 |
"creates the QAction objects that appear in the plugins toolbar and plugin " |
| 406 |
"menu. It also, optionally, assigns a keyboard shortcut that the user can " |
| 407 |
"customize. The triggered signal from the QAction is connected to the " |
| 408 |
"ask_user() method that asks the user for the font size multiplier, and then " |
| 409 |
"runs the magnification code." |
| 410 |
msgstr "Nästa viktiga startpunkt är :meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. Denna metod skapar QAction-objekt som visas i insticksmodulsverktygsfältet och insticksmodulsmenyn. Den tilldelar också valfritt en kortkommando som användaren kan skräddarsy. Den utlösta signalen från QAction är ansluten till metoden ask_user() som frågar användaren om teckensnittsstorlekensmultiplikatorn och sedan kör förstoringskoden." |
| 411 |
|
| 412 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:245 |
| 413 |
msgid "" |
| 414 |
"The magnification code is well commented and fairly simple. The main things " |
| 415 |
"to note are that you get a reference to the editor window as ``self.gui`` " |
| 416 |
"and the editor *Boss* as ``self.boss``. The *Boss* is the object that " |
| 417 |
"controls the editor user interface. It has many useful methods, that are " |
| 418 |
"documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class." |
| 419 |
msgstr "Förstoringskoden är väl kommenterad och ganska enkel. De viktigaste sakerna att observera är att du får en referens till redigeringsfönstret som ``self.gui`` och redigeraren *Boss* som ``self.boss``. *Boss* är objektet som styr redigerarens användargränssnitt. Den har många användbara metoder, som dokumenteras klassen i :class:`calibre.gui2.tweak_book.boss.Boss`." |
| 420 |
|
| 421 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:251 |
| 422 |
msgid "" |
| 423 |
"Finally, there is ``self.current_container`` which is a reference to the " |
| 424 |
"book being edited as a " |
| 425 |
":class:`calibre.ebooks.oeb.polish.container.Container` object. This " |
| 426 |
"represents the book as a collection of its constituent HTML/CSS/image files " |
| 427 |
"and has convenience methods for doing many useful things. The container " |
| 428 |
"object and various useful utility functions that can be reused in your " |
| 429 |
"plugin code are documented in :ref:`polish_api`." |
| 430 |
msgstr "Slutligen finns det ``self.current_container`` som är en referens till boken som redigeras som :class:`calibre.ebooks.oeb.polish.container.Container` objekt. Detta representerar boken som en samling av sina konstituerande HTML/CSS/bildfiler och har bekvämliga metoder för att göra många användbara saker. Objektbehållaren och olika användbara nyttofunktioner som kan återanvändas i din insticksmodulskod är dokumenterade i :ref:`polish_api`." |
| 431 |
|
| 432 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:259 |
| 433 |
msgid "Adding translations to your plugin" |
| 434 |
msgstr "Lägga till översättningar till din insticksmodul" |
| 435 |
|
| 436 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:261 |
| 437 |
msgid "" |
| 438 |
"You can have all the user interface strings in your plugin translated and " |
| 439 |
"displayed in whatever language is set for the main calibre user interface." |
| 440 |
msgstr "Du kan ha alla användargränssnittsträngar i din insticksmodul översatta och visas på vilket språk som är inställt för huvudanvändargränssnittet i calibre." |
| 441 |
|
| 442 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:264 |
| 443 |
msgid "" |
| 444 |
"The first step is to go through your plugin's source code and mark all user " |
| 445 |
"visible strings as translatable, by surrounding them in _(). For example::" |
| 446 |
msgstr "Det första steget är att gå igenom din insticksmoduls källkod och markera alla användarsynliga strängar som översättningsbara, genom att omge dem _(). Till exempel::" |
| 447 |
|
| 448 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:269 |
| 449 |
msgid "" |
| 450 |
"Then use some program to generate .po files from your plugin source code. " |
| 451 |
"There should be one .po file for every language you want to translate into. " |
| 452 |
"For example: de.po for German, fr.po for French and so on. You can use the " |
| 453 |
"`Poedit <https://poedit.net/>`_ program for this." |
| 454 |
msgstr "Använd sedan något program för att skapa .po-filer från din insticksmodulskällkod. Det bör finnas en .po-fil för varje språk du vill översätta till. Till exempel: de.po för tyska, fr.po för franska och så vidare. Du kan använda programmet `Poedit <https://poedit.net/>`_ för detta." |
| 455 |
|
| 456 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:274 |
| 457 |
msgid "" |
| 458 |
"Send these .po files to your translators. Once you get them back, compile " |
| 459 |
"them into .mo files. You can again use Poedit for that, or just do::" |
| 460 |
msgstr "Skicka dessa .po filer till dina översättare. När du får tillbaka dem, kompilera dem i .mo filer. Du kan återigen använda Poedit för det, eller bara göra::" |
| 461 |
|
| 462 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:279 |
| 463 |
msgid "Put the .mo files into the ``translations`` folder in your plugin." |
| 464 |
msgstr "Placera .mo-filer i ``translations``-mappen i din insticksmodul." |
| 465 |
|
| 466 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:281 |
| 467 |
msgid "" |
| 468 |
"The last step is to simply call the function `load_translations()` at the " |
| 469 |
"top of your plugin's .py files. For performance reasons you should only call" |
| 470 |
" this function in those .py files that actually have translatable strings. " |
| 471 |
"So in a typical User Interface plugin you would call it at the top of " |
| 472 |
"``ui.py`` but not ``__init__.py``." |
| 473 |
msgstr "Det sista steget är att helt enkelt anropa funktionen `load_translations()` överst av dina insticksmoduls .py-filer. Av prestandaskäl bör du bara anropa den här funktionen i de .py-filerna som faktiskt har översättningsbara strängar. Så i en typiskt användargränssnittsinsticksmodul skulle du anropa det överst i ``ui.py`` men inte ``__init__.py``." |
| 474 |
|
| 475 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:287 |
| 476 |
msgid "" |
| 477 |
"You can test the translations of your plugins by changing the user interface" |
| 478 |
" language in calibre under :guilabel:`Preferences->Interface->Look & feel` " |
| 479 |
"or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment " |
| 480 |
"variable set. For example::" |
| 481 |
msgstr "Du kan testa översättningarna av dina insticksmodul genom att ändra språk i användargränssnittet i calibre i :guilabel:`Inställningar->Gränssnitt->Utseende & känsla` eller genom att köra calibre med miljövariabeluppsättningen ``CALIBRE_OVERRIDE_LANG``. Till exempel::" |
| 482 |
|
| 483 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:293 |
| 484 |
msgid "" |
| 485 |
"Replace ``de`` with the language code of the language you want to test." |
| 486 |
msgstr "Ersätt ``de`` med språkkoden för det språk som du vill testa." |
| 487 |
|
| 488 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:295 |
| 489 |
msgid "" |
| 490 |
"For translations with plurals, use the ``ngettext()`` function instead of " |
| 491 |
"``_()``. For example::" |
| 492 |
msgstr "För översättningar med plural, använd funktionen ``ngettext()`` i stället för ``_()``. Till exempel::" |
| 493 |
|
| 494 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:301 |
| 495 |
msgid "The plugin API" |
| 496 |
msgstr "Insticksmoduls API" |
| 497 |
|
| 498 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:303 |
| 499 |
msgid "" |
| 500 |
"As you may have noticed above, a plugin in calibre is a class. There are " |
| 501 |
"different classes for the different types of plugins in calibre. Details on " |
| 502 |
"each class, including the base class of all plugins can be found in " |
| 503 |
":ref:`plugins`." |
| 504 |
msgstr "Som ni kanske har märkt ovan, en insticksmodul i calibre är en klass. Det finns olika klasser för de olika typerna av insticksmoduler i calibre. Detaljer om varje klass, inklusive basklassen för alla insticksmoduler kan hittas i :ref:`plugins`." |
| 505 |
|
| 506 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:306 |
| 507 |
msgid "" |
| 508 |
"Your plugin is almost certainly going to use code from calibre. To learn how" |
| 509 |
" to find various bits of functionality in the calibre code base, read the " |
| 510 |
"section on the calibre :ref:`code_layout`." |
| 511 |
msgstr "Din insticksmodul kommer nästan säkert att använda kod från calibre. För att lära dig hur man hittar olika funktioner i calibre-kodbasen, läs avsnittet om calibre :ref:`code_layout`." |
| 512 |
|
| 513 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:311 |
| 514 |
msgid "Debugging plugins" |
| 515 |
msgstr "Felsöka insticksmodul" |
| 516 |
|
| 517 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:313 |
| 518 |
msgid "" |
| 519 |
"The first, most important step is to run calibre in debug mode. You can do " |
| 520 |
"this from the command line with::" |
| 521 |
msgstr "Den första och viktigaste steget är att köra calibre i felsökningsläge. Du kan göra det från kommandoraden med::" |
| 522 |
|
| 523 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:317 |
| 524 |
msgid "" |
| 525 |
"Or from within calibre by right-clicking the :guilabel:`Preferences` button " |
| 526 |
"or using the :kbd:`Ctrl+Shift+R` keyboard shortcut." |
| 527 |
msgstr "Eller inifrån calibre genom att högerklicka på :guilabel:`Inställningar` eller genom att använda kortkommandoen :kbd:`Ctrl+Skift+R`." |
| 528 |
|
| 529 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:319 |
| 530 |
msgid "" |
| 531 |
"When running from the command line, debug output will be printed to the " |
| 532 |
"console, when running from within calibre the output will go to a txt file." |
| 533 |
msgstr "När du kör från kommandoraden, kommer felsökningsutmatning skrivas till konsolen, när man kör inifrån calibre kommer utmatning gå till en TXT-fil." |
| 534 |
|
| 535 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:321 |
| 536 |
msgid "" |
| 537 |
"You can insert print statements anywhere in your plugin code, they will be " |
| 538 |
"output in debug mode. Remember, this is Python, you really shouldn't need " |
| 539 |
"anything more than print statements to debug ;) I developed all of calibre " |
| 540 |
"using just this debugging technique." |
| 541 |
msgstr "Du kan infoga utskriftssatser var som helst i din insticksmodulskod, de matas ut i felsökningsläge. Kom ihåg, det här är Python, du borde verkligen inte behöva mer än att skriva ut uttalanden för att felsöka ;) Jag utvecklade hela calibre med just den här felsökningstekniken." |
| 542 |
|
| 543 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:323 |
| 544 |
msgid "" |
| 545 |
"You can quickly test changes to your plugin by using the following command " |
| 546 |
"line::" |
| 547 |
msgstr "Du kan snabbt testa ändringar i din insticksmodul med hjälp av följande kommandorad::" |
| 548 |
|
| 549 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:328 |
| 550 |
msgid "" |
| 551 |
"This will shutdown a running calibre, wait for the shutdown to complete, " |
| 552 |
"then update your plugin in calibre and relaunch calibre." |
| 553 |
msgstr "Detta kommer att stänga en körande calibre, vänta på avstängning är slutförd och sedan uppdatera din insticksmodul i calibre och starta om calibre." |
| 554 |
|
| 555 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:331 |
| 556 |
msgid "More plugin examples" |
| 557 |
msgstr "Fler insticksmodul exempel" |
| 558 |
|
| 559 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:333 |
| 560 |
msgid "" |
| 561 |
"You can find a list of many sophisticated calibre plugins `here " |
| 562 |
"<https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 563 |
msgstr "Du kan hitta en lista med många sofistikerade calibre-insticksmoduler `här <https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 564 |
|
| 565 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:336 |
| 566 |
msgid "Sharing your plugins with others" |
| 567 |
msgstr "Dela dina insticksmodul med andra" |
| 568 |
|
| 569 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:338 |
| 570 |
msgid "" |
| 571 |
"If you would like to share the plugins you have created with other users of " |
| 572 |
"calibre, post your plugin in a new thread in the `calibre plugins forum " |
| 573 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |
| 574 |
msgstr "Om du vill dela insticksmodulen som du har gjort med andra calibre-användare, posta din insticksmodul i en ny tråd i `calibre-insticksmodulsforumet <https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |