]> khamidou — GitHub mirrors - electron.git/commitdiff
Add Japanes translated docs.
authorTakahito Yamatoya <info@sqlazure.jp>
Tue, 19 Jan 2016 08:23:17 +0000 (17:23 +0900)
committerTakahito Yamatoya <info@sqlazure.jp>
Tue, 19 Jan 2016 08:23:17 +0000 (17:23 +0900)
docs-translations/jp/api/download-item.md [new file with mode: 0644]
docs-translations/jp/api/global-shortcut.md [new file with mode: 0644]
docs-translations/jp/api/screen.md [new file with mode: 0644]

diff --git a/docs-translations/jp/api/download-item.md b/docs-translations/jp/api/download-item.md
new file mode 100644 (file)
index 0000000..1be61b2
--- /dev/null
@@ -0,0 +1,92 @@
+# DownloadItem
+
+`DownloadItem`は、Electronでアイテムのダウンロードを示すEventEmitterです。 `Session`モジュールの`will-download`イベントで使用され、ダウンロードしたアイテムをコントロールすることができます。
+
+```javascript
+// In the main process.
+win.webContents.session.on('will-download', function(event, item, webContents) {
+  // Set the save path, making Electron not to prompt a save dialog.
+  item.setSavePath('/tmp/save.pdf');
+  console.log(item.getMimeType());
+  console.log(item.getFilename());
+  console.log(item.getTotalBytes());
+  item.on('updated', function() {
+    console.log('Received bytes: ' + item.getReceivedBytes());
+  });
+  item.on('done', function(e, state) {
+    if (state == "completed") {
+      console.log("Download successfully");
+    } else {
+      console.log("Download is cancelled or interrupted that can't be resumed");
+    }
+  });
+```
+
+## イベント
+
+### イベント: 'updated'
+
+`downloadItem`が更新されたときに出力されます。
+
+### イベント: 'done'
+
+* `event` Event
+* `state` String
+  * `completed` - ダウンロードが成功で完了
+  * `cancelled` - ダウンロードをキャンセル
+  * `interrupted` - ファイルサーバーとの接続が切れてエラー
+
+ダウンロードが終了状態になったときに出力されます。終了状態には、ダウンロードの完了、ダウンロードのキャンセル(`downloadItem.cancel()`経由)、レジュームできないダウンロードの中断などです。
+
+## メソッド
+
+`downloadItem`オブジェクトは次のメソッドを持ちます:
+
+### `downloadItem.setSavePath(path)`
+
+* `path` String - ダウンロードアイテムの保存ファイルパスを設定します。
+
+APIはセッションの`will-download`コールバック関数のみで提供されます。API経由で保存パスを設定しなかった場合、Electronは保存パスを決めるための元のルーチン(通常は保存ダイアログ)を使用します。
+
+### `downloadItem.pause()`
+
+ダウンロードをポーズします。
+
+### `downloadItem.resume()`
+
+ポーズしたダウンロードを再開します。
+
+### `downloadItem.cancel()`
+
+ダウンロード操作をキャンセルします。
+
+### `downloadItem.getURL()`
+
+どのURLからアイテムをダウンロードするのかを示す`String`を返します。
+
+### `downloadItem.getMimeType()`
+
+mimeタイプを示す`String`を返します。
+
+### `downloadItem.hasUserGesture()`
+
+ダウンロードがユーザージェスチャーを持っているかどうかを示す`Boolean`を返します。
+
+### `downloadItem.getFilename()`
+
+ダウンロードアイテムのファイル名を示す`String`を返します。
+
+**Note:** ファイル名はローカルディスクに実際に保存するものといつも同じとは限りません。ダウンロード保存ダイアログでユーザーがファイル名を変更していると、保存するファイルの実際の名前は異なります。
+
+### `downloadItem.getTotalBytes()`
+
+ダウンロードアイテムの合計バイトサイズを示す`Integer`を返します。
+サイズが不明な場合、0を返します。
+
+### `downloadItem.getReceivedBytes()`
+
+ダウンロードしたアイテムの受信バイト数を示す`Integer`を返します。
+
+### `downloadItem.getContentDisposition()`
+
+レスポンスヘッダーからContent-Dispositionを示す`String`を返します。
diff --git a/docs-translations/jp/api/global-shortcut.md b/docs-translations/jp/api/global-shortcut.md
new file mode 100644 (file)
index 0000000..922cbd6
--- /dev/null
@@ -0,0 +1,64 @@
+# globalShortcut
+
+さまざまなショートカットの動作をカスタマイズするために、オペレーティングシステムのグローバルのキーボードショートカットを`globalShortcut`モジュールは登録したり、解除したりできます。
+
+**Note:** ショートカットはグローバルです。アプリがキーボードフォーカスを持っていなくても動作します。`app`モジュールの `ready`イベントが出力されるまでは使うべきではありません。
+
+```javascript
+const electron = require('electron');
+const app = electron.app;
+const globalShortcut = electron.globalShortcut;
+
+app.on('ready', function() {
+  // Register a 'ctrl+x' shortcut listener.
+  var ret = globalShortcut.register('ctrl+x', function() {
+    console.log('ctrl+x is pressed');
+  });
+
+  if (!ret) {
+    console.log('registration failed');
+  }
+
+  // Check whether a shortcut is registered.
+  console.log(globalShortcut.isRegistered('ctrl+x'));
+});
+
+app.on('will-quit', function() {
+  // Unregister a shortcut.
+  globalShortcut.unregister('ctrl+x');
+
+  // Unregister all shortcuts.
+  globalShortcut.unregisterAll();
+});
+```
+
+## メソッド
+
+`globalShortcut`モジュールは次のメソッドを持ちます:
+
+### `globalShortcut.register(accelerator, callback)`
+
+* `accelerator` [Accelerator](accelerator.md)
+* `callback` Function
+
+`accelerator`のグローバルショートカットを登録します。`callback`は、ユーザーが登録しているショートカットを押したときにコールされます。
+
+ほかのアプリケーションがすでにacceleratorを使用している時、この呼び出しは静かに失敗します。アプリケーション間でグローバルショートカットの争いをしてほしくないので、オペレーティングシステムはこの挙動を採用しています。
+
+### `globalShortcut.isRegistered(accelerator)`
+
+* `accelerator` [Accelerator](accelerator.md)
+
+このアプリケーションが`accelerator`に登録されているかどうかを返します。
+
+acceleratorがすでにほかのアプリケーションで取得していると、このコールは、`false`を返します。アプリケーション間でグローバルショートカットの争いをしてほしくないので、オペレーティングシステムはこの挙動を採用しています。
+
+### `globalShortcut.unregister(accelerator)`
+
+* `accelerator` [Accelerator](accelerator.md)
+
+Unregisters the global shortcut of `accelerator`のグローバルショートカットを解除します。
+
+### `globalShortcut.unregisterAll()`
+
+全てのグローバルショートカットを解除します。
diff --git a/docs-translations/jp/api/screen.md b/docs-translations/jp/api/screen.md
new file mode 100644 (file)
index 0000000..6d06ee8
--- /dev/null
@@ -0,0 +1,131 @@
+# screen
+
+`screen`モジュールは、画面サイズ、ディスプレイ、カーソル位置などの情報を読み取ります。`app`モジュールの`ready`イベントが出力されるまで、このモジュールは使うべきではありません。
+
+`screen`は [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter)です。
+
+**Note:** レンダラ―/デベロッパーツールで、`window.screen`はDOMプロパティで予約されているので、`var screen = require('electron').screen`と書いても動作しません。下の例では、代わりに変数名で`electronScreen`を使用しています。
+
+画面全体にウィンドウを作成する例:
+
+```javascript
+const electron = require('electron');
+const app = electron.app;
+const BrowserWindow = electron.BrowserWindow;
+
+var mainWindow;
+
+app.on('ready', function() {
+  var electronScreen = electron.screen;
+  var size = electronScreen.getPrimaryDisplay().workAreaSize;
+  mainWindow = new BrowserWindow({ width: size.width, height: size.height });
+});
+```
+外部ディスプレイにウィンドウを作成する別の例:
+
+```javascript
+const electron = require('electron');
+const app = electron.app;
+const BrowserWindow = electron.BrowserWindow;
+
+var mainWindow;
+
+app.on('ready', function() {
+  var electronScreen = electron.screen;
+  var displays = electronScreen.getAllDisplays();
+  var externalDisplay = null;
+  for (var i in displays) {
+    if (displays[i].bounds.x != 0 || displays[i].bounds.y != 0) {
+      externalDisplay = displays[i];
+      break;
+    }
+  }
+
+  if (externalDisplay) {
+    mainWindow = new BrowserWindow({
+      x: externalDisplay.bounds.x + 50,
+      y: externalDisplay.bounds.y + 50
+    });
+  }
+});
+```
+
+## `Display` オブジェクト
+
+`Display`オブジェクトはシステムに接続された物理ディスプレイを示します。ヘッドレスシステムでは、擬似`Display`があるかもしれませんし、`Display`はリモートや仮想ディスプレイに相当するかもしれません。
+
+* `display` object
+  * `id` Integer - ディスプレイに紐づいた一意な識別子です。
+  * `rotation` Integer - 0, 1, 2, 3を設定でき、それぞれは時計回りで、0, 90, 180, 270度の画面の回転を示します。
+  * `scaleFactor` Number - 出力装置のピクセルスケールファクター
+  * `touchSupport` String - `available`, `unavailable`, `unknown`を設定できます。
+  * `bounds` Object
+  * `size` Object
+  * `workArea` Object
+  * `workAreaSize` Object
+
+## イベント
+
+`screen`モジュールは次のイベントを出力します:
+
+### イベント: 'display-added'
+
+返り値:
+
+* `event` Event
+* `newDisplay` Object
+
+`newDisplay`が追加されたときに出力されます。
+
+### イベント: 'display-removed'
+
+返り値:
+
+* `event` Event
+* `oldDisplay` Object
+
+`oldDisplay`が削除されたときに出力されます。
+
+### イベント: 'display-metrics-changed'
+
+返り値:
+
+* `event` Event
+* `display` Object
+* `changedMetrics` Array
+
+`display`で1つ以上のメトリックが変わったときに出力されます。`changedMetrics`は変更を説明する文字列の配列です。変更内容には`bounds`と`workArea`, `scaleFactor`、 `rotation`があり得ます。
+
+## メソッド
+
+`screen`モジュールは次のメソッドを持ちます:
+
+### `screen.getCursorScreenPoint()`
+
+現在のマウスの絶対位置を返します。
+
+### `screen.getPrimaryDisplay()`
+
+プライマリディスプレイを返します。
+
+### `screen.getAllDisplays()`
+
+現在利用可能なディスプレイの配列を返します。
+
+### `screen.getDisplayNearestPoint(point)`
+
+* `point` Object
+  * `x` Integer
+  * `y` Integer
+
+指定したポイントに近いディスプレイを返します。
+
+### `screen.getDisplayMatching(rect)`
+
+* `rect` Object
+  * `x` Integer
+  * `y` Integer
+  * `width` Integer
+  * `height` Integer
+
+提供された範囲と、もっとも重複しているディスプレイを返します。