From 5be0739c5df7bed660c6d28f809af12c3ee0fbd5 Mon Sep 17 00:00:00 2001 From: misitebao Date: Wed, 6 Oct 2021 19:15:49 +0800 Subject: [PATCH 1/3] feat(website): synchronize chinese credits --- .../zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx index 8ca442c14..9c2e1c2d5 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx @@ -67,6 +67,9 @@ sidebar_position: 99 + + + `, }} /> From 6ebf4ed428b94487be2cfa28cb2e4a72aa8c5c5e Mon Sep 17 00:00:00 2001 From: misitebao Date: Sun, 10 Oct 2021 01:14:18 +0800 Subject: [PATCH 2/3] feat: synchronize some chinese documents --- .../current/about.md | 8 +++---- .../current/community/links.mdx | 2 +- .../current/community/templates.mdx | 4 ++++ .../current/credits.mdx | 22 ++++++++++++++----- .../current/gettingstarted/firstproject.mdx | 2 +- .../current/gettingstarted/installation.mdx | 2 +- .../guides/application-development.mdx | 12 ++++++++++ .../current/guides/overscroll.mdx | 9 ++++++++ 8 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/overscroll.mdx diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/about.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/about.md index e1fb28783..43a272fcc 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/about.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/about.md @@ -10,7 +10,7 @@ sidebar_position: 1 Wails 是一个可让您使用 Go 和 Web 技术编写桌面应用的项目。 -将它看作为轻量快速的 “Electron for Go”。 您可以使用 Go 的灵活性和强大功能,结合丰富的现代前端,轻松的构建应用程序。 +将它看作为 Go 的轻量级和快速的 Electron 替代品。 您可以使用 Go 的灵活性和强大功能,结合丰富的现代前端,轻松的构建应用程序。 Wails 一点也不弱!这是 [xbar](https://xbarapp.com) - 一个使用 Wails 编写的 MacOS 桌面应用。它使用 Mac 的系统原生菜单,支持浅色和深色桌面主题,主窗口使用半透明,使其具有原生应用的 “冰霜” 效果。 @@ -31,13 +31,13 @@ Wails 自动使您的 Go 方法可用于 Javascript,因此您可以从前端 ## 运行时库 -Wails 为 Go 和 Javascript 提供了一个运行时库,可以处理现代应用程序需要的很多东西,比如事件、日志记录、对话框等。 +Wails 为 Go 和 Javascript 提供了一个运行时库,可以处理现代应用程序需要的很多东西,比如事件、日志、对话框等。 ## 实时开发体验 ### 自动重新构建 -当您在“dev”模式下运行您的应用程序时,Wails 会将您的应用程序构建为原生桌面应用程序,但会从磁盘读取您的资源。它将检测您的 Go 代码的任何更改,并自动重新构建和重新启动您的应用程序。 +当您在“dev“模式下运行您的应用程序时,Wails 会将您的应用程序构建为原生桌面应用程序,但会从磁盘读取您的资源。它将检测您的 Go 代码的任何更改,并自动重新构建和重新启动您的应用程序。 ### 自动重新加载 @@ -47,7 +47,7 @@ Wails 为 Go 和 Javascript 提供了一个运行时库,可以处理现代应 如果您更喜欢在浏览器中调试和开发,那么 Wails 可以满足您的需求。正在运行的应用程序还有一个网络服务器,它将在连接到它的任何浏览器中运行您的应用程序。当您的资源在磁盘上发生变化时,它会刷新。 -## 生成原生二进制文件 +## 可用于生产的原生二进制文件 当您准备好完成应用程序的最终构建时,CLI 会将其编译为单个可执行文件,并将所有资源打包到其中。在 Windows 和 MacOS 上,可以创建用于分发的原生包。使用打包工具后生成的资源(图标、info.plist、清单文件等)是您项目的一部分,可以自定义,让您完全控制应用程序的构建方式。 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/links.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/links.mdx index 3d35ea1e8..eb5d0cff6 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/links.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/links.mdx @@ -11,7 +11,7 @@ sidebar_position: 2 - [Gophers Slack Channel](https://gophers.slack.com/messages/CJ4P9F7MZ/) - [Gophers Slack Channel Invite](https://invite.slack.golangbridge.org/) - [Github Issues](https://github.com/wailsapp/wails/issues) -- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828) +- [v2 测试版讨论板](https://github.com/wailsapp/wails/discussions/828) ## 社交媒体 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/templates.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/templates.mdx index a4c38ad98..3aa2d5c77 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/templates.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/community/templates.mdx @@ -23,3 +23,7 @@ sidebar_position: 1 - [wails-template-vue](https://github.com/misitebao/wails-template-vue) - 基于 Vue 和 Vue-Router 的 Wails 模板 - [wails-vite-vue-ts](https://github.com/codydbentley/wails-vite-vue-ts) - 使用 Vite 的 Vue 3 TypeScript(以及添加功能的说明) - [wails-vite-vue-the-works](https://github.com/codydbentley/wails-vite-vue-the-works) - 使用 Vite, Vuex, Vue Router, Sass, 和 ESLint + Prettier 的 Vue 3 TypeScript + +## Angular + +- [wails-angular-template](https://github.com/TAINCER/wails-angular-template) - 带有 TypeScript, Sass, 热重载, 代码拆分和 i18n 的 Angular diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx index 9c2e1c2d5..c26e030e7 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/credits.mdx @@ -20,6 +20,9 @@ sidebar_position: 99 + + +

@@ -58,11 +61,8 @@ sidebar_position: 99 - - - - - + + @@ -70,6 +70,18 @@ sidebar_position: 99 + + + + + + + + + + + + `, }} /> diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx index b5028c1bb..1349a750d 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/firstproject.mdx @@ -46,6 +46,6 @@ Wails 项目具有以下布局: `frontend`目录没有特定于 Wails 的内容,可以是您选择的任何前端项目。 -`build`目录在构建过程中使用。这些文件可以更新以自定义您的构建。如果文件从构建目录中删除,将重新生成默认版本。 +`build`目录在构建过程中使用。这些文件可以修改以自定义您的构建。如果文件从构建目录中删除,将重新生成默认版本。 `go.mod`中的默认模块名称是“changeme”。您应该将其更改为更合适的内容。 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx index 420963924..e473bf6e9 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/gettingstarted/installation.mdx @@ -30,7 +30,7 @@ Wails 有许多安装前需要的常见依赖项: 从[Node 下载页面](https://nodejs.org/en/download/)下载 Npm。最好使用最新版本,因为这是我们通常会测试的版本。 -运行 `npm --version` 进行校验。 +运行 `npm --version` 进行验证。 ## 平台指定依赖关系 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/application-development.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/application-development.mdx index 4700c8745..6cd13c452 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/application-development.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/application-development.mdx @@ -146,3 +146,15 @@ Wails v2 处理资源的方式的伟大之处在于它没有!您唯一需要 第一个,如果有给定,将在`frontend`目录中执行以安装 node 模块。第二个,如果有给定,将在`frontend`目录中执行以构建前端项目。 如果没有给出这两个字段,那么 Wails 不会对前端做任何操作。它仅仅被用作`embed.FS`。 + +## 内置开发服务器 + +TODO: 待同步 + +## 外部开发服务器 + +TODO: 待同步 + +## Go 模块 + +默认的 Wails 模板会生成一个包含模块名称“changeme”的`go.mod`文件。您应该在项目生成后将其更改为更合适的内容。 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/overscroll.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/overscroll.mdx new file mode 100644 index 000000000..f3feb7059 --- /dev/null +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/overscroll.mdx @@ -0,0 +1,9 @@ +# 滚动超出 + +[Overscroll](https://developer.mozilla.org/zh-CN/docs/Web/CSS/overscroll-behavior) 是当您滚动超出页面内容边界时有时会获得的“弹跳效果”。这在移动应用程序中很常见。这可以使用 CSS 禁用: + +```css +body { + overscroll-behavior: none; +} +``` From 71cfdfc7c8d125a94672bceaea541d0cb2b6ed42 Mon Sep 17 00:00:00 2001 From: misitebao Date: Fri, 29 Oct 2021 22:15:09 +0800 Subject: [PATCH 3/3] feat: increase synchronized content --- .../current/howdoesitwork.mdx | 8 +-- .../current/reference/cli.mdx | 64 +++++++++++-------- .../current/reference/options.mdx | 10 ++- .../current/reference/project-config.mdx | 7 +- .../current/reference/runtime/dialog.mdx | 2 + 5 files changed, 57 insertions(+), 34 deletions(-) diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx index e91b46ed0..47e22cb84 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx @@ -17,7 +17,7 @@ Wails 应用程序是一个带有一个 webkit 前端的标准的 Go 应用程 ### 概述 -主应用程序由对`wails.Run()`的调用组成. 它接受描述应用程序窗口大小、窗口标题、要使用的资源等的应用程序配置。基本应用程序可能如下所示: +主应用程序由对`wails.Run()`的调用组成. 它接受描述应用程序窗口大小、窗口标题、要使用的资源等应用程序配置。基本应用程序可能如下所示: ```go title="main.go" package main @@ -85,7 +85,7 @@ func (b *App) Greet(name string) string { #### 资源 `Assets` 选项是必须的,因为您不能拥有没有前端资源的 Wails 应用程序。这些资源可以是您希望在 Web 应用程序中找到的任何文件 - html、js、css、svg、png 等。 -**不需要生成资源包**- 纯文件即可。当应用程序启动时,它将尝试从您的资源中加载`index.html`,并且那时起前端基本上将作为浏览器工作。值得注意的是 embed.FS, +**不需要生成资源包**- 纯文件即可。当应用程序启动时,它将尝试从您的资源中加载`index.html`,并且那时起前端基本上将作为浏览器工作。值得注意的是`embed.FS`, 文件所在的位置没有要求。嵌入路径很可能使用了相对于您的主应用程序代码的嵌套目录,例如 `frontend/dist`: ```go title="main.go" @@ -95,10 +95,10 @@ var assets embed.FS 启动时,Wails 将遍历嵌入的文件,寻找包含的`index.html`. 所有其他资源将相对于该目录加载。 -由于生产二进制文件使用中包含在`embed.FS`的文件,因此应用程序不需要附带任何外部文件。 +由于可用于生产的二进制文件使用包含在`embed.FS`中的文件,因此应用程序不需要附带任何外部文件。 当使用`wails dev`命令在”dev“模式下,资源从磁盘加载,任何更改都会导致“实时重新加载”。资源的位置需要使用`-assetdir`传递给`wails dev`命令,并且很可能与嵌入路径相同。 -希望`embed.FS`将来我们可以从它本身计算出来。更多细节可以在[应用程序开发指南](/docs/guides/application-development)中找到。 +希望将来我们可以从`embed.FS`本身计算出来。更多细节可以在[应用程序开发指南](/docs/guides/application-development)中找到。 #### 应用程序生命周期回调 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/cli.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/cli.mdx index 1eb862b59..d5119208f 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/cli.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/cli.mdx @@ -13,25 +13,27 @@ Wails CLI 有许多用于管理项目的命令。所有命令都以此方式运 `wails init` 用于生成项目。 -| 标志 | 描述 | 默认 | -| :----------------- | :------------------------------------------------------------------ | :------ | -| -n "project name" | 项目名. **强制必填**. | | -| -d "project dir" | 要创建的项目目录 | 项目名 | -| -g | 初始化 git 存储库 | | -| -l | 可用项目模板列表 | | -| -q | 禁止输出到控制台 | | -| -t "template name" | 要使用的项目模板。这可能是在 github 上托管的远程模板的 URL 的名称。 | vanilla | -| -ide | 生成 IDE 项目文件 | | -| -f | 强制构建应用 | false | +| 标志 | 描述 | 默认 | +| :----------------- | :---------------------------------------------------------------------------------- | :------ | +| -n "project name" | 项目名. **强制必填**. | | +| -d "project dir" | 要创建的项目目录 | 项目名 | +| -g | 初始化 git 存储库 | | +| -l | 可用项目模板列表 | | +| -q | 禁止输出到控制台 | | +| -t "template name" | 要使用的项目模板。这可能是默认模板的名称或在 github 上托管的远程模板的 URL 的名称。 | vanilla | +| -ide | 生成 IDE 项目文件 | | +| -f | 强制构建应用 | false | 示例: `wails init -n test -d mytestproject -g -ide vscode -q` 这将在 "mytestproject" 目录生成一个名为 "test" 的项目,初始化 git,生成 vscode 项目文件并静默执行。 +可以在[此处](/docs/guides/ides)找到有关在 Wails 中使用 IDE 的更多信息。 + ### 远程模板 -支持远程模板(托管在 GitHub 上)并且可以使用模板的项目 URL 进行安装。 +支持远程模板(托管在 GitHub 上)并且可以使用模板项目的 URL 进行安装。 示例: `wails init -n test -t https://github.com/leaanthony/testtemplate` @@ -66,6 +68,10 @@ Wails CLI 有许多用于管理项目的命令。所有命令都以此方式运 如果您更喜欢使用标准 Go 工具进行构建,请参阅[手动构建](/docs/guides/manual-builds)指南。 +示例: + +`wails build -clean -o myproject.exe` + ## 诊断检查 `wails doctor` 将运行诊断程序以确保您的系统已准备好进行开发。 @@ -111,23 +117,25 @@ Your system is ready for Wails development! - 所有应用程序资源都从磁盘加载。如果它们被更改,应用程序将自动重新加载(而不是重新构建)。所有连接的浏览器也将重新加载 - 生成的 JS 模块提供以下内容: - 带有自动生成的 JSDoc 的 Go 方法的 Javascript 包装器,提供代码提示 - - 的 Go 结构体的 TypeScript 版本,可以构造并传递给您的后端方法 + - 您的 Go 结构体的 TypeScript 版本,可以构造并传递给您的 Go 方法 - 生成第二个 JS 模块,为运行时提供包装器 + TS 声明 -| 标志 | 描述 | 默认 | -| :--------------------------- | :---------------------------------------------------- | :-------------------------- | -| -assetdir "./path/to/assets" | 编译资源的路径 | Value in `wails.json` | -| -browser | `http://localhost:34115`在启动时打开浏览器 | | -| -compiler "compiler" | 使用不同的 go 编译器来构建,例如 go1.15beta1 | go | -| -e | 触发重建的扩展(逗号分隔) | go | -| -ldflags "flags" | 传递给编译器的额外 ldflags | | -| -tags "extra tags" | 构建标签以传递给编译器(引号和空格分隔) | | -| -loglevel "loglevel" | 要使用的日志级别 - Trace, Debug, Info, Warning, Error | Debug | -| -noreload | 资源更改时禁用自动重新加载 | | -| -v | 详细级别 (0 - silent, 1 - standard, 2 - verbose) | 1 | -| -wailsjsdir | 生成生成的 Wails JS 模块的目录 | Value store in `wails.json` | +| 标志 | 描述 | 默认 | +| :--------------------------- | :---------------------------------------------------- | :----------------------- | +| -assetdir "./path/to/assets" | 编译资源的路径 | `wails.json`中的值 | +| -browser | 在启动时打开浏览器到`http://localhost:34115` | | +| -compiler "compiler" | 使用不同的 go 编译器来构建,例如 go1.15beta1 | go | +| -e | 触发重新构建的扩展(逗号分隔) | go | +| -ldflags "flags" | 传递给编译器的额外 ldflags | | +| -tags "extra tags" | 构建标签以传递给编译器(引号和空格分隔) | | +| -loglevel "loglevel" | 要使用的日志级别 - Trace, Debug, Info, Warning, Error | Debug | +| -noreload | 资源更改时禁用自动重新加载 | | +| -v | 详细级别 (0 - silent, 1 - standard, 2 - verbose) | 1 | +| -wailsjsdir | 生成生成的 Wails JS 模块的目录 | `wails.json`中的值 | +| -debounce | 检测到资源更改后等待重新加载的时间 | 100 (毫秒) | +| -devserverurl "url" | 使用第 3 方开发服务器 url, 例如 Vite | "http://localhost:34115" | -如果在命令行上提供了`-assetdir`或`-wailsjsdir`标志,它们将保存在`wails.json`中,并成为后续调用的默认值。 +如果在命令行上提供了`-assetdir`,`-wailsjsdir`,`debounce`或`devserverurl`标志,它们将保存在`wails.json`中,并成为后续调用的默认值。 示例: @@ -136,10 +144,12 @@ Your system is ready for Wails development! 此命令将执行以下操作: - 构建应用程序并运行它(更多细节在[这里](/docs/guides/manual-builds)) -- 生成 Wails JS 模块 ``./frontend/src` -- 注意文件的更新`./frontend/dist`并在任何更改时重新加载 +- 在`./frontend/src`中生成 Wails JS 模块 +- 监听`./frontend/dist`中文件的更新并在更改时重新加载 - 打开浏览器并连接到应用程序 +[此处](/docs/guides/application-development)提供了有关将此功能与现有框架脚本一起使用的更多信息。 + ## 生成 ### 模板 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx index 2c0305638..3c27b5577 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/options.mdx @@ -155,6 +155,14 @@ func main() { 该值是默认设置窗口的 RGBA 值。默认值:0xFFFFFFFF。 +### 窗口固定在最顶层 + +名称:AlwaysOnTop + +类型:bool + +窗口在失去焦点时应保持在其他窗口之上。 + ### 资源 名称:Assets @@ -219,7 +227,7 @@ func main() { 定义需要绑定到前端的方法的一部分结构实例。 -### 窗口 +### Windows 名称:Windows diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdx index 3b0ede7e1..c6ebb16f3 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/project-config.mdx @@ -11,13 +11,16 @@ sidebar_position: 5 "name": "[项目名称]", "assetdir": "[资源目录的相对路径]", "frontend:install": "[安装node依赖的命令,在frontend目录下运行 - 通常是 `npm install`]", + "frontend:dev": "[此命令在“Wails dev”上的单独进程中运行。适用于第三方观察者]", "frontend:build": "[构建资源的命令,在frontend目录下运行 - 通常是 `npm run build`]", "wailsjsdir": "[自动生成的JS模块将被创建的目录的相对路径]", "version": "[项目配置版本]", - "outputfilename": "[二进制文件的名称]" + "outputfilename": "[二进制文件的名称]", + "debounceMS": 100, // 在检测到资源更改时,开发服务器等待重新加载的时间 + "devserverurl": "[用于服务本地资源的开发服务器URL。默认:http://localhost:34115]" } ``` 该文件将在运行`wails build`或`wails dev`时,由 Wails CLI 读取。 -`wails build/dev`命令中的`assetdir`和`wailsjsdir`标志将覆盖项目配置并作为后续运行的默认值。 +`wails build/dev`命令中的`assetdir`,`wailsjsdir`,`debounceMS`和`devserverurl`标志将覆盖项目配置并作为后续运行的默认值。 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx index c052023a5..78f082e8d 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/runtime/dialog.mdx @@ -5,6 +5,8 @@ sidebar_position: 5 # 对话框 +TODO: 待同步 + ## 概述 运行时的这一部分提供对原生对话框的调用,例如文件选择器和消息框。上下文