# SOME DESCRIPTIVE TITLE. # Copyright (C) Kovid Goyal # This file is distributed under the same license as the calibre package. # # Translators: # akihiko tanae (tanaeakihiko), 2025-2026 msgid "" msgstr "" "Project-Id-Version: calibre\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-02-17 16:44+0000\n" "PO-Revision-Date: 2014-06-17 08:35+0000\n" "Last-Translator: akihiko tanae (tanaeakihiko), 2025-2026\n" "Language-Team: Japanese (http://app.transifex.com/calibre/calibre/language/ja/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ja\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:4 msgid "Writing your own plugins to extend calibre's functionality" msgstr "プラグインを書いて calibre を機能拡張" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:6 msgid "" "calibre has a very modular design. Almost all functionality in calibre comes" " in the form of plugins. Plugins are used for conversion, for downloading " "news (though these are called recipes), for various components of the user " "interface, to connect to different devices, to process files when adding " "them to calibre and so on. You can get a complete list of all the built-in " "plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`." msgstr "calibre の設計は非常にモジュラーです。ほとんどすべての calibre の機能がプラグインという形で提供されます。プラグインは変換、ニュースのダウンロード (ただしこれはレシピと呼ばれます)、ユーザインタフェースのさまざまな部品、いろいろなデバイスへの接続、calibre にファイルを追加する際の処理など、多岐にわたって使用されます。ビルトインのプラグインは、:guilabel:`環境設定->高度な設定->プラグイン` ですべてを確認できます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:8 msgid "" "Here, we will teach you how to create your own plugins to add new features " "to calibre." msgstr "ここでは独自のプラグインを作成して calibre に新しい機能を追加する方法を説明します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:13 msgid "Contents" msgstr "目次" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:15 msgid "This only applies to calibre releases >= 0.8.60" msgstr "これが適用されるのは calibre のリリース 0.8.60 以降に限られます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:18 msgid "Anatomy of a calibre plugin" msgstr "calibre プラグインの構造" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:20 msgid "" "A calibre plugin is very simple, it's just a ZIP file that contains some " "Python code and any other resources like image files needed by the plugin. " "Without further ado, let's see a basic example." msgstr "calibre のプラグインはとてもシンプルです。Python のコードと、プラグインが必要とする画像ファイルなどのその他リソースからなる単なる ZIP ファイルにすぎません。これ以上面倒なことは避けて、基本的な例を見てみましょう。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:24 msgid "" "Suppose you have an installation of calibre that you are using to self " "publish various e-documents in EPUB and MOBI formats. You would like all " "files generated by calibre to have their publisher set as \"Hello world\", " "here's how to do it. Create a file named :file:`__init__.py` (this is a " "special name and must always be used for the main file of your plugin) and " "enter the following Python code into it:" msgstr "EPUB および MOBI 形式のさまざまな電子ドキュメントを自己出版するために calibre をインストールしているとしましょう。calibre で生成したすべてのファイルの発行元を「Hello World」に設定したい場合には、次のようにします。:file:`__init__.py` という名前でファイルを作成し (これは特別な名前で、プラグインのメインファイルとして必ず使用しなくてはなりません)、その中に次の Python コードを入力します:" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:32 msgid "" "That's all. To add this code to calibre as a plugin, simply run the " "following in the folder in which you created :file:`__init__.py`::" msgstr "これでおしまいです。あとは :file:`__init__.py` を作成したフォルダで次のコードを実行するだけで、このコードを calibre にプラグインとして追加できます::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:38 msgid "" "On macOS, the command line tools are inside the calibre bundle, for example," " if you installed calibre in :file:`/Applications` the command line tools " "are in :file:`/Applications/calibre.app/Contents/MacOS/`." msgstr "macOS では、コマンドラインツールは calibre にバンドルされています。たとえばcalibre を :file:`/Applications` にインストールした場合には、コマンドラインツールは :file:`/Applications/calibre.app/Contents/MacOS/` にあります。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:42 msgid "" "You can download the Hello World plugin from " ":download_file:`helloworld_plugin.zip`." msgstr "Hello World プラグインは :download_file:`helloworld_plugin.zip` からダウンロード可能です。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:45 msgid "" "Every time you use calibre to convert a book, the plugin's :meth:`run` " "method will be called and the converted book will have its publisher set to " "\"Hello World\". This is a trivial plugin, let's move on to a more complex " "example that actually adds a component to the user interface." msgstr "calibre で本を変換するたびにプラグインの :meth:`run()` メソッドが呼び出され、変換した本の発行元は \"Hello World\" に設定されます。これは非常に簡単なプラグインですが、ユーザインタフェースに実際にコンポーネントを追加するようなもっと複雑な例に移りましょう。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:50 msgid "A User Interface plugin" msgstr "ユーザインタフェースプラグイン" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:52 msgid "" "This plugin will be spread over a few files (to keep the code clean). It " "will show you how to get resources (images or data files) from the plugin " "ZIP file, allow users to configure your plugin, how to create elements in " "the calibre user interface and how to access and query the books database in" " calibre." msgstr "このプラグインはいくつかのファイルに分散されています (コードをきれいに保つため)。ここでプラグイン ZIP ファイルからリソース (画像やデータファイル) を取得し、ユーザにプラグインの設定を許可し、calibre のユーザインタフェースに要素を作成し、calibre のデータベースにアクセスしてクエリを発行する方法を紹介します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:57 msgid "" "You can download this plugin from :download_file:`interface_demo_plugin.zip`" msgstr "このプラグインは :download_file:`interface_demo_plugin.zip` からダウンロード可能です。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:61 msgid "" "The first thing to note is that this ZIP file has a lot more files in it, " "explained below, pay particular attention to ``plugin-import-name-" "interface_demo.txt``." msgstr "最初に注意すべきは、この ZIP ファイルには以下に説明するとおりもっと多くのファイルが含まれているということです。特に ``plugin-import-name-interface_demo.txt`` には注意してください。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:64 msgid "**plugin-import-name-interface_demo.txt**" msgstr "**plugin-import-name-interface_demo.txt**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:65 msgid "" "An empty text file used to enable the multi-file plugin magic. This file " "must be present in all plugins that use more than one .py file. It should be" " empty and its filename must be of the form: ``plugin-import-" "name-**some_name**.txt``. The presence of this file allows you to import " "code from the .py files present inside the ZIP file, using a statement " "like::" msgstr "マルチファイルプラグインマジックを有効にするために使われる空のテキストファイル。このファイルは複数の .py ファイルを使うプラグインには必ず必要です。中身は空でなくてはならず、ファイル名は ``plugin-import-name-**some_name**.txt`` の形式にする必要があります。このファイルが存在すると ZIP ファイルの中にある .py ファイルからコードをインポートできるようになります。それには次のように記述します::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:71 msgid "" "The prefix ``calibre_plugins`` must always be present. ``some_name`` comes " "from the filename of the empty text file. ``some_module`` refers to " ":file:`some_module.py` file inside the ZIP file. Note that this importing is" " just as powerful as regular Python imports. You can create packages and " "subpackages of .py modules inside the ZIP file, just like you would normally" " (by defining __init__.py in each sub-folder), and everything should \"just " "work\"." msgstr "必ずプリフィックス ``calibre_plugins`` をつける必要があります。``some_name`` は空のテキストファイルのファイル名から取得します。 ``some_module`` は ZIP ファイル内の :file:`some_module.py` を参照します。このインポートは Python の普通のインポートと同じくらい強力です。通常と同じように (各サボフォルダに __init__.py を定義することにより) ZIP ファイルの中に .py モジュールのパッケージとサブパッケージを作成でき、すべては \"ちゃんと動きます\" 。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:76 msgid "" "The name you use for ``some_name`` enters a global namespace shared by all " "plugins, **so make it as unique as possible**. But remember that it must be " "a valid Python identifier (only alphabets, numbers and the underscore)." msgstr "``some_name`` に使う名前はすべてのプラグインで共有するグローバルな名前空間に入るので、**可能な限り一意なものにしてください**。そしてこれは有効な Python の識別子 (英数字およびアンダースコアの使用可能) でなくてはなりません。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:79 msgid "**__init__.py**" msgstr "**__init__.py**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:80 msgid "As before, the file that defines the plugin class" msgstr "前述したように、プラグインクラスを定義するファイル" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:82 msgid "**main.py**" msgstr "**main.py**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:83 msgid "This file contains the actual code that does something useful" msgstr "このファイルに便利な何かを行う実際のコードが含まれます" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:85 msgid "**ui.py**" msgstr "**ui.py**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:86 msgid "This file defines the interface part of the plugin" msgstr "このファイルはプラグインのインタフェース部分を定義します" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:88 msgid "**images/icon.png**" msgstr "**images/icon.png**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:89 msgid "The icon for this plugin" msgstr "このプラグインのアイコン" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:91 msgid "**about.txt**" msgstr "**about.txt**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:92 msgid "A text file with information about the plugin" msgstr "このプラグインに関する情報を含むテキストファイル" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:94 msgid "**translations**" msgstr "**translations**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:95 msgid "" "A folder containing .mo files with the translations of the user interface of" " your plugin into different languages. See below for details." msgstr "プラグインのユーザインタフェースを別の言語に翻訳するための .mo ファイルが入ったフォルダ" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:99 msgid "Now let's look at the code." msgstr "ではコードを見てみましょう。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:102 msgid "__init__.py" msgstr "__init__.py" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:104 msgid "First, the obligatory ``__init__.py`` to define the plugin metadata:" msgstr "プラグインのメタデータを定義するために必須な ``__init__.py``:" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:109 msgid "" "The only noteworthy feature is the field :attr:`actual_plugin`. Since " "calibre has both command line and GUI interfaces, GUI plugins like this one " "should not load any GUI libraries in __init__.py. The actual_plugin field " "does this for you, by telling calibre that the actual plugin is to be found " "in another file inside your ZIP archive, which will only be loaded in a GUI " "context." msgstr "注目すべき機能はフィールド :attr:`actual_plugin` だけです。calibre にはコマンドラインと GUI インタフェースが両方あるため、このような GUI プラグインは __init__.py の中で GUI ライブラリをロードすべきではありません。actual_plugin が calibre に実際のプラグインが ZIP アーカイブ内の別のファイルに見つかったことを知らせて、GUI コンテキストでのみロードされるようになります。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:114 msgid "" "Remember that for this to work, you must have a plugin-import-name-" "some_name.txt file in your plugin ZIP file, as discussed above." msgstr "これを機能させるには、上で説明したようにプラグイン ZIP ファイルの中に plugin-import-name-some_name.txt が必要です。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:117 msgid "" "Also there are a couple of methods for enabling user configuration of the " "plugin. These are discussed below." msgstr "プラグインのユーザ設定を有効にする方法は、いくつか存在します。それについては下で説明します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:120 msgid "ui.py" msgstr "ui.py" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:122 msgid "" "Now let's look at ui.py which defines the actual GUI plugin. The source code" " is heavily commented and should be self explanatory:" msgstr "では、実際の GUI プラグインを定義している ui.py を見てみましょう。ソースコードにはコメントがちりばめられているので、読めばわかるはずです:" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:128 #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:220 msgid "main.py" msgstr "main.py" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:130 msgid "The actual logic to implement the Interface Plugin Demo dialog." msgstr "Interface Plugin Demo ダイアログを実装する実際のロジック部分" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:136 msgid "Getting resources from the plugin ZIP file" msgstr "プラグイン ZIP ファイルからリソースを取得" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:138 msgid "" "calibre's plugin loading system defines a couple of built-in functions that " "allow you to conveniently get files from the plugin ZIP file." msgstr "calibre のプラグイン読み込みシステムは、プラグイン ZIP ファイルからファイルを便利に取得できるようにするためのビルトイン関数をいくつか定義しています。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:140 msgid "**get_resources(name_or_list_of_names)**" msgstr "**get_resources(name_or_list_of_names)**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:141 msgid "" "This function should be called with a list of paths to files inside the ZIP " "file. For example to access the file :file:`icon.png` in the folder images " "in the ZIP file, you would use: ``images/icon.png``. Always use a forward " "slash as the path separator, even on Windows. When you pass in a single " "name, the function will return the raw bytes of that file or None if the " "name was not found in the ZIP file. If you pass in more than one name then " "it returns a dictionary mapping the names to bytes. If a name is not found," " it will not be present in the returned dictionary." msgstr "この関数は、ZIPファイル内のファイルへのパスのリストを渡して呼び出す必要があります。例えば、ZIPファイル内のフォルダ images にあるファイル :file:`icon.png` にアクセスするには: ``images/icon.png`` とします。Windowsでも、パスの区切りとしては常にスラッシュを使用してください。名前を1つだけ渡した場合、この関数はそのファイルの生のバイト列を返します。名前がZIPファイル内に見つからない場合は、Noneを返します。複数の名前を渡した場合、名前をバイト列にマッピングした辞書を返します。名前が見つからない場合、返される辞書にはその名前は含まれません。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:150 msgid "**get_icons(name_or_list_of_names, plugin_name='')**" msgstr "**get_icons(name_or_list_of_names, plugin_name='')**" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:151 msgid "" "A wrapper for get_resources() that creates QIcon objects from the raw bytes " "returned by get_resources. If a name is not found in the ZIP file the " "corresponding QIcon will be null. In order to support icon theme-ing, pass " "in the human friendly name of your plugin as ``plugin_name``. If the user is" " using an icon theme with icons for your plugin, they will be loaded " "preferentially." msgstr "get_resources() のラッパーで、get_resources から返される生のバイト列から QIcon オブジェクトを作成します。ZIP ファイルに名前が見つからない場合、対応する QIcon は null になります。アイコンテーマをサポートするには、プラグインの人間にわかりやすい名前を ``plugin_name`` として渡してください。ユーザーがプラグイン用のアイコンを含むアイコンテーマを使用している場合は、それらのアイコンが優先的に読み込まれます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:160 msgid "Enabling user configuration of your plugin" msgstr "プラグインのユーザ設定を有効にする" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:162 msgid "" "To allow users to configure your plugin, you must define three methods in " "your base plugin class, **is_customizable**, **config_widget** and " "**save_settings** as shown below:" msgstr "ユーザがプラグインを設定できるようにするためには、プラグインの基底クラスに 3 つのメソッド、**is_customizable**, **config_widget** および **save_settings** を下に示すように定義する必要があります:" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:173 msgid "" "calibre has many different ways to store configuration data (a legacy of its" " long history). The recommended way is to use the **JSONConfig** class, " "which stores your configuration information in a .json file." msgstr "calibre には設定データを格納するのにいくつもの異なる方法があります (長い歴史の遺産です)。推奨される方法は **JSONConfig** を使用することで、これは設定情報を .json ファイルに格納します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:175 msgid "" "The code to manage configuration data in the demo plugin is in config.py:" msgstr "デモプラグインの設定データを管理するコードは config.py にあります:" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:180 msgid "" "The ``prefs`` object is now available throughout the plugin code by a " "simple::" msgstr "次のようにするだけで ``prefs`` がプラグインコード全体から使用できりうようになります::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:185 msgid "You can see the ``prefs`` object being used in main.py:" msgstr "``prefs`` オブジェクトが main.py で使われているのがわかります:" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:192 msgid "Edit book plugins" msgstr "本の編集プラグイン" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:194 msgid "" "Now let's change gears for a bit and look at creating a plugin to add tools " "to the calibre book editor. The plugin is available here: " ":download_file:`editor_demo_plugin.zip`." msgstr "それでは少し趣向を変えて、calibre の書籍エディタにツールを追加するプラグインを作成する方法を見てみましょう。プラグインはここちら: :download_file:`editor_demo_plugin.zip`" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:198 msgid "" "The first step, as for all plugins is to create the import name empty txt " "file, as described :ref:`above `. We shall name the file " "``plugin-import-name-editor_plugin_demo.txt``." msgstr "すべてのプラグインと同様、最初のステップは上記 :ref:`above ` で説明したようにインポート名の空のテキストファイルを作成することです。ここではファイルを ``plugin-import-name-editor_plugin_demo.txt`` という名前にします。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:202 msgid "" "Now we create the mandatory ``__init__.py`` file that contains metadata " "about the plugin -- its name, author, version, etc." msgstr "次に、必須である ``__init__.py`` を作成し、プラグインに関するメタデータ、すなわち名前、作者、バージョンなどを含めます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:208 msgid "" "A single editor plugin can provide multiple tools each tool corresponds to a" " single button in the toolbar and entry in the :guilabel:`Plugins` menu in " "the editor. These can have sub-menus in case the tool has multiple related " "actions." msgstr "ひとつのエディタプラグインで複数のツールを提供できます。それぞれのツールはツールバーのひとつのボタンとエディタの :guilabel:`プラグイン` メニューのエントリに対応づけられます。ツールが複数の関連した動作を持つ場合にはサブメニューにすることも可能です。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:212 msgid "" "The tools must all be defined in the file ``main.py`` in your plugin. Every " "tool is a class that inherits from the " ":class:`calibre.gui2.tweak_book.plugin.Tool` class. Let's look at " "``main.py`` from the demo plugin, the source code is heavily commented and " "should be self-explanatory. Read the API documents of the " ":class:`calibre.gui2.tweak_book.plugin.Tool` class for more details." msgstr "ツールはすべてプラグインの中の `main.py`` に定義する必要があります。すべてのツールは :class:`calibre.gui2.tweak_book.plugin.Tool` クラスを継承するクラスです。デモプラグインの ``main.py`` を見てみましょう。ソースコードにはコメントがちりばめられているので、読めばわかるはずです。詳しくは :class:`calibre.gui2.tweak_book.plugin.Tool` クラスの API ドキュメントをお読みください。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:222 msgid "" "Here we will see the definition of a single tool that will multiply all font" " sizes in the book by a number provided by the user. This tool demonstrates " "various important concepts that you will need in developing your own " "plugins, so you should read the (heavily commented) source code carefully." msgstr "ここでは、本のすべてのフォントサイズをユーザに指定された数字で掛けた大きさにするような、ひとつのツールの定義を見てみましょう。このツールは自分でプラグインを開発するときに必要となるさまざまな重要な概念を実演しているので、(コメントのちりばめられた) ソースコードをよく読んでください。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:230 msgid "" "Let's break down ``main.py``. We see that it defines a single tool, named " "*Magnify fonts*. This tool will ask the user for a number and multiply all " "font sizes in the book by that number." msgstr "``main.py`` を掘り下げてみましょう。*Magnify fonts* と名付けたひとつのツールを定義していることがわかります。このツールはユーザに数値を尋ねて、与えられた数値を本の中のすべてのフォントサイズに掛けます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:234 msgid "" "The first important thing is the tool name which you must set to some " "relatively unique string as it will be used as the key for this tool." msgstr "最初に重要なのはツール名です。このツールのキーとして使用されるため、なるべくユニークな文字列を設定する必要があります。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:237 msgid "" "The next important entry point is the " ":meth:`calibre.gui2.tweak_book.plugin.Tool.create_action`. This method " "creates the QAction objects that appear in the plugins toolbar and plugin " "menu. It also, optionally, assigns a keyboard shortcut that the user can " "customize. The triggered signal from the QAction is connected to the " "ask_user() method that asks the user for the font size multiplier, and then " "runs the magnification code." msgstr "次に重要なエントリポイントは :meth:`calibre.gui2.tweak_book.plugin.Tool.create_action` です。このメソッドはプラグインツールバーとプラグインメニューに表示される QAction を生成します。オプションで、ユーザがカスタマイズ可能なショートカットを割り当てることができます。トリガーとなる QAction からのシグナルは ask_user() に接続してユーザにフォントサイズを何倍にするかをを尋ね、その後に拡大するコードを実行します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:245 msgid "" "The magnification code is well commented and fairly simple. The main things " "to note are that you get a reference to the editor window as ``self.gui`` " "and the editor *Boss* as ``self.boss``. The *Boss* is the object that " "controls the editor user interface. It has many useful methods, that are " "documented in the :class:`calibre.gui2.tweak_book.boss.Boss` class." msgstr "拡大するコードにはしっかりコメントが書き込まれていて、まあまあシンプルです。注意すべき主な点は、エディタウィンドウを ``self.gui``、エディタ *Boss* を ``self.boss`` として参照することです。*Boss* はエディタユーザインタフェースを制御するオブジェクトです。これには便利なメソッドがたくさんありますが、それについては :class:`calibre.gui2.tweak_book.boss.Boss` クラスに説明があります。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:251 msgid "" "Finally, there is ``self.current_container`` which is a reference to the " "book being edited as a " ":class:`calibre.ebooks.oeb.polish.container.Container` object. This " "represents the book as a collection of its constituent HTML/CSS/image files " "and has convenience methods for doing many useful things. The container " "object and various useful utility functions that can be reused in your " "plugin code are documented in :ref:`polish_api`." msgstr "最後に ``self.current_container`` があり、これは編集されようとしている本を :class:`calibre.ebooks.oeb.polish.container.Container` オブジェクトへの参照です。これは本をその構成要素であるHTML/CSS/画像 ファイルの集まりとして表し、役に立ついろいろなことができる便利なメソッドを備えています。プラグインコードで再利用可能なコンテナオブジェクトとさまざまな便利なユーティリティ関数については、:ref:`polish_api` に説明があります。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:259 msgid "Adding translations to your plugin" msgstr "プラグインに翻訳を追加" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:261 msgid "" "You can have all the user interface strings in your plugin translated and " "displayed in whatever language is set for the main calibre user interface." msgstr "プラグインのユーザインタフェース上のすべての文字列は翻訳して、メインの calibre ユーザインタフェースで設定された言語で表示することができます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:264 msgid "" "The first step is to go through your plugin's source code and mark all user " "visible strings as translatable, by surrounding them in _(). For example::" msgstr "最初のステップはプラグインのソースコードを調べ、ユーザに表示される文字列すべてを _() で囲むことにより翻訳可能としてマークすることです。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:269 msgid "" "Then use some program to generate .po files from your plugin source code. " "There should be one .po file for every language you want to translate into. " "For example: de.po for German, fr.po for French and so on. You can use the " "`Poedit `_ program for this." msgstr "それから何らかのプログラムを使ってプラグインのソースコードから .po ファイルを生成してください。翻訳したい言語ごとにひとつの .po ファイルが必要です。たとえばドイツ語用に de.po、フランス語用に fr.po といった具合です。これには `Poedit `_ が使えます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:274 msgid "" "Send these .po files to your translators. Once you get them back, compile " "them into .mo files. You can again use Poedit for that, or just do::" msgstr "これらの .po ファイルを翻訳者に送信しましょう。戻ってきたら .mo ファイルにコンパイルします。これにも Poedit を利用できます。または次のようにします::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:279 msgid "Put the .mo files into the ``translations`` folder in your plugin." msgstr ".mo ファイルをプラグインの ``translations`` フォルダに置きます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:281 msgid "" "The last step is to simply call the function `load_translations()` at the " "top of your plugin's .py files. For performance reasons you should only call" " this function in those .py files that actually have translatable strings. " "So in a typical User Interface plugin you would call it at the top of " "``ui.py`` but not ``__init__.py``." msgstr "最後のステップは、ただ単にプラグインの .pu ファイルの先頭で関数 `load_translations()` を呼び出すだけです。性能上の理由からこの関数を呼び出すのは、実際に翻訳可能な文字列が含まれている .py ファイルに限るべきです。したがって典型的なユーザインタフェースプラグインではこの関数は ``__init__.py`` ではなく ``ui.py`` の先頭で呼び出します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:287 msgid "" "You can test the translations of your plugins by changing the user interface" " language in calibre under :guilabel:`Preferences->Interface->Look & feel` " "or by running calibre with the ``CALIBRE_OVERRIDE_LANG`` environment " "variable set. For example::" msgstr "プラグインの翻訳をテストするには、calibreの :guilabel:`環境設定 -> インタフェース -> 外観` の主要インタフェースの「言語を選択」で言語を変更するか、``CALIBRE_OVERRIDE_LANG`` 環境変数に言語を設定してcalibreを実行します。例::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:293 msgid "" "Replace ``de`` with the language code of the language you want to test." msgstr "``de`` の部分はテスとしたい言語の言語コードに置き換えてください。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:295 msgid "" "For translations with plurals, use the ``ngettext()`` function instead of " "``_()``. For example::" msgstr "複数形を含む翻訳には、``_()`` ではなく ``ngettext()`` 関数を使用してください。例::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:301 msgid "The plugin API" msgstr "プラグイン API" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:303 msgid "" "As you may have noticed above, a plugin in calibre is a class. There are " "different classes for the different types of plugins in calibre. Details on " "each class, including the base class of all plugins can be found in " ":ref:`plugins`." msgstr "すでにお気づきかもしれませんが、calibre のプラグインとはクラスです。calibre プラグインの種類ごとに異なるクラスがあります。すsべてのプラグインの基底クラスのを含め、それぞれのクラスについての詳細は :ref:`plugins` に記載されています。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:306 msgid "" "Your plugin is almost certainly going to use code from calibre. To learn how" " to find various bits of functionality in the calibre code base, read the " "section on the calibre :ref:`code_layout`." msgstr "プラグインはほぼ確実に calibre のコードを使用します。calibre のコードベースの機能についてすみからすみまで学ぶには、calibre の:ref:`code_layout` の章をお読みください。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:311 msgid "Debugging plugins" msgstr "デバッグプラグイン" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:313 msgid "" "The first, most important step is to run calibre in debug mode. You can do " "this from the command line with::" msgstr "最初の、そして最も重要なステップは calibre をデバッグモードで実行することです。これはコマンドラインから次のようにして実行できます::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:317 msgid "" "Or from within calibre by right-clicking the :guilabel:`Preferences` button " "or using the :kbd:`Ctrl+Shift+R` keyboard shortcut." msgstr "または calibre の中で :guilabel:`環境設定` ボタンを右クリックするか、キーボードショートカットの :kbd:`Ctrl+Shift+R` を使用します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:319 msgid "" "When running from the command line, debug output will be printed to the " "console, when running from within calibre the output will go to a txt file." msgstr "コマンドラインから実行すると、デバッグ出力はコンソール上に表示されます。calibre の中から実行するとテキストファイルに保存されます。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:321 msgid "" "You can insert print statements anywhere in your plugin code, they will be " "output in debug mode. Remember, this is Python, you really shouldn't need " "anything more than print statements to debug ;) I developed all of calibre " "using just this debugging technique." msgstr "プラグインコードのどこにでも print 文を挿入できます。これはデバッグモードで出力されます。これは Python ですから、デバッグには print 文以上のものが必要になることはありません。calibre はこのデバッグ手法だけを用いて開発されました。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:323 msgid "" "You can quickly test changes to your plugin by using the following command " "line::" msgstr "プラグインへの変更は次のコマンドラインを使ってすぐにテストできます::" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:328 msgid "" "This will shutdown a running calibre, wait for the shutdown to complete, " "then update your plugin in calibre and relaunch calibre." msgstr "これは calibre をシャットダウンし、シャットダウンの完了を待ち、calibre のプラグインを更新し、calibre を再起動します。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:331 msgid "More plugin examples" msgstr "プラグインのその他の例" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:333 msgid "" "You can find a list of many sophisticated calibre plugins `here " "`_." msgstr "多くの洗練された calibre プラグインの一覧は `こちら `_ にあります。" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:336 msgid "Sharing your plugins with others" msgstr "プラグインの共有" #: ../../../__w/calibre/calibre/manual/creating_plugins.rst:338 msgid "" "If you would like to share the plugins you have created with other users of " "calibre, post your plugin in a new thread in the `calibre plugins forum " "`_." msgstr "作成したプラグインを他の calibre ユーザと共有したければ、 `calibre プラグインフォーラム `_ に新しいスレッドとして投稿してください。"