| 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 |
# akihiko tanae (tanaeakihiko), 2025-2026 |
| 7 |
msgid "" |
| 8 |
msgstr "" |
| 9 |
"Project-Id-Version: calibre\n" |
| 10 |
"Report-Msgid-Bugs-To: \n" |
| 11 |
"POT-Creation-Date: 2026-02-17 16:44+0000\n" |
| 12 |
"PO-Revision-Date: 2014-06-17 08:35+0000\n" |
| 13 |
"Last-Translator: akihiko tanae (tanaeakihiko), 2025-2026\n" |
| 14 |
"Language-Team: Japanese (http://app.transifex.com/calibre/calibre/language/ja/)\n" |
| 15 |
"MIME-Version: 1.0\n" |
| 16 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 17 |
"Content-Transfer-Encoding: 8bit\n" |
| 18 |
"Language: ja\n" |
| 19 |
"Plural-Forms: nplurals=1; plural=0;\n" |
| 20 |
|
| 21 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:4 |
| 22 |
msgid "Writing your own plugins to extend calibre's functionality" |
| 23 |
msgstr "プラグインを書いて calibre を機能拡張" |
| 24 |
|
| 25 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:6 |
| 26 |
msgid "" |
| 27 |
"calibre has a very modular design. Almost all functionality in calibre comes" |
| 28 |
" in the form of plugins. Plugins are used for conversion, for downloading " |
| 29 |
"news (though these are called recipes), for various components of the user " |
| 30 |
"interface, to connect to different devices, to process files when adding " |
| 31 |
"them to calibre and so on. You can get a complete list of all the built-in " |
| 32 |
"plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`." |
| 33 |
msgstr "calibre の設計は非常にモジュラーです。ほとんどすべての calibre の機能がプラグインという形で提供されます。プラグインは変換、ニュースのダウンロード (ただしこれはレシピと呼ばれます)、ユーザインタフェースのさまざまな部品、いろいろなデバイスへの接続、calibre にファイルを追加する際の処理など、多岐にわたって使用されます。ビルトインのプラグインは、:guilabel:`環境設定->高度な設定->プラグイン` ですべてを確認できます。" |
| 34 |
|
| 35 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:8 |
| 36 |
msgid "" |
| 37 |
"Here, we will teach you how to create your own plugins to add new features " |
| 38 |
"to calibre." |
| 39 |
msgstr "ここでは独自のプラグインを作成して calibre に新しい機能を追加する方法を説明します。" |
| 40 |
|
| 41 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:13 |
| 42 |
msgid "Contents" |
| 43 |
msgstr "目次" |
| 44 |
|
| 45 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:15 |
| 46 |
msgid "This only applies to calibre releases >= 0.8.60" |
| 47 |
msgstr "これが適用されるのは calibre のリリース 0.8.60 以降に限られます。" |
| 48 |
|
| 49 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:18 |
| 50 |
msgid "Anatomy of a calibre plugin" |
| 51 |
msgstr "calibre プラグインの構造" |
| 52 |
|
| 53 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:20 |
| 54 |
msgid "" |
| 55 |
"A calibre plugin is very simple, it's just a ZIP file that contains some " |
| 56 |
"Python code and any other resources like image files needed by the plugin. " |
| 57 |
"Without further ado, let's see a basic example." |
| 58 |
msgstr "calibre のプラグインはとてもシンプルです。Python のコードと、プラグインが必要とする画像ファイルなどのその他リソースからなる単なる ZIP ファイルにすぎません。これ以上面倒なことは避けて、基本的な例を見てみましょう。" |
| 59 |
|
| 60 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:24 |
| 61 |
msgid "" |
| 62 |
"Suppose you have an installation of calibre that you are using to self " |
| 63 |
"publish various e-documents in EPUB and MOBI formats. You would like all " |
| 64 |
"files generated by calibre to have their publisher set as \"Hello world\", " |
| 65 |
"here's how to do it. Create a file named :file:`__init__.py` (this is a " |
| 66 |
"special name and must always be used for the main file of your plugin) and " |
| 67 |
"enter the following Python code into it:" |
| 68 |
msgstr "EPUB および MOBI 形式のさまざまな電子ドキュメントを自己出版するために calibre をインストールしているとしましょう。calibre で生成したすべてのファイルの発行元を「Hello World」に設定したい場合には、次のようにします。:file:`__init__.py` という名前でファイルを作成し (これは特別な名前で、プラグインのメインファイルとして必ず使用しなくてはなりません)、その中に次の Python コードを入力します:" |
| 69 |
|
| 70 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:32 |
| 71 |
msgid "" |
| 72 |
"That's all. To add this code to calibre as a plugin, simply run the " |
| 73 |
"following in the folder in which you created :file:`__init__.py`::" |
| 74 |
msgstr "これでおしまいです。あとは :file:`__init__.py` を作成したフォルダで次のコードを実行するだけで、このコードを calibre にプラグインとして追加できます::" |
| 75 |
|
| 76 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:38 |
| 77 |
msgid "" |
| 78 |
"On macOS, the command line tools are inside the calibre bundle, for example," |
| 79 |
" if you installed calibre in :file:`/Applications` the command line tools " |
| 80 |
"are in :file:`/Applications/calibre.app/Contents/MacOS/`." |
| 81 |
msgstr "macOS では、コマンドラインツールは calibre にバンドルされています。たとえばcalibre を :file:`/Applications` にインストールした場合には、コマンドラインツールは :file:`/Applications/calibre.app/Contents/MacOS/` にあります。" |
| 82 |
|
| 83 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:42 |
| 84 |
msgid "" |
| 85 |
"You can download the Hello World plugin from " |
| 86 |
":download_file:`helloworld_plugin.zip`." |
| 87 |
msgstr "Hello World プラグインは :download_file:`helloworld_plugin.zip` からダウンロード可能です。" |
| 88 |
|
| 89 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:45 |
| 90 |
msgid "" |
| 91 |
"Every time you use calibre to convert a book, the plugin's :meth:`run` " |
| 92 |
"method will be called and the converted book will have its publisher set to " |
| 93 |
"\"Hello World\". This is a trivial plugin, let's move on to a more complex " |
| 94 |
"example that actually adds a component to the user interface." |
| 95 |
msgstr "calibre で本を変換するたびにプラグインの :meth:`run()` メソッドが呼び出され、変換した本の発行元は \"Hello World\" に設定されます。これは非常に簡単なプラグインですが、ユーザインタフェースに実際にコンポーネントを追加するようなもっと複雑な例に移りましょう。" |
| 96 |
|
| 97 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:50 |
| 98 |
msgid "A User Interface plugin" |
| 99 |
msgstr "ユーザインタフェースプラグイン" |
| 100 |
|
| 101 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:52 |
| 102 |
msgid "" |
| 103 |
"This plugin will be spread over a few files (to keep the code clean). It " |
| 104 |
"will show you how to get resources (images or data files) from the plugin " |
| 105 |
"ZIP file, allow users to configure your plugin, how to create elements in " |
| 106 |
"the calibre user interface and how to access and query the books database in" |
| 107 |
" calibre." |
| 108 |
msgstr "このプラグインはいくつかのファイルに分散されています (コードをきれいに保つため)。ここでプラグイン ZIP ファイルからリソース (画像やデータファイル) を取得し、ユーザにプラグインの設定を許可し、calibre のユーザインタフェースに要素を作成し、calibre のデータベースにアクセスしてクエリを発行する方法を紹介します。" |
| 109 |
|
| 110 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:57 |
| 111 |
msgid "" |
| 112 |
"You can download this plugin from :download_file:`interface_demo_plugin.zip`" |
| 113 |
msgstr "このプラグインは :download_file:`interface_demo_plugin.zip` からダウンロード可能です。" |
| 114 |
|
| 115 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:61 |
| 116 |
msgid "" |
| 117 |
"The first thing to note is that this ZIP file has a lot more files in it, " |
| 118 |
"explained below, pay particular attention to ``plugin-import-name-" |
| 119 |
"interface_demo.txt``." |
| 120 |
msgstr "最初に注意すべきは、この ZIP ファイルには以下に説明するとおりもっと多くのファイルが含まれているということです。特に ``plugin-import-name-interface_demo.txt`` には注意してください。" |
| 121 |
|
| 122 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:64 |
| 123 |
msgid "**plugin-import-name-interface_demo.txt**" |
| 124 |
msgstr "**plugin-import-name-interface_demo.txt**" |
| 125 |
|
| 126 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:65 |
| 127 |
msgid "" |
| 128 |
"An empty text file used to enable the multi-file plugin magic. This file " |
| 129 |
"must be present in all plugins that use more than one .py file. It should be" |
| 130 |
" empty and its filename must be of the form: ``plugin-import-" |
| 131 |
"name-**some_name**.txt``. The presence of this file allows you to import " |
| 132 |
"code from the .py files present inside the ZIP file, using a statement " |
| 133 |
"like::" |
| 134 |
msgstr "マルチファイルプラグインマジックを有効にするために使われる空のテキストファイル。このファイルは複数の .py ファイルを使うプラグインには必ず必要です。中身は空でなくてはならず、ファイル名は ``plugin-import-name-**some_name**.txt`` の形式にする必要があります。このファイルが存在すると ZIP ファイルの中にある .py ファイルからコードをインポートできるようになります。それには次のように記述します::" |
| 135 |
|
| 136 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:71 |
| 137 |
msgid "" |
| 138 |
"The prefix ``calibre_plugins`` must always be present. ``some_name`` comes " |
| 139 |
"from the filename of the empty text file. ``some_module`` refers to " |
| 140 |
":file:`some_module.py` file inside the ZIP file. Note that this importing is" |
| 141 |
" just as powerful as regular Python imports. You can create packages and " |
| 142 |
"subpackages of .py modules inside the ZIP file, just like you would normally" |
| 143 |
" (by defining __init__.py in each sub-folder), and everything should \"just " |
| 144 |
"work\"." |
| 145 |
msgstr "必ずプリフィックス ``calibre_plugins`` をつける必要があります。``some_name`` は空のテキストファイルのファイル名から取得します。 ``some_module`` は ZIP ファイル内の :file:`some_module.py` を参照します。このインポートは Python の普通のインポートと同じくらい強力です。通常と同じように (各サボフォルダに __init__.py を定義することにより) ZIP ファイルの中に .py モジュールのパッケージとサブパッケージを作成でき、すべては \"ちゃんと動きます\" 。" |
| 146 |
|
| 147 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:76 |
| 148 |
msgid "" |
| 149 |
"The name you use for ``some_name`` enters a global namespace shared by all " |
| 150 |
"plugins, **so make it as unique as possible**. But remember that it must be " |
| 151 |
"a valid Python identifier (only alphabets, numbers and the underscore)." |
| 152 |
msgstr "``some_name`` に使う名前はすべてのプラグインで共有するグローバルな名前空間に入るので、**可能な限り一意なものにしてください**。そしてこれは有効な Python の識別子 (英数字およびアンダースコアの使用可能) でなくてはなりません。" |
| 153 |
|
| 154 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:79 |
| 155 |
msgid "**__init__.py**" |
| 156 |
msgstr "**__init__.py**" |
| 157 |
|
| 158 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:80 |
| 159 |
msgid "As before, the file that defines the plugin class" |
| 160 |
msgstr "前述したように、プラグインクラスを定義するファイル" |
| 161 |
|
| 162 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:82 |
| 163 |
msgid "**main.py**" |
| 164 |
msgstr "**main.py**" |
| 165 |
|
| 166 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:83 |
| 167 |
msgid "This file contains the actual code that does something useful" |
| 168 |
msgstr "このファイルに便利な何かを行う実際のコードが含まれます" |
| 169 |
|
| 170 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:85 |
| 171 |
msgid "**ui.py**" |
| 172 |
msgstr "**ui.py**" |
| 173 |
|
| 174 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:86 |
| 175 |
msgid "This file defines the interface part of the plugin" |
| 176 |
msgstr "このファイルはプラグインのインタフェース部分を定義します" |
| 177 |
|
| 178 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:88 |
| 179 |
msgid "**images/icon.png**" |
| 180 |
msgstr "**images/icon.png**" |
| 181 |
|
| 182 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:89 |
| 183 |
msgid "The icon for this plugin" |
| 184 |
msgstr "このプラグインのアイコン" |
| 185 |
|
| 186 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:91 |
| 187 |
msgid "**about.txt**" |
| 188 |
msgstr "**about.txt**" |
| 189 |
|
| 190 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:92 |
| 191 |
msgid "A text file with information about the plugin" |
| 192 |
msgstr "このプラグインに関する情報を含むテキストファイル" |
| 193 |
|
| 194 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:94 |
| 195 |
msgid "**translations**" |
| 196 |
msgstr "**translations**" |
| 197 |
|
| 198 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:95 |
| 199 |
msgid "" |
| 200 |
"A folder containing .mo files with the translations of the user interface of" |
| 201 |
" your plugin into different languages. See below for details." |
| 202 |
msgstr "プラグインのユーザインタフェースを別の言語に翻訳するための .mo ファイルが入ったフォルダ" |
| 203 |
|
| 204 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:99 |
| 205 |
msgid "Now let's look at the code." |
| 206 |
msgstr "ではコードを見てみましょう。" |
| 207 |
|
| 208 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:102 |
| 209 |
msgid "__init__.py" |
| 210 |
msgstr "__init__.py" |
| 211 |
|
| 212 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:104 |
| 213 |
msgid "First, the obligatory ``__init__.py`` to define the plugin metadata:" |
| 214 |
msgstr "プラグインのメタデータを定義するために必須な ``__init__.py``:" |
| 215 |
|
| 216 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:109 |
| 217 |
msgid "" |
| 218 |
"The only noteworthy feature is the field :attr:`actual_plugin`. Since " |
| 219 |
"calibre has both command line and GUI interfaces, GUI plugins like this one " |
| 220 |
"should not load any GUI libraries in __init__.py. The actual_plugin field " |
| 221 |
"does this for you, by telling calibre that the actual plugin is to be found " |
| 222 |
"in another file inside your ZIP archive, which will only be loaded in a GUI " |
| 223 |
"context." |
| 224 |
msgstr "注目すべき機能はフィールド :attr:`actual_plugin` だけです。calibre にはコマンドラインと GUI インタフェースが両方あるため、このような GUI プラグインは __init__.py の中で GUI ライブラリをロードすべきではありません。actual_plugin が calibre に実際のプラグインが ZIP アーカイブ内の別のファイルに見つかったことを知らせて、GUI コンテキストでのみロードされるようになります。" |
| 225 |
|
| 226 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:114 |
| 227 |
msgid "" |
| 228 |
"Remember that for this to work, you must have a plugin-import-name-" |
| 229 |
"some_name.txt file in your plugin ZIP file, as discussed above." |
| 230 |
msgstr "これを機能させるには、上で説明したようにプラグイン ZIP ファイルの中に plugin-import-name-some_name.txt が必要です。" |
| 231 |
|
| 232 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:117 |
| 233 |
msgid "" |
| 234 |
"Also there are a couple of methods for enabling user configuration of the " |
| 235 |
"plugin. These are discussed below." |
| 236 |
msgstr "プラグインのユーザ設定を有効にする方法は、いくつか存在します。それについては下で説明します。" |
| 237 |
|
| 238 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:120 |
| 239 |
msgid "ui.py" |
| 240 |
msgstr "ui.py" |
| 241 |
|
| 242 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:122 |
| 243 |
msgid "" |
| 244 |
"Now let's look at ui.py which defines the actual GUI plugin. The source code" |
| 245 |
" is heavily commented and should be self explanatory:" |
| 246 |
msgstr "では、実際の GUI プラグインを定義している ui.py を見てみましょう。ソースコードにはコメントがちりばめられているので、読めばわかるはずです:" |
| 247 |
|
| 248 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:128 |
| 249 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:220 |
| 250 |
msgid "main.py" |
| 251 |
msgstr "main.py" |
| 252 |
|
| 253 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:130 |
| 254 |
msgid "The actual logic to implement the Interface Plugin Demo dialog." |
| 255 |
msgstr "Interface Plugin Demo ダイアログを実装する実際のロジック部分" |
| 256 |
|
| 257 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:136 |
| 258 |
msgid "Getting resources from the plugin ZIP file" |
| 259 |
msgstr "プラグイン ZIP ファイルからリソースを取得" |
| 260 |
|
| 261 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:138 |
| 262 |
msgid "" |
| 263 |
"calibre's plugin loading system defines a couple of built-in functions that " |
| 264 |
"allow you to conveniently get files from the plugin ZIP file." |
| 265 |
msgstr "calibre のプラグイン読み込みシステムは、プラグイン ZIP ファイルからファイルを便利に取得できるようにするためのビルトイン関数をいくつか定義しています。" |
| 266 |
|
| 267 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:140 |
| 268 |
msgid "**get_resources(name_or_list_of_names)**" |
| 269 |
msgstr "**get_resources(name_or_list_of_names)**" |
| 270 |
|
| 271 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:141 |
| 272 |
msgid "" |
| 273 |
"This function should be called with a list of paths to files inside the ZIP " |
| 274 |
"file. For example to access the file :file:`icon.png` in the folder images " |
| 275 |
"in the ZIP file, you would use: ``images/icon.png``. Always use a forward " |
| 276 |
"slash as the path separator, even on Windows. When you pass in a single " |
| 277 |
"name, the function will return the raw bytes of that file or None if the " |
| 278 |
"name was not found in the ZIP file. If you pass in more than one name then " |
| 279 |
"it returns a dictionary mapping the names to bytes. If a name is not found," |
| 280 |
" it will not be present in the returned dictionary." |
| 281 |
msgstr "この関数は、ZIPファイル内のファイルへのパスのリストを渡して呼び出す必要があります。例えば、ZIPファイル内のフォルダ images にあるファイル :file:`icon.png` にアクセスするには: ``images/icon.png`` とします。Windowsでも、パスの区切りとしては常にスラッシュを使用してください。名前を1つだけ渡した場合、この関数はそのファイルの生のバイト列を返します。名前がZIPファイル内に見つからない場合は、Noneを返します。複数の名前を渡した場合、名前をバイト列にマッピングした辞書を返します。名前が見つからない場合、返される辞書にはその名前は含まれません。" |
| 282 |
|
| 283 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:150 |
| 284 |
msgid "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 285 |
msgstr "**get_icons(name_or_list_of_names, plugin_name='')**" |
| 286 |
|
| 287 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:151 |
| 288 |
msgid "" |
| 289 |
"A wrapper for get_resources() that creates QIcon objects from the raw bytes " |
| 290 |
"returned by get_resources. If a name is not found in the ZIP file the " |
| 291 |
"corresponding QIcon will be null. In order to support icon theme-ing, pass " |
| 292 |
"in the human friendly name of your plugin as ``plugin_name``. If the user is" |
| 293 |
" using an icon theme with icons for your plugin, they will be loaded " |
| 294 |
"preferentially." |
| 295 |
msgstr "get_resources() のラッパーで、get_resources から返される生のバイト列から QIcon オブジェクトを作成します。ZIP ファイルに名前が見つからない場合、対応する QIcon は null になります。アイコンテーマをサポートするには、プラグインの人間にわかりやすい名前を ``plugin_name`` として渡してください。ユーザーがプラグイン用のアイコンを含むアイコンテーマを使用している場合は、それらのアイコンが優先的に読み込まれます。" |
| 296 |
|
| 297 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:160 |
| 298 |
msgid "Enabling user configuration of your plugin" |
| 299 |
msgstr "プラグインのユーザ設定を有効にする" |
| 300 |
|
| 301 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:162 |
| 302 |
msgid "" |
| 303 |
"To allow users to configure your plugin, you must define three methods in " |
| 304 |
"your base plugin class, **is_customizable**, **config_widget** and " |
| 305 |
"**save_settings** as shown below:" |
| 306 |
msgstr "ユーザがプラグインを設定できるようにするためには、プラグインの基底クラスに 3 つのメソッド、**is_customizable**, **config_widget** および **save_settings** を下に示すように定義する必要があります:" |
| 307 |
|
| 308 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:173 |
| 309 |
msgid "" |
| 310 |
"calibre has many different ways to store configuration data (a legacy of its" |
| 311 |
" long history). The recommended way is to use the **JSONConfig** class, " |
| 312 |
"which stores your configuration information in a .json file." |
| 313 |
msgstr "calibre には設定データを格納するのにいくつもの異なる方法があります (長い歴史の遺産です)。推奨される方法は **JSONConfig** を使用することで、これは設定情報を .json ファイルに格納します。" |
| 314 |
|
| 315 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:175 |
| 316 |
msgid "" |
| 317 |
"The code to manage configuration data in the demo plugin is in config.py:" |
| 318 |
msgstr "デモプラグインの設定データを管理するコードは config.py にあります:" |
| 319 |
|
| 320 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:180 |
| 321 |
msgid "" |
| 322 |
"The ``prefs`` object is now available throughout the plugin code by a " |
| 323 |
"simple::" |
| 324 |
msgstr "次のようにするだけで ``prefs`` がプラグインコード全体から使用できりうようになります::" |
| 325 |
|
| 326 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:185 |
| 327 |
msgid "You can see the ``prefs`` object being used in main.py:" |
| 328 |
msgstr "``prefs`` オブジェクトが main.py で使われているのがわかります:" |
| 329 |
|
| 330 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:192 |
| 331 |
msgid "Edit book plugins" |
| 332 |
msgstr "本の編集プラグイン" |
| 333 |
|
| 334 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:194 |
| 335 |
msgid "" |
| 336 |
"Now let's change gears for a bit and look at creating a plugin to add tools " |
| 337 |
"to the calibre book editor. The plugin is available here: " |
| 338 |
":download_file:`editor_demo_plugin.zip`." |
| 339 |
msgstr "それでは少し趣向を変えて、calibre の書籍エディタにツールを追加するプラグインを作成する方法を見てみましょう。プラグインはここちら: :download_file:`editor_demo_plugin.zip`" |
| 340 |
|
| 341 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:198 |
| 342 |
msgid "" |
| 343 |
"The first step, as for all plugins is to create the import name empty txt " |
| 344 |
"file, as described :ref:`above <import_name_txt>`. We shall name the file " |
| 345 |
"``plugin-import-name-editor_plugin_demo.txt``." |
| 346 |
msgstr "すべてのプラグインと同様、最初のステップは上記 :ref:`above <import_name_txt>` で説明したようにインポート名の空のテキストファイルを作成することです。ここではファイルを ``plugin-import-name-editor_plugin_demo.txt`` という名前にします。" |
| 347 |
|
| 348 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:202 |
| 349 |
msgid "" |
| 350 |
"Now we create the mandatory ``__init__.py`` file that contains metadata " |
| 351 |
"about the plugin -- its name, author, version, etc." |
| 352 |
msgstr "次に、必須である ``__init__.py`` を作成し、プラグインに関するメタデータ、すなわち名前、作者、バージョンなどを含めます。" |
| 353 |
|
| 354 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:208 |
| 355 |
msgid "" |
| 356 |
"A single editor plugin can provide multiple tools each tool corresponds to a" |
| 357 |
" single button in the toolbar and entry in the :guilabel:`Plugins` menu in " |
| 358 |
"the editor. These can have sub-menus in case the tool has multiple related " |
| 359 |
"actions." |
| 360 |
msgstr "ひとつのエディタプラグインで複数のツールを提供できます。それぞれのツールはツールバーのひとつのボタンとエディタの :guilabel:`プラグイン` メニューのエントリに対応づけられます。ツールが複数の関連した動作を持つ場合にはサブメニューにすることも可能です。" |
| 361 |
|
| 362 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:212 |
| 363 |
msgid "" |
| 364 |
"The tools must all be defined in the file ``main.py`` in your plugin. Every " |
| 365 |
"tool is a class that inherits from the " |
| 366 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at " |
| 367 |
"``main.py`` from the demo plugin, the source code is heavily commented and " |
| 368 |
"should be self-explanatory. Read the API documents of the " |
| 369 |
":class:`calibre.gui2.tweak_book.plugin.Tool` class for more details." |
| 370 |
msgstr "ツールはすべてプラグインの中の `main.py`` に定義する必要があります。すべてのツールは :class:`calibre.gui2.tweak_book.plugin.Tool` クラスを継承するクラスです。デモプラグインの ``main.py`` を見てみましょう。ソースコードにはコメントがちりばめられているので、読めばわかるはずです。詳しくは :class:`calibre.gui2.tweak_book.plugin.Tool` クラスの API ドキュメントをお読みください。" |
| 371 |
|
| 372 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:222 |
| 373 |
msgid "" |
| 374 |
"Here we will see the definition of a single tool that will multiply all font" |
| 375 |
" sizes in the book by a number provided by the user. This tool demonstrates " |
| 376 |
"various important concepts that you will need in developing your own " |
| 377 |
"plugins, so you should read the (heavily commented) source code carefully." |
| 378 |
msgstr "ここでは、本のすべてのフォントサイズをユーザに指定された数字で掛けた大きさにするような、ひとつのツールの定義を見てみましょう。このツールは自分でプラグインを開発するときに必要となるさまざまな重要な概念を実演しているので、(コメントのちりばめられた) ソースコードをよく読んでください。" |
| 379 |
|
| 380 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:230 |
| 381 |
msgid "" |
| 382 |
"Let's break down ``main.py``. We see that it defines a single tool, named " |
| 383 |
"*Magnify fonts*. This tool will ask the user for a number and multiply all " |
| 384 |
"font sizes in the book by that number." |
| 385 |
msgstr "``main.py`` を掘り下げてみましょう。*Magnify fonts* と名付けたひとつのツールを定義していることがわかります。このツールはユーザに数値を尋ねて、与えられた数値を本の中のすべてのフォントサイズに掛けます。" |
| 386 |
|
| 387 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:234 |
| 388 |
msgid "" |
| 389 |
"The first important thing is the tool name which you must set to some " |
| 390 |
"relatively unique string as it will be used as the key for this tool." |
| 391 |
msgstr "最初に重要なのはツール名です。このツールのキーとして使用されるため、なるべくユニークな文字列を設定する必要があります。" |
| 392 |
|
| 393 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:237 |
| 394 |
msgid "" |
| 395 |
"The next important entry point is the " |
| 396 |
":meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method " |
| 397 |
"creates the QAction objects that appear in the plugins toolbar and plugin " |
| 398 |
"menu. It also, optionally, assigns a keyboard shortcut that the user can " |
| 399 |
"customize. The triggered signal from the QAction is connected to the " |
| 400 |
"ask_user() method that asks the user for the font size multiplier, and then " |
| 401 |
"runs the magnification code." |
| 402 |
msgstr "次に重要なエントリポイントは :meth:`calibre.gui2.tweak_book.plugin.Tool.create_action` です。このメソッドはプラグインツールバーとプラグインメニューに表示される QAction を生成します。オプションで、ユーザがカスタマイズ可能なショートカットを割り当てることができます。トリガーとなる QAction からのシグナルは ask_user() に接続してユーザにフォントサイズを何倍にするかをを尋ね、その後に拡大するコードを実行します。" |
| 403 |
|
| 404 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:245 |
| 405 |
msgid "" |
| 406 |
"The magnification code is well commented and fairly simple. The main things " |
| 407 |
"to note are that you get a reference to the editor window as ``self.gui`` " |
| 408 |
"and the editor *Boss* as ``self.boss``. The *Boss* is the object that " |
| 409 |
"controls the editor user interface. It has many useful methods, that are " |
| 410 |
"documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class." |
| 411 |
msgstr "拡大するコードにはしっかりコメントが書き込まれていて、まあまあシンプルです。注意すべき主な点は、エディタウィンドウを ``self.gui``、エディタ *Boss* を ``self.boss`` として参照することです。*Boss* はエディタユーザインタフェースを制御するオブジェクトです。これには便利なメソッドがたくさんありますが、それについては :class:`calibre.gui2.tweak_book.boss.Boss` クラスに説明があります。" |
| 412 |
|
| 413 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:251 |
| 414 |
msgid "" |
| 415 |
"Finally, there is ``self.current_container`` which is a reference to the " |
| 416 |
"book being edited as a " |
| 417 |
":class:`calibre.ebooks.oeb.polish.container.Container` object. This " |
| 418 |
"represents the book as a collection of its constituent HTML/CSS/image files " |
| 419 |
"and has convenience methods for doing many useful things. The container " |
| 420 |
"object and various useful utility functions that can be reused in your " |
| 421 |
"plugin code are documented in :ref:`polish_api`." |
| 422 |
msgstr "最後に ``self.current_container`` があり、これは編集されようとしている本を :class:`calibre.ebooks.oeb.polish.container.Container` オブジェクトへの参照です。これは本をその構成要素であるHTML/CSS/画像 ファイルの集まりとして表し、役に立ついろいろなことができる便利なメソッドを備えています。プラグインコードで再利用可能なコンテナオブジェクトとさまざまな便利なユーティリティ関数については、:ref:`polish_api` に説明があります。" |
| 423 |
|
| 424 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:259 |
| 425 |
msgid "Adding translations to your plugin" |
| 426 |
msgstr "プラグインに翻訳を追加" |
| 427 |
|
| 428 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:261 |
| 429 |
msgid "" |
| 430 |
"You can have all the user interface strings in your plugin translated and " |
| 431 |
"displayed in whatever language is set for the main calibre user interface." |
| 432 |
msgstr "プラグインのユーザインタフェース上のすべての文字列は翻訳して、メインの calibre ユーザインタフェースで設定された言語で表示することができます。" |
| 433 |
|
| 434 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:264 |
| 435 |
msgid "" |
| 436 |
"The first step is to go through your plugin's source code and mark all user " |
| 437 |
"visible strings as translatable, by surrounding them in _(). For example::" |
| 438 |
msgstr "最初のステップはプラグインのソースコードを調べ、ユーザに表示される文字列すべてを _() で囲むことにより翻訳可能としてマークすることです。" |
| 439 |
|
| 440 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:269 |
| 441 |
msgid "" |
| 442 |
"Then use some program to generate .po files from your plugin source code. " |
| 443 |
"There should be one .po file for every language you want to translate into. " |
| 444 |
"For example: de.po for German, fr.po for French and so on. You can use the " |
| 445 |
"`Poedit <https://poedit.net/>`_ program for this." |
| 446 |
msgstr "それから何らかのプログラムを使ってプラグインのソースコードから .po ファイルを生成してください。翻訳したい言語ごとにひとつの .po ファイルが必要です。たとえばドイツ語用に de.po、フランス語用に fr.po といった具合です。これには `Poedit <https://poedit.net/>`_ が使えます。" |
| 447 |
|
| 448 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:274 |
| 449 |
msgid "" |
| 450 |
"Send these .po files to your translators. Once you get them back, compile " |
| 451 |
"them into .mo files. You can again use Poedit for that, or just do::" |
| 452 |
msgstr "これらの .po ファイルを翻訳者に送信しましょう。戻ってきたら .mo ファイルにコンパイルします。これにも Poedit を利用できます。または次のようにします::" |
| 453 |
|
| 454 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:279 |
| 455 |
msgid "Put the .mo files into the ``translations`` folder in your plugin." |
| 456 |
msgstr ".mo ファイルをプラグインの ``translations`` フォルダに置きます。" |
| 457 |
|
| 458 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:281 |
| 459 |
msgid "" |
| 460 |
"The last step is to simply call the function `load_translations()` at the " |
| 461 |
"top of your plugin's .py files. For performance reasons you should only call" |
| 462 |
" this function in those .py files that actually have translatable strings. " |
| 463 |
"So in a typical User Interface plugin you would call it at the top of " |
| 464 |
"``ui.py`` but not ``__init__.py``." |
| 465 |
msgstr "最後のステップは、ただ単にプラグインの .pu ファイルの先頭で関数 `load_translations()` を呼び出すだけです。性能上の理由からこの関数を呼び出すのは、実際に翻訳可能な文字列が含まれている .py ファイルに限るべきです。したがって典型的なユーザインタフェースプラグインではこの関数は ``__init__.py`` ではなく ``ui.py`` の先頭で呼び出します。" |
| 466 |
|
| 467 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:287 |
| 468 |
msgid "" |
| 469 |
"You can test the translations of your plugins by changing the user interface" |
| 470 |
" language in calibre under :guilabel:`Preferences->Interface->Look & feel` " |
| 471 |
"or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment " |
| 472 |
"variable set. For example::" |
| 473 |
msgstr "プラグインの翻訳をテストするには、calibreの :guilabel:`環境設定 -> インタフェース -> 外観` の主要インタフェースの「言語を選択」で言語を変更するか、``CALIBRE_OVERRIDE_LANG`` 環境変数に言語を設定してcalibreを実行します。例::" |
| 474 |
|
| 475 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:293 |
| 476 |
msgid "" |
| 477 |
"Replace ``de`` with the language code of the language you want to test." |
| 478 |
msgstr "``de`` の部分はテスとしたい言語の言語コードに置き換えてください。" |
| 479 |
|
| 480 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:295 |
| 481 |
msgid "" |
| 482 |
"For translations with plurals, use the ``ngettext()`` function instead of " |
| 483 |
"``_()``. For example::" |
| 484 |
msgstr "複数形を含む翻訳には、``_()`` ではなく ``ngettext()`` 関数を使用してください。例::" |
| 485 |
|
| 486 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:301 |
| 487 |
msgid "The plugin API" |
| 488 |
msgstr "プラグイン API" |
| 489 |
|
| 490 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:303 |
| 491 |
msgid "" |
| 492 |
"As you may have noticed above, a plugin in calibre is a class. There are " |
| 493 |
"different classes for the different types of plugins in calibre. Details on " |
| 494 |
"each class, including the base class of all plugins can be found in " |
| 495 |
":ref:`plugins`." |
| 496 |
msgstr "すでにお気づきかもしれませんが、calibre のプラグインとはクラスです。calibre プラグインの種類ごとに異なるクラスがあります。すsべてのプラグインの基底クラスのを含め、それぞれのクラスについての詳細は :ref:`plugins` に記載されています。" |
| 497 |
|
| 498 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:306 |
| 499 |
msgid "" |
| 500 |
"Your plugin is almost certainly going to use code from calibre. To learn how" |
| 501 |
" to find various bits of functionality in the calibre code base, read the " |
| 502 |
"section on the calibre :ref:`code_layout`." |
| 503 |
msgstr "プラグインはほぼ確実に calibre のコードを使用します。calibre のコードベースの機能についてすみからすみまで学ぶには、calibre の:ref:`code_layout` の章をお読みください。" |
| 504 |
|
| 505 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:311 |
| 506 |
msgid "Debugging plugins" |
| 507 |
msgstr "デバッグプラグイン" |
| 508 |
|
| 509 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:313 |
| 510 |
msgid "" |
| 511 |
"The first, most important step is to run calibre in debug mode. You can do " |
| 512 |
"this from the command line with::" |
| 513 |
msgstr "最初の、そして最も重要なステップは calibre をデバッグモードで実行することです。これはコマンドラインから次のようにして実行できます::" |
| 514 |
|
| 515 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:317 |
| 516 |
msgid "" |
| 517 |
"Or from within calibre by right-clicking the :guilabel:`Preferences` button " |
| 518 |
"or using the :kbd:`Ctrl+Shift+R` keyboard shortcut." |
| 519 |
msgstr "または calibre の中で :guilabel:`環境設定` ボタンを右クリックするか、キーボードショートカットの :kbd:`Ctrl+Shift+R` を使用します。" |
| 520 |
|
| 521 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:319 |
| 522 |
msgid "" |
| 523 |
"When running from the command line, debug output will be printed to the " |
| 524 |
"console, when running from within calibre the output will go to a txt file." |
| 525 |
msgstr "コマンドラインから実行すると、デバッグ出力はコンソール上に表示されます。calibre の中から実行するとテキストファイルに保存されます。" |
| 526 |
|
| 527 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:321 |
| 528 |
msgid "" |
| 529 |
"You can insert print statements anywhere in your plugin code, they will be " |
| 530 |
"output in debug mode. Remember, this is Python, you really shouldn't need " |
| 531 |
"anything more than print statements to debug ;) I developed all of calibre " |
| 532 |
"using just this debugging technique." |
| 533 |
msgstr "プラグインコードのどこにでも print 文を挿入できます。これはデバッグモードで出力されます。これは Python ですから、デバッグには print 文以上のものが必要になることはありません。calibre はこのデバッグ手法だけを用いて開発されました。" |
| 534 |
|
| 535 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:323 |
| 536 |
msgid "" |
| 537 |
"You can quickly test changes to your plugin by using the following command " |
| 538 |
"line::" |
| 539 |
msgstr "プラグインへの変更は次のコマンドラインを使ってすぐにテストできます::" |
| 540 |
|
| 541 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:328 |
| 542 |
msgid "" |
| 543 |
"This will shutdown a running calibre, wait for the shutdown to complete, " |
| 544 |
"then update your plugin in calibre and relaunch calibre." |
| 545 |
msgstr "これは calibre をシャットダウンし、シャットダウンの完了を待ち、calibre のプラグインを更新し、calibre を再起動します。" |
| 546 |
|
| 547 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:331 |
| 548 |
msgid "More plugin examples" |
| 549 |
msgstr "プラグインのその他の例" |
| 550 |
|
| 551 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:333 |
| 552 |
msgid "" |
| 553 |
"You can find a list of many sophisticated calibre plugins `here " |
| 554 |
"<https://www.mobileread.com/forums/showthread.php?t=118764>`_." |
| 555 |
msgstr "多くの洗練された calibre プラグインの一覧は `こちら <https://www.mobileread.com/forums/showthread.php?t=118764>`_ にあります。" |
| 556 |
|
| 557 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:336 |
| 558 |
msgid "Sharing your plugins with others" |
| 559 |
msgstr "プラグインの共有" |
| 560 |
|
| 561 |
#: ../../../__w/calibre/calibre/manual/creating_plugins.rst:338 |
| 562 |
msgid "" |
| 563 |
"If you would like to share the plugins you have created with other users of " |
| 564 |
"calibre, post your plugin in a new thread in the `calibre plugins forum " |
| 565 |
"<https://www.mobileread.com/forums/forumdisplay.php?f=237>`_." |
| 566 |
msgstr "作成したプラグインを他の calibre ユーザと共有したければ、 `calibre プラグインフォーラム <https://www.mobileread.com/forums/forumdisplay.php?f=237>`_ に新しいスレッドとして投稿してください。" |