You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2012/08/25 02:00:47 UTC

[43/50] [abbrv] docs commit: Translate files related to plugin-development

Translate files related to plugin-development


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/e6e5a51c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/e6e5a51c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/e6e5a51c

Branch: refs/heads/master
Commit: e6e5a51ced7d86df57b7c258aa36a7b9f615996e
Parents: 2742272
Author: Keiko Oda <ke...@gmail.com>
Authored: Thu Aug 2 00:15:13 2012 -0700
Committer: Anis Kadri <an...@gmail.com>
Committed: Fri Aug 24 16:59:37 2012 -0700

----------------------------------------------------------------------
 .../guide/plugin-development/android/index.md      |  154 ++++++++++++++
 .../2.0.0/guide/plugin-development/bada/index.md   |   74 +++++++
 .../guide/plugin-development/blackberry/index.md   |  138 +++++++++++++
 docs/jp/2.0.0/guide/plugin-development/index.md    |  111 ++++++++++
 .../jp/2.0.0/guide/plugin-development/ios/index.md |  157 +++++++++++++++
 .../2.0.0/guide/plugin-development/webos/index.md  |   23 ++
 .../plugin-development/windows-phone/index.md      |   23 ++
 7 files changed, 680 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/e6e5a51c/docs/jp/2.0.0/guide/plugin-development/android/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.0.0/guide/plugin-development/android/index.md b/docs/jp/2.0.0/guide/plugin-development/android/index.md
