Browse Source

Merge pull request #4560 from magicae/magica-translate-docs-to-zh_CN

docs: update zh-CN docs translation [WIP]
Cheng Zhao 9 years ago
parent
commit
820c72af55

+ 42 - 34
docs-translations/zh-CN/README.md

@@ -1,13 +1,19 @@
+## 常见问题
+
++ [Electron 常见问题](faq/electron-faq.md)
+
 ## 向导
 
 * [支持平台](tutorial/supported-platforms.md)
-* [应用部署](tutorial/application-distribution.md)
-* [应用打包](tutorial/application-packaging.md)
-* [使用原生模块](tutorial/using-native-node-modules.md)
+* [分发应用](tutorial/application-distribution.md)
+* [提交应用到 Mac App Store](tutorial/mac-app-store-submission-guide.md)
+* [打包应用](tutorial/application-packaging.md)
+* [使用 Node 原生模块](tutorial/using-native-node-modules.md)
 * [主进程调试](tutorial/debugging-main-process.md)
 * [使用 Selenium 和 WebDriver](tutorial/using-selenium-and-webdriver.md)
-* [调试工具扩展](tutorial/devtools-extension.md)
-* [使用 PepperFlash 插件](tutorial/using-pepper-flash-plugin.md)
+* [使用开发人员工具扩展](tutorial/devtools-extension.md)
+* [使用 Pepper Flash 插件](tutorial/using-pepper-flash-plugin.md)
+* [使用 Widevine CDM 插件](tutorial/using-widevine-cdm-plugin.md)
 
 ## 教程
 
@@ -19,53 +25,55 @@
 
 * [简介](api/synopsis.md)
 * [进程对象](api/process.md)
-* [支持的Chrome命令行开关](api/chrome-command-line-switches.md)
+* [支持的 Chrome 命令行开关](api/chrome-command-line-switches.md)
+* [环境变量](api/environment-variables.md)
 
-定制的DOM元素:
+自定义的 DOM 元素:
 
-* [`File`对象](api/file-object.md)
-* [`<webview>`标签](api/web-view-tag.md)
-* [`window.open`函数](api/window-open.md)
+* [`File` 对象](api/file-object.md)
+* [`<webview>` 标签](api/web-view-tag.md)
+* [`window.open` 函数](api/window-open.md)
 
-主进程可用的模块:
+主进程可用的模块:
 
 * [app](api/app.md)
-* [auto-updater](api/auto-updater.md)
-* [browser-window](api/browser-window.md)
-* [content-tracing](api/content-tracing.md)
+* [autoUpdater](api/auto-updater.md)
+* [BrowserWindow](api/browser-window.md)
+* [contentTracing](api/content-tracing.md)
 * [dialog](api/dialog.md)
-* [global-shortcut](api/global-shortcut.md)
-* [ipc (main process)](api/ipc-main-process.md)
-* [menu](api/menu.md)
-* [menu-item](api/menu-item.md)
-* [power-monitor](api/power-monitor.md)
-* [power-save-blocker](api/power-save-blocker.md)
+* [globalShortcut](api/global-shortcut.md)
+* [ipcMain](api/ipc-main.md)
+* [Menu](api/menu.md)
+* [MenuItem](api/menu-item.md)
+* [powerMonitor](api/power-monitor.md)
+* [powerSaveBlocker](api/power-save-blocker.md)
 * [protocol](api/protocol.md)
 * [session](api/session.md)
 * [webContents](api/web-contents.md)
-* [tray](api/tray.md)
+* [Tray](api/tray.md)
 
-渲染进程(网页)可用的模块:
+在渲染进程(网页)内可用的模块:
 
-* [ipc (renderer)](api/ipc-renderer.md)
+* [desktopCapturer](api/desktop-capturer.md)
+* [ipcRenderer](api/ipc-renderer.md)
 * [remote](api/remote.md)
-* [web-frame](api/web-frame.md)
+* [webFrame](api/web-frame.md)
 
-两种进程都可用的模块:
+两种进程都可用的模块:
 
 * [clipboard](api/clipboard.md)
-* [crash-reporter](api/crash-reporter.md)
-* [native-image](api/native-image.md)
+* [crashReporter](api/crash-reporter.md)
+* [nativeImage](api/native-image.md)
 * [screen](api/screen.md)
 * [shell](api/shell.md)
 
 ## 开发
 
-* [码规范](development/coding-style.md)
+* [码规范](development/coding-style.md)
 * [源码目录结构](development/source-code-directory-structure.md)
-* [与 NW.js (原名 node-webkit) 在技术上的差异](development/atom-shell-vs-node-webkit.md)
-* [构建系统概](development/build-system-overview.md)
-* [构建步骤 (Mac)](development/build-instructions-mac.md)
-* [构建步骤 (Windows)](development/build-instructions-windows.md)
-* [构建步骤 (Linux)](development/build-instructions-linux.md)
-* [在调试中使用 SymbolServer](development/setting-up-symbol-server.md)
+* [与 NW.js(原 node-webkit)在技术上的差异](development/atom-shell-vs-node-webkit.md)
+* [构建系统概](development/build-system-overview.md)
+* [构建步骤(Mac)](development/build-instructions-mac.md)
+* [构建步骤(Windows)](development/build-instructions-windows.md)
+* [构建步骤(Linux)](development/build-instructions-linux.md)
+* [在调试中使用 Symbol Server](development/setting-up-symbol-server.md)

