OSDN Git Service

翻訳終り!
authorshizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 5 Feb 2009 17:26:20 +0000 (17:26 +0000)
committershizuki <shizuki@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 5 Feb 2009 17:26:20 +0000 (17:26 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@902 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/nucleus/documentation/devdocs/plugins.html

index 3b41395..b227a89 100755 (executable)
@@ -50,7 +50,7 @@
 \r
 <div class="heading">\r
 <a id="top" name="top">プラグイン API</a>\r
-<em>2008年9月5日</em>\r
+<em>2009年2月6日</em>\r
 </div>\r
 \r
 <div class="note-trans"><strong>訳者注:</strong> \r
@@ -1559,56 +1559,56 @@ Nucleusプラグインはなにか重要なことが起きたときに発生す
        </tr>\r
        <tr>\r
                <td>TemplateExtraFields</td>\r
-               <td>(v3.40) Called when templates are edited and updated from the admin area. Allows plugin developers to add fields to existing templates to encourage the use of the core template storage system to provide formatting for their output. It is the responsibility of the plugin authors to use the template fields they add and to provide the variables used in those fields. Plugins should also document their variables and provide for a default, either in the code or through a plugin option. <a href="http://forum.nucleuscms.org/viewtopic.php?p=87672#87672" title="Sample">Sample plugin using this event.</a></td>\r
+               <td>(v3.40) テンプレートが編集・更新される時。プラグイン製作者がコアのテンプレートシステムをより使いやすくするために、テンプレートにフィールドを追加する事が出来ます。プラグイン作者は追加するテンプレートフィールドの初期状態をプラグインオプションに保存し、そこで使用するテンプレート変数についてのドキュメントを書くことが要求されます。また、このイベントに関するサンプルプラグインが、フォーラムの<a href="http://japan.nucleuscms.org/bb/viewtopic.php?p=24401#24401" title="Sample">新API「TemplateExtraFields」を使ったプラグインの見本</a>(本家フォーラムのスレッドは <a href="http://forum.nucleuscms.org/viewtopic.php?p=87672#87672" title="Sample">Skin specific values for Plugins</a>)にあります。</td>\r
                <td><dl>\r
                        <dt class="ref">fields</dt>\r
-                       <dd>Associative Array. Key should be name of the plugin, i.e. <code>NP_TemplateTest</code>, and value should be an associative array with keys designating the template field name, and values designating the label used for the field. Template field names should be lowercase and incorporate the plugin name to avoid duplication of template field names.</dd>\r
+                       <dd>プラグイン名をキーにした連想配列。配列の内容は、テンプレートのフィールド名をキーにした連想配列で、その値はフォームのフィールドに表示されるラベル。フィールド名は全て英数小文字で、フィールド名の重複を避けるためにプラグイン名を含んでいる事が好ましい。</dd>\r
                </dl></td>\r
        </tr>\r
        <tr>\r
                <td>PreArchiveListItem</td>\r
-               <td>(v3.40) アーカイブリストが表示される前。 Allows plugin developers to add/modify template variables in the Archive List Item field of the template used for displaying archive lists. Plugins should document the variables added. </td>\r
+               <td>(v3.40) アーカイブリストが表示される前。アーカイブリストを表示するために使われたテンプレートのアーカイブリスト本体フィールドのテンプレート変数を追加/修正することを可能にします。追加のテンプレート変数についてのドキュメントも整備すべきです。</td>\r
                <td><dl>\r
                        <dt class="ref">listitem</dt>\r
-                       <dd>Associative Array. The key represents the template variable, i.e. <code>month</code>, and the value of the array element is a string representing the value of the template variable. To add a variable, simply add an element to this array with a key-value pair representing the new variable.</dd>\r
+                       <dd>テンプレート変数をキーにした連想配列。値はテンプレート変数に置き換えられる内容。この配列にキーと値のペアを追加する事で、新しい変数が追加できます。</dd>\r
                </dl></td>\r
        </tr>\r
        <tr>\r
                <td>PreCategoryListItem</td>\r
-               <td>(v3.40) Called right before the category list is displayed. Allows plugin developers to add/modify template variables in the Category List Item field of the template used for displaying category lists. Plugins should document the variables added. </td>\r
+               <td>(v3.40) カテゴリーリストが表示される前。カテゴリーリストを表示するために使われたテンプレートのカテゴリーリスト本体フィールドのテンプレート変数を追加/修正することを可能にします。追加のテンプレート変数についてのドキュメントも整備すべきです。</td>\r
                <td><dl>\r
                        <dt class="ref">listitem</dt>\r
-                       <dd>Associative Array. The key represents the template variable, i.e. <code>catname</code>, and the value of the array element is a string representing the value of the template variable. To add a variable, simply add an element to this array with a key-value pair representing the new variable.</dd>\r
+                       <dd>テンプレート変数をキーにした連想配列。値はテンプレート変数に置き換えられる内容。この配列にキーと値のペアを追加する事で、新しい変数が追加できます。</dd>\r
                </dl></td>\r
        </tr>\r
        <tr>\r
                <td>PreBlogListItem</td>\r
-               <td>(v3.40) Called right before the blog list is displayed. Allows plugin developers to add/modify template variables in the Blog List Item field of the template used for displaying blog lists. Plugins should document the variables added. </td>\r
+               <td>(v3.40) ブログリストが表示される前。ブログリストを表示するために使われたテンプレートのブログリスト本体フィールドのテンプレート変数を追加/修正することを可能にします。追加のテンプレート変数についてのドキュメントも整備すべきです。</td>\r
                <td><dl>\r
                        <dt class="ref">listitem</dt>\r
-                       <dd>Associative Array. The key represents the template variable, i.e. <code>blogname</code>, and the value of the array element is a string representing the value of the template variable. To add a variable, simply add an element to this array with a key-value pair representing the new variable.</dd>\r
+                       <dd>テンプレート変数をキーにした連想配列。値はテンプレート変数に置き換えられる内容。この配列にキーと値のペアを追加する事で、新しい変数が追加できます。</dd>\r
                </dl></td>\r
        </tr>\r
        <tr>\r
                <td>PreTemplateRead</td>\r
-               <td>(v3.40) Called right before a template is read and its parts returned. Allows plugin developers to change the name of the template being used. NP_MultiLanguage makes use of this event. </td>\r
+               <td>(v3.40) テンプレートが読み込まれる直前。読み込むテンプレートを変更する事が出来ます。NP_MultiLanguage はこのイベントを使用しています。</td>\r
                <td><dl>\r
                        <dt class="ref">name</dt>\r
-                       <dd>String containing the name of the template being called.</dd>\r
+                       <dd>呼び出されるテンプレートの名前</dd>\r
                </dl></td>\r
        </tr>\r
        <tr>\r
                <td>CustomLogin</td>\r
-               <td>(v3.40) Called right before local (Nucleus) login. Allows plugin developers to customize the login process. This simplifies external authentication and permits using something beside the displayname, i.e. email address, to be used for the login name. </td>\r
+               <td>(v3.40) Nucleus にログインする直前。ログインの手順をカスタマイズできます。外部認証を簡素化し、ログイン ID にメールアドレス等を使用出来る様になります。</td>\r
                <td><dl>\r
                        <dt class="ref">login</dt>\r
-                       <dd>String containing the name entered by user in login field. If this is other than the Nucleus mname (display name), it should be mapped by the plugin, after a successful authentication, to a valid mname corresponding to the authenticated member. Otherwise the authentication will last only one page and no cookies will be set.</dd>\r
+                       <dd>ユーザーが「ログインID」フィールドに入力した文字列。Nucleus のメンバーとして登録されているなら、プラグイン側で外部認証された「ログインID」と Nucleus のそれを紐つけるべきです。そうでないとクッキーがセットされず、ページを移動するごとにログアウトしてしまいます。</dd>\r
                        <dt class="ref">password</dt>\r
-                       <dd>String containing the password entered by user in password field.</dd>\r
+                       <dd>ユーザーが「パスワード」フィールドに入力した文字列。</dd>\r
                        <dt class="ref">success</dt>\r
-                       <dd>Integer indicating whether the login is successful. 1 means success, 0 means unsuccessful. 0 is the default. The plugin should set this.</dd>\r
+                       <dd>認証が成功したかどうかのフラグ。「1」が成功。失敗だと「0」。初期値は「0」。プラグイン側でセットします。</dd>\r
                        <dt class="ref">allowlocal</dt>\r
-                       <dd>Integer indicating whether local authentication should be tried after an unsuccessful authentication by your plugin. 1 means yes, 0 means no. 1 is the default.</dd>\r
+                       <dd>整数値。プラグイン側で外部認証に失敗した後に、Nucleus のログインを試すかどうかのフラグ。「1」が試す「0」が試さない。初期値は「1」プラグイン側でセットします。</dd>\r
                </dl></td>\r
        </tr>\r
 <!--\r
@@ -2332,19 +2332,19 @@ define('_ABCDEF_MESSAGENAME',                  '実際のメッセージ');
        </tr>\r
 </table>\r
 \r
-<p>Using a template to format your output is always a good idea. You may want to output an unordered list, but another user may want the same data \r
-separated by a simple character, or other unique format. Nucleus provides two ways to create and store the template data. In both \r
-examples below, we will be creating a template with 2 variables, <code>&lt;%foo%&gt;</code> and <code>&lt;%bar%&gt;</code>.</p>\r
+<p>常に出力する文字列をテンプレートを使って整形するのは良い考えです。あなたが順不同のリストで出力したいと考えていたとしても、別のユーザーは同じデータを\r
+記号で区切ったり、特別な形で出力したいと考えるかもしれません。Nucleus にはテンプレートデータを作ったり定義したりする2種類の方法があります。\r
+次に上げるれいの両方において、<code>&lt;%foo%&gt;</code> と <code>&lt;%bar%&gt;</code> のふたつのテンプレート変数を使用します。</p>\r
 \r
 <ol>\r
-       <li><strong>Using Plugin Options</strong>. This method may be the simplest and will work on all versions 3.2 and higher. It's \r
-       big disadvantage is that plugin options are deleted during an uninstall, so your users may lose customizations during an upgrade of \r
-       your plugin. Simply create an option in the <code>install()</code> method like the following:\r
+       <li><strong>プラグインのオプションを使う方法。</strong>この方法は v3.2 以降で使用でき、次のように <code>install()</code> メソッド\r
+       に記述する事によって簡単に作成する事が出来ますが、アップグレードのためにプラグインを削除した時に、ユーザーは同時にカスタマイズした\r
+       テンプレートを失ってしまうという大きなデメリットがあります。\r
        <pre class="example"><code>$this-&gt;createOption('my_template', \r
-               'Template used to format output of plugin.', \r
+               'プラグインの出力の為のテンプレート', \r
                'textarea', \r
                '&lt;li&gt;&lt;%foo%&gt; loves &lt;%bar%&gt;&lt;/li&gt;');</code></pre>\r
-       Then in the <code>doSkinVar()</code> method, determine the values of <code>foo</code> and <code>bar</code> and fill the template like this:\r
+       <code>doSkinVar()</code> メソッドで、<code>foo</code> と <code>bar</code> を次のように定義して、テンプレートを埋めます。\r
        <pre class="example"><code>$mytemplate = $this-&gt;getOption('my_template');\r
 $couples = array(\r
                        array(\r
@@ -2360,23 +2360,26 @@ $couples = array(
 foreach ($couples as $values) {\r
        echo TEMPLATE::fill($mytemplate,$values);\r
 }</code></pre>\r
-       Now the skinvar for our plugin <code>&lt;%TemplateTest%&gt;</code> will output three lines like this:\r
+       これでプラグインのスキン変数 <code>&lt;%TemplateTest%&gt;</code> を書いたところに、次のように出力されます。\r
        <pre class="example"><code>&lt;li&gt;Ricky loves Lucy&lt;/li&gt;\r
 &lt;li&gt;Sid loves Nancy&lt;/li&gt;\r
 &lt;li&gt;Mickey loves Minnie&lt;/li&gt;</code></pre>\r
        </li>\r
        \r
-       <li><strong>Using Nucleus Core Template System</strong>. This method will only work with versions 3.4 and higher. It has the advantage of \r
-       being using the database-stored template system and can be exported like other template fields. For a full sample plugin using this method, \r
-       see this <a href="http://forum.nucleuscms.org/viewtopic.php?p=87672#87672" title="Sample">thread from the support forum</a>. A summary is given here. \r
-       First, create the option in <code>install()</code> as in method 1, but now we will use it as a default.\r
+       <li><strong>Nucleus コアのテンプレートシステムを使う方法。</strong>この方法は v3.4以降で使用できます。この方法の利点は、他のテンプレートと\r
+       同じようにデータベースに格納され、配布用にテンプレートをエクスポートできるところにあります。この API を使用したプラグインのサンプルが、\r
+       フォーラムの<a href="http://japan.nucleuscms.org/bb/viewtopic.php?p=24401#24401" title="Sample">新API「TemplateExtraFields」を使ったプラグインの見本</a>に\r
+       (本家フォーラムのスレッドは <a href="http://forum.nucleuscms.org/viewtopic.php?p=87672#87672" title="Sample">Skin specific values for Plugins</a>)\r
+       にあります。細かな点は本家フォーラムの <a href="http://forum.nucleuscms.org/viewtopic.php?p=87672#87672" title="Sample">Skin specific values for Plugins</a> スレッド\r
+       を参照してください。ここでは要約のみ書いてあります。\r
+       まず、<code>install()</code> メソッド中でプラグインオプションを作成し、ここでテンプレートのデフォルトの内容を定義します。\r
        <pre class="example"><code>$this-&gt;createOption('my_template', \r
                'Template used to format output of plugin.', \r
                'textarea', \r
                '&lt;li&gt;&lt;%foo%&gt; loves &lt;%bar%&gt;&lt;/li&gt;');</code></pre>\r
-       Then, subscribe to the <code>TemplateExtraFields</code> event like this:\r
+       次に割り込みをかけるイベントのリストに <code>TemplateExtraFields</code> を登録します。\r
        <pre class="example"><code>function getEventList() { return array('TemplateExtraFields'); }</code></pre>\r
-       Then, create a <code>event_TemplateExtraFields</code> method in your plugin, like this:\r
+       そして、<code>event_TemplateExtraFields</code> メソッドを作成します。\r
        <pre class="example"><code>function event_TemplateExtraFields(&amp;$data) {\r
     /* Add an element in the $data['fields'] array using your plugin name as the key \r
        and an associative array containing the field name and field label*/\r
@@ -2386,8 +2389,7 @@ foreach ($couples as $values) {
         'templatetest_body'=&gt;'TemplateTest Body'\r
     );\r
 }</code></pre>\r
-       Then, in the <code>doSkinVar()</code> method, you need to retrieve the template and fill it. Note the skinvar now needs to take \r
-       the template name as a parameter.\r
+       最後に <code>doSkinVar()</code> メソッドで、テンプレートを埋めます。この時、スキン変数の引数に使用するテンプレート名が必要です。\r
        <pre class="example"><code>function doSkinVar($skinType,$template = '') {\r
        global $blog, $CONF, $manager,$member;\r
 \r
@@ -2410,22 +2412,21 @@ foreach ($couples as $values) {
                echo TEMPLATE::fill($template['templatetest_body'],$values);\r
        }       \r
 }</code></pre>\r
-       Here, the user needs to go to the template he wants to use and enter the formatting he desires into the TemplateTest Body field. \r
-       For our purposes, we are using the default/index template. He may enter something like this:\r
+       ユーザーは『テンプレート編集』画面で、「TemplateTest Body」フィールドに出力したい形式でテンプレートを編集します。\r
+       例えば「default/index」テンプレートを使って、こんな風にテンプレートを編集します。\r
        <pre class="example"><code>&lt;li&gt;&lt;%foo%&gt; loves &lt;%bar%&gt;!!!&lt;/li&gt;</code></pre>\r
-       And using a SkinVar like <code>&lt;%TemplateTest(default/index)%&gt;</code> will output this:\r
+       そしてスキンに <code>&lt;%TemplateTest(default/index)%&gt;</code> と書くと、そこに\r
        <pre class="example"><code>&lt;li&gt;Ricky loves Lucy!!!&lt;/li&gt;\r
 &lt;li&gt;Sid loves Nancy!!!&lt;/li&gt;\r
-&lt;li&gt;Mickey loves Minnie!!!&lt;/li&gt;</code></pre>\r
+&lt;li&gt;Mickey loves Minnie!!!&lt;/li&gt;</code></pre>と表示されます。<br />\r
        </li>\r
        \r
-       <li><strong>Formatting Items Using Regular Template</strong>. This applies only to versions 3.40 and higher and for \r
-       plugins which output items. It has the advantage of using the existing Item fields in the core template system, \r
-       just like the <code>&lt;%blog%&gt;</code> SkinVar does. This requires the use of a method in the BLOG class called \r
-       <code>readLogFromList()</code> and requires that you input an array of itemids and a template name. If you need to \r
-       add variables to the template, you can do so using the <code>doTemplateVar()</code> method. Here is an example of \r
-       a <code>doSkinVar()</code> method that uses this technique. It takes 4 itemids as parameters, then outputs those four \r
-       items using the default/index template\r
+       <li><strong>通常のテンプレートを使って書式化。</strong>この方法は v3.4 以降で、アイテムを出力するプラグインで使用できます。\r
+       この方法にはコアのテンプレートシステムの既存の「アイテム」フィールドを使うというアドバンテージがあり、スキン変数の <code>&lt;%blog%&gt;</code> \r
+       の様に使用します。スキン変数の引数として、一つ以上のアイテムの ID と使用するテンプレート名を、また、BLOG クラスの <code>readLogFromList()</code> \r
+       メソッドを呼び出せることが条件です。テンプレート変数として使用したい場合は、<code>doTemplateVar()</code> メソッドで使用することも出来ます。\r
+       例として <code>doSkinVar()</code> メソッドでこのテクニックを使う方法を示しておきます。\r
+       4つのアイテムの ID を引数として受け取り、「default/index」テンプレートを使って出力します。\r
        <pre class="example"><code>function doSkinVar($skinType,$item1 = 0,$item2 = 0,$item3 = 0,$item4 = 0) {\r
        global $blog;\r
        $highlight = '';\r
@@ -2440,10 +2441,11 @@ foreach ($couples as $values) {
 \r
 <h1>Additional Reading <a name="additional-reading" href="#top" class="toplink"><img src="../icon-up.gif" width="15" height="15" alt="back to top" /></a></h1>\r
 \r
-<p>As this document is intended to get you started, there are other resources available that offer additional insight.</p>\r
+<p>このドキュメント以外にもあなたがプラグインを開発するにあたって、リンク先のページもきっと役立つことと思います。</p>\r
 <ul>\r
-<li><a href="http://wiki.nucleuscms.org/plugindev:index" title="Development Wiki">Development Wiki</a></li>\r
-<li><a href="sqltables.html" title="Database Tables">Nucleus Database Table Structure</a></li>\r
+<li><a href="http://wiki.nucleuscms.org/plugindev:index" title="Development Wiki">Development Wiki(公式サイト(英語))</a></li>\r
+<li><a href="http://japan.nucleuscms.org/wiki/plugindev" title="Development Wiki">Nucleusプラグインの技術情報(日本公式サイト)</a></li>\r
+<li><a href="sqltables.html" title="Database Tables">Nucleus - SQL テーブル構造</a></li>\r
 <!-- <li><a href="" title=""></a></li> -->\r
 </ul>\r
 \r