new file mode 100644
index 0000000..910c54e
--- /dev/null
+++ b/docs/jp/2.0.0/guide/plugin-development/android/index.md
@@ -0,0 +1,154 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements. See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership. The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License. You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied. See the License for the
+         specific language governing permissions and limitations
+         under the License.
+---
+
+# Developing a Plugin on Android
+
+プラグインの開発には、 Cordova-Android のアーキテクチャの理解が必要です。
+Cordova-Android は Android WebView とそれに付属するコールバックから構成されます。
+これらのプラグインは config.xml ファイル内にクラスマッピングとして表されています。
+
+プラグインは `Pluguin` クラスを継承した少なくとも1つの Java クラスによって構成されます。
+プラグインは `PluginResult` オブジェクトを返す `execute` メソッドを **必ず **実装しなければなりません。
+加えて、プラグイン作成のベストプラクティスとして、プラグインは pause と resume イベントをサポートし、またプラグイン間のメッセージのやりとりもサポートしているべきです。
+
+## プラグインクラスのマッピング
+
+プラグインの JavaScript 部分は常に `cordova.exec` メソッドを以下のように使います:
+
+    exec(<successFunction>, <failFunction>, <service>, <action>, [<args>]);
+
+これは WebView から Android ネイティブ側へのリクエストを整理し、
+おおよそ要約すると `service` クラスで `action` メソッドを、
+`args` 配列で渡された引数と一緒に呼び出すということになります。
+
+プラグインを Java ファイルで提供するしろ JAR でするにしろ、プラグインは必ず Cordova-Anroid アプリケーションの `res/xml` フォルダーにある `config.xml` ファイルに追加されていなければなりません。
+
+    <plugin name="<service_name>" value="<full_name_including_namespace>"/>
+
+サービス名 (name) は JavaScript の `exec` の中で定義したものと一致している必要があり、値 (value) は Java クラスへのネームスペースを含んだフルパスになります。これがないと、プラグインはコンパイルはされますが、
+Cordova からアクセスできない状態となります。
+
+## Android Java プラグインの作成
+
+私たちはプラグインリクエストをネイティブ側に送る JavaScript を作成しました。
+また、正しく `config.xml` ファイルでマッピングされた Android Java プラグインもあります。
+では、最終的に Android Java プラグインのクラスがどのようになるのか見ていきましょう。
+
+JavaScript の `exec` 関数によってプラグインに割り当てられたものは、
+プラグインのクラスの `execute` メソッドに渡されます。大半の `execute`
+の実装は以下のようになります:
+
+    public PluginResult execute(String action, JSONArray args, String callbackId) {
+        PluginResult.Status status = PluginResult.Status.OK;
+        String result = "";
+
+        try {
+            if (action.equals("beep")) {
+                this.beep(args.getLong(0));
+            }
+            return new PluginResult(status, result);
+        } catch (JSONException e) {
+            return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
+        }
+    }
+
+基本的に `action` パラメーターの値を見て、クラス内の
+(プライベート) メソッドに割り振っていきます。
+また、任意でいくつかのパラメーターをそのメソッドに渡します。
+
+例外をキャッチしエラーを返すとき、 JavaScript へ返すエラーが Java で発生した例外に可能なかぎり近づけることは、明瞭さのためにも重要です。
+
+### Android プラグインの Echo プラグイン
+
+次を config.xml に追加します:
+
+    <plugin name="Echo" value="org.apache.cordova.plugin.Echo" />
+
+そして、次を Cordova-Android アプリケーションの中の
+`src/org/apache/cordova/plugin/Echo.java` に追加します:
+
+
+    package org.apache.cordova.plugin;
+
+    import org.apache.cordova.api.Plugin;
+    import org.apache.cordova.api.PluginResult;
+    import org.json.JSONArray;
+    import org.json.JSONException;
+    import org.json.JSONObject;
+
+    /**
+     * このクラスは JavaScript から呼び出された文字列をecho します。
+     */
+    public class App extends Plugin {
+
+        /**
+         * リクエストを実行し、 PluginResult を返します。
+         *
+         * @param action        実行するアクション名です。
+         * @param args          プラグインへの引数の JSONArry です。
+         * @param callbackId    JavaScript へコールバックするときに使うコールバック id です。
+         * @return              ステータスとメッセージを伴った PluginResult オブジェクトです。
+         */
+        public PluginResult execute(String action, JSONArray args, String callbackId) {
+            try {
+                if (action.equals("echo")) {
+                    String echo = args.getString(0);
+                    if (echo != null && echo.length() > 0) {
+                        return new PluginResult(PluginResult.Status.OK, echo);
+                    } else {
+                        return new PluginResult(PluginResult.Status.ERROR);
+                    }
+                } else {
+                    return new PluginResult(PluginResult.Status.INVALID_ACTION);
+                }
+            } catch (JSONException e) {
+                return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
+            }
+        }
+    }
+
+コードを見ていきましょう。一番上には、必要なすべての Cordova に関する
+`import` 文が並んでいます。クラスは `Plugin` を継承しています - これはとても
+重要です。 `Plugin` インターフェースは `execute` メソッドを実装する必要が
+あります。メソッドは、最初に `action` を見ていきます。このプラグインは1つ
+のアクション `echo` のみをサポートしています。ほかのアクションは、ステータス
+が `INVALID_ACTION` となった `PluginResult` が返されます - これは JavaScript
+側でエラーコールバックへの呼び出しに変換されます。次に、 `args` に対して
+`getString` メソッドを使い、パラメーター配列から0番目のパラメーターを取得
+することにより、 echo する文字列を取り出します。ここで、少しパラメーターに
+対してチェックを行います: `null` チェックや文字列の長さが0でないかどうかなど
+です。もしそうであった場合は、ステータスが `ERROR` の `PluginResult` を
+返します (これはもうご存知の通り JavaScript 側でエラーコールバックを
+呼び出します)。もしこれらのチェックをパスしたら、ステータスが `OK` の
+`PluginResult` を返し、パラメーターとして受け取った `echo` 文字列を
+渡します。これが、 JavaScript 側で成功コールバック関数に変換されます。
+また、 `echo` パラメーターを JavaScript の成功コールバック関数に
+パラメーターとして渡します。
+
+## プラグインのデバッグ
+
+Eclipse は Android プロジェクトのデバッグに使用でき、 Java のソースファイルがプロジェクトに含まれている場合は、プラグインもデバッグできます。最新バージョンの Android Dev Tools のみ JAR にソースコードを付与でき、これは今回はフルでサポートされていません。
+
+## よくある落とし穴
+
+* プラグインは `CordovaInterface` オブジェクトへのアクセス権を持っています。このオブジェクトはアプリケーションで走っている Android の `Activity` へのアクセス権を持っています。この `Activity` は新しい Android `Intent` を起動するために必要な `Context` です。
+`CordovaInterface` は、結果として `Activity` を開始すること、また `Intent` がアプリケーションに戻ってきたときにコールバックをセットすることをプラグインに許可します。
+`Intent` システムは Android のプロセス間の連携に使われるため、これは非常に重要です。
+* プラグインは `Context` への直接アクセス権を以前のように持っていません。以前の `ctx` はもう廃止され、 2.0 リリースの6ヶ月後に削除されます。 `Context` にあった `ctx` が存在するすべてのメソッド、 `getContext()` と `getActivity()` は必要な正しいオブジェクトを返すことが可能です。
+* `webView.loadUrl()` を使って JavaScript を呼び出すことは避けてください。コールバックサーバーがある理由は、 JavaScript がスレッドセーフで実行されるためです。 `loadUrl` は明確に UI スレッドに割り込み、プラグインのユーザビリティーに影響します。

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/e6e5a51c/docs/jp/2.0.0/guide/plugin-development/bada/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.0.0/guide/plugin-development/bada/index.md b/docs/jp/2.0.0/guide/plugin-development/bada/index.md
new file mode 100644
index 0000000..2732582
--- /dev/null
+++ b/docs/jp/2.0.0/guide/plugin-development/bada/index.md
@@ -0,0 +1,74 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+---
+
+Developing a Plugin on Bada
+===========================
+
+プラグインは Bada 2.0 以上のみサポートしています。 Bada 1.2 はサポートしていません。
+
+Bada の実装はすべて JavaScript の実装です。そのため、カスタムプラグインを追加することは、プラグインコードによって CordovaJS を更新することになります。以下は、シンプルな _Hello World_ プラグインを追加するステップです:
+
+1. CordovaJS リポジトリーを clone します
+
+        git clone https://git-wip-us.apache.org/repos/asf/incubuator-cordova-js.git
+
+2. __lib/bada/plugin/bada/__ 以下に新しい JavaScript ファイルを作成し、 _HelloWorld.js_ と名前をつけます。以下の内容を追加します:
+
+        function HelloWorld() {
+        }
+
+        HelloWorld.prototype.printHello = function(success, fail, arg) {
+            alert(Osp.Core.StringHelper('Hello %1', arg[0]));
+        }
+
+        module.exports = new HelloWorld();
+
+3. __lib/bada/platform.js__ の objects プロパティーの下に、新しく作ったプラグインへのリンクを追加します:
+
+        objects: {
+            ...
+            HelloWorld: {
+                'cordova/plugin/bada/HelloWorld'
+            },
+            ...
+        }
+        ...
+4. __lib/bada/exec.js__ のプラグインリストを、作ったプラグインを含むように更新します
+
+        var plugins = {
+            ...
+            "HelloWorld": require('cordova/plugin/bada/HelloWorld')
+        };
+5. これで、好きなようにユーザー向けの JavaScript を書くことができます。しかし、プラグインを実行するためには、以下のメソッドを呼び出す必要があることを忘れないで下さい
+
+        exec(succes, fail, 'HelloWorld', 'printHello', ['Jackson!']);
+
+    success はプラグインが正常に終了したときに実行される成功コールバック関数です
+    fail はプラグインが正常に終了しなかったときに実行されるエラーコールバック関数です
+    'HelloWorld' はあなたのプラグインの名前です
+    'printHello' はあなたのプラグインのアクション名です
+    最後のパラメーターは、プラグインへの引数です
+
+6. 以下のコマンドを実行し、新しい共通 JavaScript を生成します (npm モジュールの jake がインストールされていることを確認して下さい)
+
+        jake
+
+7. 新しく生成された __pkg/cordova.bada.js__ を、 Bada プロジェクトの __Res/js__ 以下にコピーします
+
+6. 以上です!これで、あなたは新しい Bada プラグインを追加することができ、現在は Cordova Bada でサポートされていないたくさんの機能を実装できるようになりました。

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/e6e5a51c/docs/jp/2.0.0/guide/plugin-development/blackberry/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.0.0/guide/plugin-development/blackberry/index.md b/docs/jp/2.0.0/guide/plugin-development/blackberry/index.md
new file mode 100644
index 0000000..d92c90c
--- /dev/null
+++ b/docs/jp/2.0.0/guide/plugin-development/blackberry/index.md
@@ -0,0 +1,138 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+---
+
+Developing a Plugin on BlackBerry
+=================================
+
+## Blackberry での Echo プラグインの作り方
+
+このガイドでは、 BlackBerry での Echo プラグインの作り方について説明します。
+もし上位のガイドである JavaScript パートのプラグインについてのガイドを読んでいない場合は、それを最初に読むことをおすすめします。
+加えて、 [Cordova Blackberry repo](https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-blackberry-webworks.git;a=summary) をダウンロードしてください。
+
+Cordova-BlackBerry プロジェクトは Torch, Bold, Playbook といった BlackBerry デバイスへのデプロイを可能にします。
+通常の携帯端末タイプの BlackBerry (例, Torch と Bold) とタブレットタイプの Playbook の間には、デプロイ方法に差があります。
+この2つのコードはベースが違うため、1つを開発しているときは、もう1つのためにコードを複製してあげる必要があります。
+そのため、このガイドでは携帯端末にフォーカスし、タブレットにはフォーカスしません。
+将来的には、両方のプラットフォームをカバーする予定です。
+
+
+前のガイドからの続きで、 Echo プラグインは基本的にユーザーが `window.echo`
+関数で与えたメッセージを返します。
+
+Echo 関数:
+
+    window.echo = function(str, callback) {
+            cordova.exec(callback, function(err) {
+                callback('Nothing to echo.');
+            }, "Echo", "echo", [str]);
+        };
+
+## plugins.xml の修正
+
+このファイルはプロジェクトの中の www フォルダーにあり、 Cordova プロジェクトが使用しているすべてのプラグインへの参照を含みます。
+新しい参照を追加して、 cordova.exec が呼ばれたときに、 Cordova が `cordova.exec` の "Echo" 引数を
+これから書くネイティブコードの Echo クラスにマッピングすることが分かるようにします。
+
+    <plugins>
+      ...
+      <plugin name="Echo" value="org.apache.cordova.echo.Echo"/>
+      ...
+    </plugins>
+
+## Echo.java の追加
+
+もし value 属性の構造にお気づきなら、 Echo プラグインへの定義されたパスが見えるでしょう。
+Cordova BlackBerry Webworks のリポジトリーのルートフォルダーで、 framework と呼ばれるフォルダーを探してください。
+このフォルダーは BlackBerry 上で動くすべてのソースコードを含んでいます。
+このフォルダー以下の `framework/ext/src/org/apache/cordova` にフォルダーに辿りつくまで cd し続けます。
+この時すべてのプラグインフォルダーが見えるでしょう。また、それぞれのフォルダーの中身はプラグインのソースコードとなっています。
+ここで、フォルダー echo を `framework/ext/src/org/apache/cordova/echo` に作成し、
+`Echo.java` をこの中の `framework/ext/src/org/apache/cordova/echo/Echo.java` の位置に新規追加します。
+
+## Echo.java の実装
+
+プラグインの実装の基本的なアイデアは、 Plugin クラスを継承するクラスを作成し、
+PluginResult クラスを返す execute と呼ばれるメソッドを作成することです。
+cordova.exec へのすべての呼び出しは、クラス内で実行したいアクションと引数を渡します。
+この場合、 "echo" がクラス "Echo" 内で実行したいアクションで、 [str] が渡している引数です。
+
+    package org.apache.cordova.echo;
+
+    import org.apache.cordova.api.Plugin;
+    import org.apache.cordova.api.PluginResult;
+    import org.apache.cordova.json4j.JSONArray;
+    import org.apache.cordova.json4j.JSONException;
+    import org.apache.cordova.json4j.JSONObject;
+    import org.apache.cordova.util.Logger;
+    /**
+     * BlackBerry でのプラグインの作り方デモのためのシンプルなプラグイン
+     * ユーザーがプラグインを呼び出したときのメッセージをそのまま返します
+     */
+    public final class Echo extends Plugin {
+
+        public static final String echo = "echo";
+
+        public PluginResult execute(String action, JSONArray args, String callbackId) {
+            PluginResult result = new PluginResult(PluginResult.Status.INVALID_ACTION, "Echo: Invalid action:" + action);
+            if(action.equals(echo)){
+                try {
+                    JSONObject echoObj = new JSONObject();
+                    String theMsg = args.getString(0);
+                    if(theMsg.length()>0){
+                        result = new PluginResult(PluginResult.Status.OK, theMsg);
+                    }else{
+                        result = new PluginResult(PluginResult.Status.ERROR, theMsg);
+                    }
+                } catch (JSONException e) {
+                    result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
+                }
+            }
+
+            return result;
+        }
+
+    }
+
+上のコードを見てみると、 execute メソッドの中で、最初にどんなアクションが来たかを調べているのが分かります。
+この Echo プラグインは1つのアクション "echo" のみを持つので、それのみをチェックします。
+もしプラグインに複数のアクションがあった場合は、 if 文を追加していき、これらをチェックしていきます。
+
+
+次に、 args パラメーターによって与えられた引数からメッセージを取得します。
+`String theMsg = args.getString(0);` とすることで、シンプルに一番最初の引数を取得することができます。
+
+いくつかのエラーチェックをし、もしメッセージが大丈夫そうなら、 ok ステータス (PluginResult.Status.OK) とメッセージ (theMsg) を持つ
+新しい PluginResult インスタンスを作ります。
+その後、 JavaScript に渡し、成功コールバック関数を呼び出す result を返します。
+もし何かエラーが起きた場合、 PluginResult.Status.ERROR, PluginResult.Status.JSON_EXCEPTION, PluginResult.Status.INVALID_ACTION といったような何種類かのステータス例外を返すことが出来ます。
+もしこのタイプの例外が返されたとき、 JavaScript 側ではエラーコールバックが
+呼び出されます。
+
+## www フォルダーの .jar の更新
+
+あなたのプロジェクト内で Echo.java の追加分が更新される必要があります。 .jar ファイルをビルドするためには、 BlackBerry Webworks リポジトリーのルートディレクトリに cd します。
+次の ant コマンドを使用します:
+
+    ant update -Dproject.path="~/path_to_my_project"
+
+これは build/ext フォルダーの中の新しい .jar ファイルをビルドします。
+`build/ext/cordova.jar` ファイルを プロジェクトの www/ext フォルダーにコピーします。
+
+もしすべてが上手くいったら、 BlackBerry で Echo プラグインが使用できるようになっているはずです。

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/e6e5a51c/docs/jp/2.0.0/guide/plugin-development/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.0.0/guide/plugin-development/index.md b/docs/jp/2.0.0/guide/plugin-development/index.md
new file mode 100644
index 0000000..1538786
--- /dev/null
+++ b/docs/jp/2.0.0/guide/plugin-development/index.md
@@ -0,0 +1,111 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+---
+
+# プラグイン開発ガイド
+
+Cordava プラグインは Cordova アプリケーション Webview と Cordava
+アプリケーションが走っているネイティブプラットフォームの機能的な
+橋渡しをします。プラグインはすべてのプラットフォームで使われる
+1つの JavaScript インターフェースに集約され、そのプラグイン
+インターフェースに従ったプラットフォーム独自のネイティブ実装が
+それぞれなされます。すべてのコア Cordova API はこのアーキテクチャ
+を用いて実装されています。
+
+このガイドはシンプルな Echo プラグインを書くために必要なステップを
+紹介していきます。 Echo プラグインは JavaScript から文字列を受け取り、
+それをサポートされているプラットフォームのネイティブ環境に渡します。
+このネイティブコードは同じ文字列を、プラグインの JavaScript の
+コールバックに含んで返します。
+
+このガイドから、より複雑なプラグインを書くために必要な概観や詳細が
+得られるはずです。
+
+## JavaScript
+
+すべてのプラグインの最初の一歩は JavaScript です。開発者が Cordova を
+使う理由は、 Objective-C でも Java でも C# でもなく、 JavaScript を使って
+コードが書けるからです。プラグインにとって JavaScript インターフェースは
+まさしく顔であり、もっとも重要な部分であると言えるでしょう。
+
+あなたはプラグインの JavaScript を好きなように構成できます。ただ一つ、
+Cordova JavaScript とネイティブ環境との間のコミュニケーションのために
+`cordova.exec` 関数を _使う必要があります_ 。以下が例です:
+
+    cordova.exec(function(winParam) {}, function(error) {}, "service",
+                 "action", ["firstArgument", "secondArgument", 42,
+                 false]);
+
+以下がパラメーターの詳細説明です:
+
+1. `function(winParam) {}` - 成功コールバック関数です。 `exec` の実行が
+   正常に完了したとき、この関数が呼び出されます
+   (任意で返されたパラメーターと一緒に呼び出されます)
+2. `function(error) {}` - エラーコールバック関数です。もし操作が正常に
+   完了しなかったとき、この関数が呼び出されます
+   (任意で返されたパラメーターと一緒に呼び出されます)
+3. `"service"` - ネイティブ側で呼び出されるサービス名です。これは
+   ネイティブクラスにマッピングされます。詳しくは、以下のネイティブ
+   ガイドで説明しています
+4. `"action"` - 呼び出されるアクション名です。 `exec` からの呼び出しを
+   受けるネイティブクラスで取り出され、プラットフォームに依存して、
+   クラスのメソッドにマッピングされます。詳しくは、以下のネイティブ
+   ガイドで説明しています
+5. `[/* arguments */]` - ネイティブ環境に渡される引数です
+
+
+### Echo プラグイン JavaScript の例
+
+    window.echo = function(str, callback) {
+        cordova.exec(callback, function(err) {
+            callback('Nothing to echo.');
+        }, "Echo", "echo", [str]);
+    };
+
+詳しく見ていきましょう。プラグインを `window` に `echo` 関数として
+付与しています。プラグインのユーザーは以下のように使用します:
+
+
+    window.echo("echome", function(echoValue) {
+        alert(echoValue == "echome"); // should alert true.
+    });
+
+はじめに、 `exec` 関数の後ろ3つの引数について見ていきましょう。
+私たちは、 `Echo` "サービス" を呼び出し、 `echo` "アクション" を
+リクエストし、そして `window.echo` 関数の最初のパラメーターである
+文字列を含んだ配列を引数として渡しています。
+
+`exec` に渡される成功コールバック関数は `window.echo` が受取る
+コールバック関数を単純に参照しています。エラーコールバックについては
+もう少し手を加えています: もしネイティブ側でエラーコールバックを呼び出した
+場合は、単純に成功コールバックを呼び出し、 "デフォルト" 文字列を渡します。
+
+## ネイティブ
+
+プラグインの JavaScript の定義が終わったら、それに少なくとも1つの
+ネイティブ実装を付け加える必要があります。以下は Cordova がサポート
+しているそれぞれのプラットフォームに特化したガイドになります。
+以下のガイドでは引き続き、このガイドで作り始めた Echo プラグインを
+作成していきます。
+
+- Developing a Plugin on Android
+- Developing a Plugin on Bada
+- Developing a Plugin on BlackBerry
+- Developing a Plugin on iOS
+- Developing a Plugin on webOS
+- Developing a Plugin on Windows Phone

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/e6e5a51c/docs/jp/2.0.0/guide/plugin-development/ios/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.0.0/guide/plugin-development/ios/index.md b/docs/jp/2.0.0/guide/plugin-development/ios/index.md
new file mode 100644
index 0000000..322e8b6
--- /dev/null
+++ b/docs/jp/2.0.0/guide/plugin-development/ios/index.md
@@ -0,0 +1,157 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements. See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership. The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License. You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied. See the License for the
+         specific language governing permissions and limitations
+         under the License.
+---
+
+# Developing a Plugin on iOS
+
+プラグインの開発には、 Cordova-iOS のアーキテクチャの理解が必要です。 Conrdova-iOS は UIWebView から構成されています。インターセプト命令は、 URL の変化に応じて UIWebView に渡されます。これらのプラグインは .plist ファイルの Plugins キーにクラスマッピングとして表されています。
+
+プラグインは `CDVPlugin` クラスを継承した Objective-C のクラスです。
+
+## プラグインクラスのマッピング
+
+プラグインの JavaScript 部分は常に `cordova.exec` メソッドを以下のように使います:
+
+    exec(<successFunction>, <failFunction>, <service>, <action>, [<args>]);
+
+これは UIWebView から iOS ネイティブ側へのリクエストを整理し、おおよそ要約すると `service` クラスで `action` メソッドを、 `args` 配列で渡された引数と一緒に呼び出すということになります。
+
+Objective-C プラグインメソッドの `options` パラメーターは非推奨であり、使われるべきではありません。レガシー的な理由で、 `args` 配列の最後の JavaScript オブジェクト要素は、 Objective-C 側メソッドの `options` 辞書に渡されます。どんな JavaScript オブジェクトでも `args` 配列の最後の要素として渡されるべきであり、もし配列の途中の要素に JavaScript オブジェクトがあると、それ以降の Objective-C 側の配列のインデックスがでたらめになることに十分注意してください。 options 辞書はただ1つの JavaScript オブジェクトのみをサポートしており、また配列の一番最後の要素のみネイティブメソッドに渡されます。このようにエラーを起こしやすいので、 `options` は非推奨となっています。
+
+このプラグインは、 Cordova-iOS アプリケーションのプロジェクトフォルダーの中の `Cordova.plist` ファイルの `Plugins` キー (辞書) に追加される必要があります。
+
+    <key>service_name</key>
+    <string>PluginClassName</string>
+
+`service_name` のキーは JavaScript の `exec` の中で使用しているものと一致している必要があり、値はプラグインの Objective-C クラスの名前になります。これがないと、プラグインはコンパイルされますが、 Cordova からアクセスできない状態となります。
+
+## iOS Cordova Plugin の作成
+
+私たちはプラグインリクエストをネイティブ側に送る JavaScript を作成しました。また、正しく `Cordova.plist` ファイルでマッピングされた iOS Objective-C プラグインもあります。では、最終的に iOS Objective-C プラグインのクラスがどのようになるのか見ていきましょう。
+
+JavaScript の `exec` 関数によってプラグインに割り当てられたものは、プラグインクラスの対応する `action` メソッドに渡されます。大半のメソッドの実装は以下のようになります:
+
+    - (void) myMethod:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+    {
+        NSString* callbackId = [arguments objectAtIndex:0];
+
+        CDVPluginResult* pluginResult = nil;
+        NSString* javaScript = nil;
+
+        @try {
+            NSString* myarg = [arguments objectAtIndex:1];
+
+            if (myarg != nil) {
+                pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+                javaScript = [pluginResult toSuccessCallbackString:callbackId];
+            } 
+        } @catch (id exception) {
+            pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]];
+            javaScript = [pluginResult toErrorCallbackString:callbackId];
+        }
+
+        [self writeJavascript:javaScript];
+    }
+
+
+### iOS プラグインの Echo プラグイン
+
+`Cordova.plist` ファイルの `Plugins` キー (辞書) に以下を追加します:
+
+    <key>Echo</key>
+    <string>Echo</string>
+
+次のファイル (`Echo.h` と `Echo.m`) を Cordova-iOS アプリケーションフォルダーの中の
+プラグインフォルダーに追加します:
+
+    /********* Echo.h Cordova Plugin Header *******/
+
+    #import <Cordova/CDVPlugin.h>
+
+    @interface Echo : CDVPlugin
+
+    - (void) echo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
+
+    @end
+
+    /********* Echo.m Cordova Plugin Implementation *******/
+
+    #import "Echo.h"
+    #import <Cordova/CDVPluginResult.h>
+
+    @implementation Echo
+
+    - (void) echo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
+    {
+        NSString* callbackId = [arguments objectAtIndex:0];
+
+        CDVPluginResult* pluginResult = nil;
+        NSString* javaScript = nil;
+
+        @try {
+            NSString* echo = [arguments objectAtIndex:1];
+
+            if (echo != nil && [echo length] > 0) {
+                pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
+                javaScript = [pluginResult toSuccessCallbackString:callbackId];
+            } else {
+                pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
+                javaScript = [pluginResult toErrorCallbackString:callbackId];
+            }
+        } @catch (NSException* exception) {
+            pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]];
+            javaScript = [pluginResult toErrorCallbackString:callbackId];
+        }
+
+        [self writeJavascript:javaScript];
+    }
+
+    @end
+
+
+コードを見ていきましょう。一番上には、必要なすべての Cordova に関する import 文が並んでいます。クラスは `CDVPlugin` を継承しています - これはとても重要です。
+
+このプラグインは1つのアクション `echo` のみをサポートしています。最初に、引数配列の0番目の要素である `callbackId` パラメーターを取得します。次に、 `objectAtIndex` メソッドを使って、引数配列の1番目の要素である echo 用文字列を取得します。ここで、少しパラメーターに対してチェックを行います: `nil` チェックや文字列の長さが0でないかどうかなどです。
+
+もしそうであった場合は、ステータスが `ERROR` の `PluginResult` を返します。もしこれらのチェックをパスしたら、ステータスが `OK` の `PluginResult` を返し、パラメーターとして受け取った `echo` 文字列を渡します。そして、もし正常な場合は `toSuccessCallbackString` メソッド、エラーの場合は `toErrorCallbackString` メソッドを呼びだして `PluginResult` を JavaScript に変換します。
+
+最後に、 JavaScript 側で成功またはエラーコールバック関数を実行するような JavaScript を書き出します。もし成功コールバックが呼ばれた場合は、 `echo` パラメーターをパラメーターとして渡します。
+
+## 一歩進んだプラグインの機能
+
+他にも、オーバーライド出来るメソッドについては以下を参照してください:
+
+1. [CDVPlugin.h](https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVPlugin.h)
+2. [CDVPlugin.m](https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVPlugin.m)
+
+例えば、 pausa, resume, app terminate, handleOpenURL events といったような機能を実装できます。
+
+## プラグインのデバッグ
+
+Objective-C 側でデバッグするには、 Xcode のビルトインのデバッガーを使用します。 JavaScript 側では、 [Apache Cordova Project の Weinre](https://github.com/apache/incubator-cordova-weinre) または [サードパーティ製の iWebInspector](http://www.iwebinspector.com/) を使用できます。
+
+## よくある落とし穴
+
+* Cordova.plist にプラグインマッピングを追加することを忘れないでください - もし忘れている場合は、 Xcode のコンソールログにエラーが表示されます
+* 接続するすべてのホストを [ホワイトリスト](guide_whitelist_index.md.html#Domain%20Whitelist%20Guide) に追加することを忘れないで下さい - もし忘れている場合は、 Xcode のコンソールログにエラーが表示されます
+* もしアプリが復帰するときの onResume() イベント内で、アラートといったようなネイティブ関数を実行すると、アプリケーションが停止してしまいます。安全のため、 JavaScript 呼び出しをタイムアウト値0の setTimeout でラップしてください:
+
+        setTimeout(function() {
+            // 任意のコード
+        }, 0);
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/e6e5a51c/docs/jp/2.0.0/guide/plugin-development/webos/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.0.0/guide/plugin-development/webos/index.md b/docs/jp/2.0.0/guide/plugin-development/webos/index.md
new file mode 100644
index 0000000..e341f4f
--- /dev/null
+++ b/docs/jp/2.0.0/guide/plugin-development/webos/index.md
@@ -0,0 +1,23 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+---
+
+Developing a Plugin on webOS
+============================
+
+プラグインは webOS プラットフォームでは現在サポートされていません。

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/e6e5a51c/docs/jp/2.0.0/guide/plugin-development/windows-phone/index.md
----------------------------------------------------------------------
diff --git a/docs/jp/2.0.0/guide/plugin-development/windows-phone/index.md b/docs/jp/2.0.0/guide/plugin-development/windows-phone/index.md
new file mode 100644
index 0000000..35c3cbb
--- /dev/null
+++ b/docs/jp/2.0.0/guide/plugin-development/windows-phone/index.md
@@ -0,0 +1,23 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+         or more contributor license agreements.  See the NOTICE file
+         distributed with this work for additional information
+         regarding copyright ownership.  The ASF licenses this file
+         to you under the Apache License, Version 2.0 (the
+         "License"); you may not use this file except in compliance
+         with the License.  You may obtain a copy of the License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+         Unless required by applicable law or agreed to in writing,
+         software distributed under the License is distributed on an
+         "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+         KIND, either express or implied.  See the License for the
+         specific language governing permissions and limitations
+         under the License.
+---
+
+Developing a Plugin on Windows Phone
+====================================
+
+準備中です...