+ 22 - 25
docs-translations/zh-CN/api/accelerator.md

@@ -1,46 +1,43 @@
 # Accelerator
 
-An accelerator is a string that represents a keyboard shortcut. It can contain
-multiple modifiers and key codes, combined by the `+` character.
+一个 `Accelerator` 是一个表示某个快捷键组合的字符串。它包含了用 `+` 连接的若干个按键。
 
-Examples:
+例如:
 
 * `Command+A`
 * `Ctrl+Shift+Z`
 
-## Platform notice
+## 运行平台相关的提示
 
-On Linux and Windows, the `Command` key does not have any effect so
-use `CommandOrControl` which represents `Command` on OS X and `Control` on
-Linux and Windows to define some accelerators.
+在 Linux 和 Windows 上,`Command` 键并不存在,因此我们通常用 `CommandOrControl` 来表示“在 OS X 下为 `Command` 键,但在
+Linux 和 Windows 下为 `Control` 键。
 
-The `Super` key is mapped to the `Windows` key on Windows and Linux and
-`Cmd` on OS X.
+`Super` 键是指 Linux 和 Windows 上的 `Windows` 键,但是在 OS X 下为 `Command` 键。
 
-## Available modifiers
+## 可用的功能按键
 
-* `Command` (or `Cmd` for short)
-* `Control` (or `Ctrl` for short)
-* `CommandOrControl` (or `CmdOrCtrl` for short)
+* `Command`(缩写为 `Cmd`)
+* `Control`(缩写为 `Ctrl`)
+* `CommandOrControl`(缩写为 `CmdOrCtrl`)
 * `Alt`
 * `Shift`
 * `Super`
 
-## Available key codes
+## 可用的普通按键
 
-* `0` to `9`
-* `A` to `Z`
-* `F1` to `F24`
-* Punctuations like `~`, `!`, `@`, `#`, `$`, etc.
+* `0`  `9`
+* `A`  `Z`
+* `F1`  `F24`
+* 类似与 `~`、`!`、`@`、`#`、`$` 的标点符号。
 * `Plus`
 * `Space`
 * `Backspace`
 * `Delete`
 * `Insert`
-* `Return` (or `Enter` as alias)
-* `Up`, `Down`, `Left` and `Right`
-* `Home` and `End`
-* `PageUp` and `PageDown`
-* `Escape` (or `Esc` for short)
-* `VolumeUp`, `VolumeDown` and `VolumeMute`
-* `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` and `MediaPlayPause`
+* `Return`(和 `Enter` 等同)
+* `Up`、`Down`、`Left` 和 `Right`
+* `Home`  `End`
+* `PageUp`  `PageDown`
+* `Escape`(缩写为 `Esc`)
+* `VolumeUp`、`VolumeDown` 和 `VolumeMute`
+* `MediaNextTrack`、`MediaPreviousTrack`、`MediaStop` 和 `MediaPlayPause`

+ 146 - 155
docs-translations/zh-CN/api/app.md

@@ -11,11 +11,11 @@ app.on('window-all-closed', function() {
 });
 ```
 
-## 事件
+## 事件列表
 
 `app` 对象会触发以下的事件:
 
-### 事件: 'will-finish-launching'
+### 事件:'will-finish-launching'
 
 当应用程序完成基础的启动的时候被触发。在 Windows 和 Linux 中,
 `will-finish-launching` 事件与 `ready` 事件是相同的; 在 OS X 中,
@@ -24,11 +24,11 @@ app.on('window-all-closed', function() {
 
 在大多数的情况下,你应该只在 `ready` 事件处理器中完成所有的业务。
 
-### 事件: 'ready'
+### 事件:'ready'
 
 当 Electron 完成初始化时被触发。
 
-### 事件: 'window-all-closed'
+### 事件:'window-all-closed'
 
 当所有的窗口都被关闭时触发。
 
@@ -36,20 +36,20 @@ app.on('window-all-closed', function() {
 或者开发者调用了 `app.quit()` ,Electron 将会先尝试关闭所有的窗口再触发 `will-quit` 事件,
 在这种情况下 `window-all-closed` 不会被触发。
 
-### 事件: 'before-quit'
+### 事件:'before-quit'
 
 返回:
 
-* `event` 事件
+* `event` Event
 
 在应用程序开始关闭它的窗口的时候被触发。
 调用 `event.preventDefault()` 将会阻止终止应用程序的默认行为。
 
-### 事件: 'will-quit'
+### 事件:'will-quit'
 
 返回:
 
-* `event` 事件
+* `event` Event
 
 当所有的窗口已经被关闭,应用即将退出时被触发。
 调用 `event.preventDefault()` 将会阻止终止应用程序的默认行为。
@@ -57,20 +57,20 @@ app.on('window-all-closed', function() {
 你可以在 `window-all-closed` 事件的描述中看到 `will-quit` 事件
 和 `window-all-closed` 事件的区别。
 
-### 事件: 'quit'
+### 事件:'quit'
 返回:
 
-* `event` 事件
-* `exitCode` 整数
+* `event` Event
+* `exitCode` Integer
 
 当应用程序正在退出时触发。
 
-### 事件: 'open-file' _OS X_
+### 事件:'open-file' _OS X_
 
 返回:
 
-* `event` 事件
-* `path` 字符串
+* `event` Event
+* `path` String
 
 当用户想要在应用中打开一个文件时触发。`open-file` 事件常常在应用已经打开并且系统想要再次使用应用打开文件时被触发。
  `open-file` 也会在一个文件被拖入 dock 且应用还没有运行的时候被触发。
@@ -78,73 +78,74 @@ app.on('window-all-closed', function() {
 
 如果你想处理这个事件,你应该调用 `event.preventDefault()` 。
 在 Windows系统中, 你需要通过解析 process.argv 来获取文件路径。
-### 事件: 'open-url' _OS X_
+
+### 事件:'open-url' _OS X_
 
 返回:
 
-* `event` 事件
-* `url` 字符串
+* `event` Event
+* `url` String
 
 当用户想要在应用中打开一个url的时候被触发。URL格式必须要提前标识才能被你的应用打开。
 
 如果你想处理这个事件,你应该调用 `event.preventDefault()` 。
 
-### 事件: 'activate' _OS X_
+### 事件:'activate' _OS X_
 
 返回:
 
-* `event` 事件
-* `hasVisibleWindows` 布尔值
+* `event` Event
+* `hasVisibleWindows` Boolean
 
 当应用被激活时触发,常用于点击应用的 dock 图标的时候。
 
-### 事件: 'browser-window-blur'
+### 事件:'browser-window-blur'
 
 返回:
 
-* `event` 事件
-* `window` 浏览器窗口
+* `event` Event
+* `window` BrowserWindow
 
-当一个 [浏览器窗口](browser-window.md) 失去焦点的时候触发。
+当一个 [BrowserWindow](browser-window.md) 失去焦点的时候触发。
 
-### 事件: 'browser-window-focus'
+### 事件:'browser-window-focus'
 
 返回:
 
-* `event` 事件
-* `window` 浏览器窗口
+* `event` Event
+* `window` BrowserWindow
 
-当一个 [浏览器窗口](browser-window.md) 获得焦点的时候触发。
+当一个 [BrowserWindow](browser-window.md) 获得焦点的时候触发。
 
-### 事件: 'browser-window-created'
+### 事件:'browser-window-created'
 
 返回:
 
-* `event` 事件
-* `window` 浏览器窗口
+* `event` Event
+* `window` BrowserWindow
 
-当一个 [浏览器窗口](browser-window.md) 被创建的时候触发。
+当一个 [BrowserWindow](browser-window.md) 被创建的时候触发。
 
-### 事件: 'certificate-error'
+### 事件:'certificate-error'
 
 返回:
 
-* `event` 事件
-* `webContents` [web组件](web-contents.md)
-* `url` 字符串
-* `certificateList` 对象
-  * `data` PEM 编码数据
-  * `issuerName` 发行者的公有名称
-* `callback` 函数
+* `event` Event
+* `webContents` [WebContents](web-contents.md)
+* `url` String - URL 地址
+* `error` String - 错误码
+* `certificate` Object
+  * `data` Buffer - PEM 编码数据
+  * `issuerName` String - 发行者的公有名称
+* `callback` Function
 
-Emitted when failed to verify the `certificate` for `url`, to trust the
-certificate you should prevent the default behavior with
-`event.preventDefault()` and call `callback(true)`.
+当对 `url` 验证 `certificate` 证书失败的时候触发,如果需要信任这个证书,你需要阻止默认行为 `event.preventDefault()` 并且
+调用 `callback(true)`。
 
 ```javascript
 session.on('certificate-error', function(event, webContents, url, error, certificate, callback) {
   if (url == "https://github.com") {
-    // Verification logic.
+    // 验证逻辑。
     event.preventDefault();
     callback(true);
   } else {
@@ -153,37 +154,37 @@ session.on('certificate-error', function(event, webContents, url, error, certifi
 });
 ```
 
-### 事件: 'select-client-certificate'
+### 事件:'select-client-certificate'
 
 
 返回:
 
-* `event` 事件
-* `webContents` [web组件](web-contents.md)
-* `url` 字符串
-* `certificateList` 对象
-  * `data` PEM 编码数据
-  * `issuerName` 发行者的公有名称
-* `callback` 函数
+* `event` Event
+* `webContents` [WebContents](web-contents.md)
+* `url` String - URL 地址
+* `certificateList` [Object]
+  * `data` Buffer - PEM 编码数据
+  * `issuerName` String - 发行者的公有名称
+* `callback` Function
 
 当一个客户端认证被请求的时候被触发。
 
-The `url` corresponds to the navigation entry requesting the client certificate
-and `callback` needs to be called with an entry filtered from the list. 
-Using `event.preventDefault()` prevents the application from using the first
-certificate from the store.
+`url` 指的是请求客户端认证的网页地址,调用 `callback` 时需要传入一个证书列表中的证书。
+
+需要通过调用 `event.preventDefault()` 来防止应用自动使用第一个证书进行验证。如下所示:
+
 ```javascript
 app.on('select-certificate', function(event, host, url, list, callback) {
   event.preventDefault();
   callback(list[0]);
 })
 ```
-### Event: 'login'
+### 事件: 'login'
 
-Returns:
+返回:
 
 * `event` Event
-* `webContents` [Web组件](web-contents.md)
+* `webContents` [WebContents](web-contents.md)
 * `request` Object
   * `method` String
   * `url` URL
@@ -196,11 +197,10 @@ Returns:
   * `realm` String
 * `callback` Function
 
-当 `webContents` 要做验证时被触发。
+当 `webContents` 要做进行一次 HTTP 登陆验证时被触发。
 
-The default behavior is to cancel all authentications, to override this you
-should prevent the default behavior with `event.preventDefault()` and call
-`callback(username, password)` with the credentials.
+默认情况下,Electron 会取消所有的验证行为,如果需要重写这个行为,你需要用 `event.preventDefault()` 来阻止默认行为,并且
+用 `callback(username, password)` 来进行验证。
 
 ```javascript
 app.on('login', function(event, webContents, request, authInfo, callback) {
@@ -208,22 +208,22 @@ app.on('login', function(event, webContents, request, authInfo, callback) {
   callback('username', 'secret');
 })
 ```
-### 事件: 'gpu-process-crashed'
+### 事件:'gpu-process-crashed'
 
-当GPU进程崩溃时触发。
+当 GPU 进程崩溃时触发。
 
-## 方法
+## 方法列表
 
 `app` 对象拥有以下的方法:
 
-**提示:** 有的方法只能用于特定的操作系统。
+**请注意** 有的方法只能用于特定的操作系统。
 
 ### `app.quit()`
 
-试图关掉所有的窗口。`before-quit` 事件将会最先触发。如果所有的窗口都被成功关闭了,
+试图关掉所有的窗口。`before-quit` 事件将会最先触发。如果所有的窗口都被成功关闭了,
 `will-quit` 事件将会被触发,默认下应用将会被关闭。
 
-这个方法保证了所有的 `beforeunload` 和 `unload` 事件处理器被正确执行。会存在一个窗口被 `beforeunload` 事件处理器返回 `false` 取消退出的可能性
+这个方法保证了所有的 `beforeunload` 和 `unload` 事件处理器被正确执行。假如一个窗口的 `beforeunload` 事件处理器返回 `false`,那么整个应用可能会取消退出
 
 ### `app.hide()` _OS X_
 
@@ -241,30 +241,29 @@ app.on('login', function(event, webContents, request, authInfo, callback) {
 
 所有的窗口会被立刻关闭,不会询问用户。`before-quit` 和 `will-quit` 这2个事件不会被触发
 
-
 ### `app.getAppPath()`
 
 返回当前应用所在的文件路径。
 
 ### `app.getPath(name)`
 
-* `name` 字符串
+* `name` String
 
 返回一个与 `name` 参数相关的特殊文件夹或文件路径。当失败时抛出一个 `Error` 。
 
 你可以通过名称请求以下的路径:
 
-* `home` 用户的 home 文件夹
-* `appData` 所有用户的应用数据文件夹,默认对应:
+* `home` 用户的 home 文件夹(主目录)
+* `appData` 当前用户的应用数据文件夹,默认对应:
   * `%APPDATA%` Windows 中
   * `$XDG_CONFIG_HOME` or `~/.config` Linux 中
   * `~/Library/Application Support` OS X 中
-* `userData` 储存你应用程序设置文件的文件夹,默认是 `appData` 文件夹附加应用的名称
-* `temp` 临时文件夹
+* `userData` 储存你应用程序设置文件的文件夹,默认是 `appData` 文件夹附加应用的名称
+* `temp` 临时文件夹
 * `exe` 当前的可执行文件
-* `module`  `libchromiumcontent` 库.
-* `desktop` 当前用户的桌面文件夹
-* `documents` "我的文件夹"的路径.
+* `module`  `libchromiumcontent` 库
+* `desktop` 当前用户的桌面文件夹
+* `documents` 用户文档目录的路径
 * `downloads` 用户下载目录的路径.
 * `music` 用户音乐目录的路径.
 * `pictures` 用户图片目录的路径.
@@ -272,14 +271,14 @@ app.on('login', function(event, webContents, request, authInfo, callback) {
 
 ### `app.setPath(name, path)`
 
-* `name` 字符串
-* `path` 字符串
+* `name` String
+* `path` String
 
-重写 `path` 参数到一个特别的文件夹或者是一个和 `name` 参数有关系的文件
+重写某个 `name` 的路径为 `path`,`path` 可以是一个文件夹或者一个文件,这个和 `name` 的类型有关
 如果这个路径指向的文件夹不存在,这个文件夹将会被这个方法创建。
-如果错误则抛出 `Error` 
+如果错误则抛出 `Error`。
 
-你只可以指向 `app.getPath` 中定义过 `name` 的路径
+`name` 参数只能使用 `app.getPath` 中定义过 `name`
 
 默认情况下,网页的 cookie 和缓存都会储存在 `userData` 文件夹。
 如果你想要改变这个位置,你需要在 `app` 模块中的 `ready` 事件被触发之前重写 `userData` 的路径。
@@ -293,22 +292,20 @@ app.on('login', function(event, webContents, request, authInfo, callback) {
 
 返回当前应用程序的 `package.json` 文件中的名称。
 
-通常 `name` 字段是一个短的小写字符串,其命名规则按照 npm 中的模块命名规则。你应该单独列举一个
-`productName` 字段,用于表示你的应用程序的完整名称,这个名称将会被 Electron 优先采用
+由于 npm 的命名规则,通常 `name` 字段是一个短的小写字符串。但是应用名的完整名称通常是首字母大写的,你应该单独使用一个
+`productName` 字段,用于表示你的应用程序的完整名称。Electron 会优先使用这个字段作为应用名
 
 ### `app.getLocale()`
 
-返回当前应用程序的语言种类。
-
-
+返回当前应用程序的语言。
 
 ### `app.addRecentDocument(path)`  _OS X_ _Windows_
 
-* `path` 字符串
+* `path` String
 
-为最近访问的文档列表中添加 `path` 
+在最近访问的文档列表中添加 `path`
 
-这个列表由操作系统进行管理。在 Windows 中您可以通过任务条进行访问,在 OS X 中你可以通过dock 菜单进行访问。
+这个列表由操作系统进行管理。在 Windows 中您可以通过任务条进行访问,在 OS X 中你可以通过 dock 菜单进行访问。
 
 ### `app.clearRecentDocuments()` _OS X_ _Windows_
 
@@ -316,66 +313,55 @@ app.on('login', function(event, webContents, request, authInfo, callback) {
 
 ### `app.setUserTasks(tasks)` _Windows_
 
-* `tasks` 由 `Task` 对象构成的数组
+* `tasks` [Task] - 一个由 Task 对象构成的数组
 
 将 `tasks` 添加到 Windows 中 JumpList 功能的 [Tasks][tasks] 分类中。
 
 `tasks` 中的 `Task` 对象格式如下:
 
-`Task` 对象
-* `program` 字符串 - 执行程序的路径,通常你应该说明当前程序的路径为 `process.execPath` 字段。
-* `arguments` 字符串 - 当 `program` 执行时的命令行参数。
-* `title` 字符串 - JumpList 中显示的标题。
-* `description` 字符串 - 对这个任务的描述。
-* `iconPath` 字符串 - JumpList 中显示的 icon 的绝对路径,可以是一个任意包含一个icon的资源文件。你通常可以通过指明 `process.execPath` 来显示程序中的icon。
-* `iconIndex` 整数 - icon文件中的icon目录。如果一个icon文件包括了两个或多个icon,就需要设置这个值以确定icon。如果一个文件仅包含一个icon,那么这个值为0。
+`Task` Object
+* `program` String - 执行程序的路径,通常你应该说明当前程序的路径为 `process.execPath` 字段。
+* `arguments` String - 当 `program` 执行时的命令行参数。
+* `title` String - JumpList 中显示的标题。
+* `description` String - 对这个任务的描述。
+* `iconPath` String - JumpList 中显示的图标的绝对路径,可以是一个任意包含一个图标的资源文件。通常来说,你可以通过指明 `process.execPath` 来显示程序中的图标。
+* `iconIndex` Integer - 图标文件中的采用的图标位置。如果一个图标文件包括了多个图标,就需要设置这个值以确定使用的是哪一个图标。
+如果这个图标文件中只包含一个图标,那么这个值为 0。
 
 ### `app.allowNTLMCredentialsForAllDomains(allow)`
 
 * `allow` Boolean
 
-Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
-authentication - normally, Electron will only send NTLM/Kerberos credentials for
-URLs that fall under "Local Intranet" sites (i.e. are in the same domain as you).
-However, this detection often fails when corporate networks are badly configured,
-so this lets you co-opt this behavior and enable it for all URLs.
+动态设置是否总是为 HTTP NTLM 或 Negotiate 认证发送证书。通常来说,Electron 只会对本地网络(比如和你处在一个域中的计算机)发
+送 NTLM / Kerberos 证书。但是假如网络设置得不太好,可能这个自动探测会失效,所以你可以通过这个接口自定义 Electron 对所有 URL
+的行为。
+
 ### `app.makeSingleInstance(callback)`
 
 * `callback` Function
 
-This method makes your application a Single Instance Application - instead of
-allowing multiple instances of your app to run, this will ensure that only a
-single instance of your app is running, and other instances signal this
-instance and exit.
+这个方法可以让你的应用在同一时刻最多只会有一个实例,否则你的应用可以被运行多次并产生多个实例。你可以利用这个接口保证只有一个实例正
+常运行,其余的实例全部会被终止并退出。
 
-`callback` will be called with `callback(argv, workingDirectory)` when a second
-instance has been executed. `argv` is an Array of the second instance's command
-line arguments, and `workingDirectory` is its current working directory. Usually
-applications respond to this by making their primary window focused and
-non-minimized.
+如果多个实例同时运行,那么第一个被运行的实例中 `callback` 会以 `callback(argv, workingDirectory)` 的形式被调用。其余的实例
+会被终止。
+`argv` 是一个包含了这个实例的命令行参数列表的数组,`workingDirectory` 是这个实例目前的运行目录。通常来说,我们会用通过将应用在
+主屏幕上激活,并且取消最小化,来提醒用户这个应用已经被打开了。
 
-The `callback` is guaranteed to be executed after the `ready` event of `app`
-gets emitted.
+在 `app` 的 `ready` 事件后,`callback` 才有可能被调用。
 
-This method returns `false` if your process is the primary instance of the
-application and your app should continue loading. And returns `true` if your
-process has sent its parameters to another instance, and you should immediately
-quit.
+如果当前实例为第一个实例,那么在这个方法将会返回 `false` 来保证它继续运行。否则将会返回 `true` 来让它立刻退出。
 
-On OS X the system enforces single instance automatically when users try to open
-a second instance of your app in Finder, and the `open-file` and `open-url`
-events will be emitted for that. However when users start your app in command
-line the system's single instance machanism will be bypassed and you have to
-use this method to ensure single instance.
+在 OS X 中,如果用户通过 Finder、`open-file` 或者 `open-url` 打开应用,系统会强制确保只有一个实例在运行。但是如果用户是通过
+命令行打开,这个系统机制会被忽略,所以你仍然需要靠这个方法来保证应用为单实例运行的。
 
-An example of activating the window of primary instance when a second instance
-starts:
+下面是一个简单的例子。我们可以通过这个例子了解如何确保应用为单实例运行状态。
 
 ```js
 var myWindow = null;
 
 var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
-  // Someone tried to run a second instance, we should focus our window.
+  // 当另一个实例运行的时候,这里将会被调用,我们需要激活应用的窗口
   if (myWindow) {
     if (myWindow.isMinimized()) myWindow.restore();
     myWindow.focus();
@@ -383,104 +369,109 @@ var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory)
   return true;
 });
 
+// 这个实例是多余的实例,需要退出
 if (shouldQuit) {
   app.quit();
   return;
 }
 
-// Create myWindow, load the rest of the app, etc...
+// 创建窗口、继续加载应用、应用逻辑等……
 app.on('ready', function() {
 });
+
 ```
 ### `app.setAppUserModelId(id)` _Windows_
 
 * `id` String
 
-改变 [Application User Model ID][app-user-model-id] 的 `id`.
+改变当前应用的 [Application User Model ID][app-user-model-id] 为 `id`.
 
 ### `app.isAeroGlassEnabled()` _Windows_
 
-This method returns `true` if [DWM composition](https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx)
-(Aero Glass) is enabled, and `false` otherwise. You can use it to determine if
-you should create a transparent window or not (transparent windows won't work
-correctly when DWM composition is disabled).
+如果 [DWM composition](https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540.aspx)(Aero Glass) 启用
+了,那么这个方法会返回 `true`,否则是 `false`。你可以用这个方法来决定是否要开启透明窗口特效,因为如果用户没开启 DWM,那么透明窗
+口特效是无效的。
 
-Usage example:
+举个例子:
 
 ```js
 let browserOptions = {width: 1000, height: 800};
 
-// Make the window transparent only if the platform supports it.
+// 只有平台支持的时候才使用透明窗口
 if (process.platform !== 'win32' || app.isAeroGlassEnabled()) {
   browserOptions.transparent = true;
   browserOptions.frame = false;
 }
 
-// Create the window.
+// 创建窗口
 win = new BrowserWindow(browserOptions);
 
-// Navigate.
+// 转到某个网页
 if (browserOptions.transparent) {
   win.loadURL('file://' + __dirname + '/index.html');
 } else {
-  // No transparency, so we load a fallback that uses basic styles.
+  // 没有透明特效,我们应该用某个只包含基本样式的替代解决方案。
   win.loadURL('file://' + __dirname + '/fallback.html');
 }
 ```
 ### `app.commandLine.appendSwitch(switch[, value])`
 
-通过可选的参数 `value` 给 Chromium 命令行中添加一个开关。
-Append a switch (with optional `value`) to Chromium's command line.
+通过可选的参数 `value` 给 Chromium 中添加一个命令行开关。
 
-**贴士:** 这不会影响 `process.argv` ,这个方法主要被开发者用于控制一些低层级的 Chromium 行为。
+**注意** 这个方法不会影响 `process.argv`,我们通常用这个方法控制一些底层 Chromium 行为。
 
 ### `app.commandLine.appendArgument(value)`
 
-给 Chromium 命令行中加入一个参数。这个参数是当前正在被引用的
+给 Chromium 中直接添加一个命令行参数,这个参数 `value` 的引号和格式必须正确
 
-**贴士:** 这不会影响 `process.argv`。
+**注意** 这个方法不会影响 `process.argv`。
 
 ### `app.dock.bounce([type])` _OS X_
 
-* `type` 字符串 (可选的) - 可以是 `critical` 或 `informational`。默认下是 `informational`
+* `type` String - 可选参数,可以是 `critical` 或 `informational`。默认为 `informational`。
 
-当输入 `critical` 时,dock 中的 icon 将会开始弹跳直到应用被激活或者这个请求被取消。
+当传入的是 `critical` 时,dock 中的应用将会开始弹跳,直到这个应用被激活或者这个请求被取消。
 
-当输入 `informational` 时,dock 中的 icon 只会弹跳一秒钟。
-然而,这个请求仍然会激活,直到应用被激活或者请求被取消。
+当传入的是 `informational` 时,dock 中的图标只会弹跳一秒钟。但是,这个请求仍然会激活,直到应用被激活或者请求被取消。
 
-返回一个表示这个请求的 ID。
+这个方法返回的返回值表示这个请求的 ID。
 
 ### `app.dock.cancelBounce(id)` _OS X_
 
-* `id` 整数
+* `id` Integer
 
 取消这个 `id` 对应的请求。
 
 ### `app.dock.setBadge(text)` _OS X_
 
-* `text` 字符串
+* `text` String
 
-设置 dock 中显示的字符。
+设置应用在 dock 中显示的字符
 
 ### `app.dock.getBadge()` _OS X_
 
-返回 dock 中显示的字符。
+返回应用在 dock 中显示的字符
 
 ### `app.dock.hide()` _OS X_
 
-隐藏 dock 中的 icon
+隐藏应用在 dock 中的图标
 
 ### `app.dock.show()` _OS X_
 
-显示 dock 中的 icon
+显示应用在 dock 中的图标
 
 ### `app.dock.setMenu(menu)` _OS X_
 
-* `menu` 菜单
+* `menu` [Menu](menu.md)
 
 设置应用的 [dock 菜单][dock-menu].
 
+### `app.dock.setIcon(image)` _OS X_
+
+* `image` [NativeImage](native-image.md)
+
+设置应用在 dock 中显示的图标。
+
 [dock-menu]:https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/concepts/dockconcepts.html#//apple_ref/doc/uid/TP30000986-CH2-TPXREF103
 [tasks]:http://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
 [app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx

+ 88 - 0
docs-translations/zh-CN/api/auto-updater.md

@@ -0,0 +1,88 @@
+# autoUpdater
+
+这个模块提供了一个到 `Squirrel` 自动更新框架的接口。
+
+## 平台相关的提示
+
+虽然 `autoUpdater` 模块提供了一套各平台通用的接口,但是在每个平台间依然会有一些微小的差异。
+
+### OS X
+
+在 OS X 上,`autoUpdater` 模块依靠的是内置的 [Squirrel.Mac][squirrel-mac],这意味着你不需要依靠其他的设置就能使用。关于
+更新服务器的配置,你可以通过阅读 [Server Support][server-support] 这篇文章来了解。
+
+### Windows
+
+在 Windows 上,你必须使用安装程序将你的应用装到用户的计算机上,所以比较推荐的方法是用 [grunt-electron-installer][installer] 这个模块来自动生成一个 Windows 安装向导。
+
+Squirrel 自动生成的安装向导会生成一个带 [Application User Model ID][app-user-model-id] 的快捷方式。
+Application User Model ID 的格式是 `com.squirrel.PACKAGE_ID.YOUR_EXE_WITHOUT_DOT_EXE`, 比如
+像 `com.squirrel.slack.Slack` 和 `com.squirrel.code.Code` 这样的。你应该在自己的应用中使用 `app.setAppUserModelId` 方法设置相同的 API,不然 Windows 将不能正确地把你的应用固定在任务栏上。
+
+服务器端的配置和 OS X 也是不一样的,你可以阅读 [Squirrel.Windows][squirrel-windows] 这个文档来获得详细信息。
+
+### Linux
+
+Linux 下没有任何的自动更新支持,所以我们推荐用各个 Linux 发行版的包管理器来分发你的应用。
+
+## 事件列表
+
+`autoUpdater` 对象会触发以下的事件:
+
+### 事件:'error'
+
+返回:
+
+* `error` Error
+
+当更新发生错误的时候触发。
+
+### 事件:'checking-for-update'
+
+当开始检查更新的时候触发。
+
+### 事件:'update-available'
+
+当发现一个可用更新的时候触发,更新包下载会自动开始。
+
+### 事件:'update-not-available'
+
+当没有可用更新的时候触发。
+
+### 事件:'update-downloaded'
+
+返回:
+
+* `event` Event
+* `releaseNotes` String - 新版本更新公告
+* `releaseName` String - 新的版本号
+* `releaseDate` Date - 新版本发布的日期
+* `updateURL` String - 更新地址
+
+在更新下载完成的时候触发。
+
+在 Windows 上只有 `releaseName` 是有效的。
+
+## 方法列表
+
+`autoUpdater` 对象有以下的方法:
+
+### `autoUpdater.setFeedURL(url)`
+
+* `url` String
+
+设置检查更新的 `url`,并且初始化自动更新。这个 `url` 一旦设置就无法更改。
+
+### `autoUpdater.checkForUpdates()`
+
+向服务端查询现在是否有可用的更新。在调用这个方法之前,必须要先调用 `setFeedURL`。
+
+### `autoUpdater.quitAndInstall()`
+
+在下载完成后,重启当前的应用并且安装更新。这个方法应该仅在 `update-downloaded` 事件触发后被调用。
+
+[squirrel-mac]: https://github.com/Squirrel/Squirrel.Mac
+[server-support]: https://github.com/Squirrel/Squirrel.Mac#server-support
+[squirrel-windows]: https://github.com/Squirrel/Squirrel.Windows
+[installer]: https://github.com/atom/grunt-electron-installer
+[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx

+ 139 - 0
docs-translations/zh-CN/faq/electron-faq.md

@@ -0,0 +1,139 @@
+# Electron 常见问题
+
+## Electron 会在什么时候升级到最新版本的 Chrome?
+
+通常来说,在稳定版的 Chrome 发布后两周内,我们会更新 Electron 内的 Chrome 版本。
+
+我们只会使用 stable 版本的 Chrome。但如果在 beta 或 dev 版本中有一个重要的更新,我们会把补丁应用到现版本的 Chrome 上。
+
+## Electron 会在什么时候升级到最新版本的 Node.js?
+
+我们通常会在最新版的 Node.js 发布后一个月左右将 Electron 更新到这个版本的 Node.js。我们通过这种方式来避免新版本的 Node.js
+带来的 bug(这种 bug 太常见了)。
+
+Node.js 的新特性通常是由新版本的 V8 带来的。由于 Electron 使用的是 Chrome 浏览器中附带的 V8 引擎,所以 Electron 内往往已经
+有了部分新版本 Node.js 才有的崭新特性。
+
+## 如何在两个网页间共享数据?
+
+在两个网页(渲染进程)间共享数据最简单的方法是使用浏览器中已经实现的 HTML5 API,比较好的方案是用 [Storage API][storage],
+[`localStorage`][local-storage],[`sessionStorage`][session-storage] 或者 [IndexedDB][indexed-db]。
+
+你还可以用 Electron 内的 IPC 机制实现。将数据存在主进程的某个全局变量中,然后在多个渲染进程中使用 `remote` 模块来访问它。
+
+```javascript
+// 在主进程中
+global.sharedObject = {
+  someProperty: 'default value'
+};
+```
+
+```javascript
+// 在第一个页面中
+require('remote').getGlobal('sharedObject').someProperty = 'new value';
+```
+
+```javascript
+// 在第二个页面中
+console.log(require('remote').getGlobal('sharedObject').someProperty);
+```
+
+## 为什么应用的窗口、托盘在一段时间后不见了?
+
+这通常是因为用来存放窗口、托盘的变量被垃圾收集了。
+
+你可以参考以下两篇文章来了解为什么会遇到这个问题。
+
+* [内存管理][memory-management]
+* [变量作用域][variable-scope]
+
+如果你只是要一个快速的修复方案,你可以用下面的方式改变变量的作用域,防止这个变量被垃圾收集。
+
+从
+
+```javascript
+app.on('ready', function() {
+  var tray = new Tray('/path/to/icon.png');
+})
+```
+
+改为
+
+```javascript
+var tray = null;
+app.on('ready', function() {
+  tray = new Tray('/path/to/icon.png');
+})
+```
+
+## 在 Electron 中,我为什么不能用 jQuery、RequireJS、Meteor、AngularJS?
+
+因为 Electron 在运行环境中引入了 Node.js,所以在 DOM 中有一些额外的变量,比如 `module`、`exports` 和 `require`。这导致
+了许多库不能正常运行,因为它们也需要将同名的变量加入运行环境中。
+
+我们可以通过禁用 Node.js 来解决这个问题,用如下的方式:
+
+```javascript
+// 在主进程中
+var mainWindow = new BrowserWindow({
+  webPreferences: {
+    nodeIntegration: false
+  }
+});
+```
+
+假如你依然需要使用 Node.js 和 Electron 提供的 API,你需要在引入那些库之前将这些变量重命名,比如:
+
+```html
+<head>
+<script>
+// 重命名 Electron 提供的 require
+window.nodeRequire = require;
+delete window.require;
+delete window.exports;
+delete window.module;
+</script>
+<script type="text/javascript" src="jquery.js"></script>
+</head>
+```
+
+## 为什么 `require('electron').xxx` 的结果是 undefined?
+
+在使用 Electron 的提供的模块时,你可能会遇到和以下类似的错误:
+
+```
+> require('electron').webFrame.setZoomFactor(1.0);
+Uncaught TypeError: Cannot read property 'setZoomLevel' of undefined
+```
+
+这是因为你在项目中或者在全局中安装了[npm 上获取的 `electron` 模块][electron-module],它把 Electron 的内置模块覆写了。
+
+你可以通过以下方式输出 `electron` 模块的路径来确认你是否使用了正确的模块。
+
+```javascript
+console.log(require.resolve('electron'));
+```
+
+确认以下它是不是像下面这样的:
+
+```
+"/path/to/Electron.app/Contents/Resources/atom.asar/renderer/api/lib/exports/electron.js"
+```
+
+假如输出的路径类似于 `node_modules/electron/index.js`,那么你需要移除或者重命名 npm 上的 `electron` 模块。
+
+```bash
+npm uninstall electron
+npm uninstall -g electron
+```
+
+如果你依然遇到了这个问题,你可能需要检查一下拼写或者是否在错误的进程中调用了这个模块。比如,
+`require('electron').app` 只能在主进程中使用, 然而 `require('electron').webFrame` 只能在渲染进程中使用。
+
+[memory-management]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management
+[variable-scope]: https://msdn.microsoft.com/library/bzt2dkta(v=vs.94).aspx
+[electron-module]: https://www.npmjs.com/package/electron
+[storage]: https://developer.mozilla.org/en-US/docs/Web/API/Storage
+[local-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
+[session-storage]: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
+[indexed-db]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API