Skip to content

Commit

Permalink
feat:新增翻译文件
Browse files Browse the repository at this point in the history
  • Loading branch information
misitebao authored and leaanthony committed Oct 28, 2020
1 parent a2a2e73 commit 1074b79
Show file tree
Hide file tree
Showing 44 changed files with 5,888 additions and 0 deletions.
8 changes: 8 additions & 0 deletions content/about/_index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
+++
title = "关于"
date = 2019-08-29T19:33:11+10:00
weight = 1
+++

Wails是一个框架,可帮助使用Go and Web Technologies编写桌面应用程序, 使用 [Webview](https://github.com/zserge/webview) 库. 它使用平台的本机渲染引擎(当前用于Linux和Mac的Webkit,用于Windows的MSHTML)。 前端使用HTML / Javascript / CSS编码,后端是纯Go语言。 通过绑定机制,可以将Go代码作为返回Promise的功能公开给前端。 该项目编译为单个可执行文件,将所有资产捆绑到其中。 在Windows和MacOS上,可以将二进制文件捆绑到特定于平台的程序包中进行分发。

44 changes: 44 additions & 0 deletions content/about/concepts.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "概述"
date: 2019-08-29T04:54:28+10:00
draft: false
---

Wails 被设计成尽可能缩小 web 技术和 Go 之间的差距。前端是 [Webview](https://github.com/zserge/webview) 组件, 并且您可以使用自己喜欢的任何常见 Javascript 框架来开发前端代码,并且可以与其中的 Go 代码进行无缝交互。 这是通过共享的 IPC 机制完成的。

<p align="center" style="text-align: center">
<img src="/images/Overview.svg" width="33%"><br/>
</p>

### IPC 概述

IPC 机制可在 2 个运行时中运行-一个运行在 Javascript 中,另一个运行在 Go 中。 它们都提供了一个简单的界面,从而减轻了开发人员无需直接处理 IPC 机制的负担。

<p align="center" style="text-align: center">
<img src="/images/wailsapptech.svg" width="33%"><br/>
</p>

运行时共享开发人员可以与之交互的公共组件:绑定和事件。

<p align="center" style="text-align: center">
<img src="/images/IPCDetail.svg" width="33%"><br/>
</p>

### 绑定

Wails 应用程序提供了一种方法,可让您将 Go 代码公开(绑定)到前端。 使用此方法,可以将任意函数或结构与公开的方法绑定。 在启动时,Wails 将分析绑定的函数/方法并自动以 Javascript 提供等效的函数。 这使您可以直接从 Javascript 调用绑定的 Go 代码。

<p align="center" style="text-align: center">
<img src="/images/Binding.svg" width="40%"><br/>
</p>

JavaScript 包装函数处理了调用 Go 代码的所有复杂性。 您只需使用 Javascript 调用该函数并收到一个 Promise。
绑定 Go 代码的功能处理了绑定的所有复杂性。 如果对 Go 代码的调用成功完成,则结果将传递到 resolve 函数。 如果返回错误,则将其传递给拒绝函数。

### 事件

威尔提供了一个统一的事件系统,类似于 Javascript 的本地事件系统。 这意味着从 Go 或 Javascript 发送的任何事件都可以由任何一方接收。 数据可以与任何事件一起传递。 这样,您就可以做一些整洁的事情,例如在 Go 中运行后台进程并通知任何更新的前端。

<p align="center" style="text-align: center">
<img src="/images/Events.svg" width="40%"><br/>
</p>
143 changes: 143 additions & 0 deletions content/development/_index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
+++
title = "开发"
date = 2019-08-29T04:51:27+10:00
weight = 30
chapter = true
disableBreadcrumb = true
+++

# Development

In this section we cover all aspects of Wails development and contribution guidelines.

## Overview

* Ensure you're using Go 1.14+
* Clone the [main repository](https://github.com/wailsapp/wails) to an arbitrary local directory.
* Make updates to your local repository.
* Once you have made changes, run the `wails/scripts/build.sh` script or you can run `go run build.go` in the same directory. This will ensure that the runtime is built and assets are packaged. It will then install your version of the wails cli locally.
* When generating a project, ensure that you update the project's `go.mod` file to indicate the local installation of Wails.

Example:
When first generated, the go.mod file looks something like this:
```
module test
go 1.14
require (
github.com/leaanthony/mewn v0.10.7
github.com/wailsapp/wails v1.0.3-pre2
)
```
Use `replace` to indicate the local install:
```
module test
go 1.14
require (
github.com/leaanthony/mewn v0.10.7
github.com/wailsapp/wails v1.0.3-pre2
)
replace github.com/wailsapp/wails v1.0.3-pre2 => /path/to/your/local/wails
```

## Issue Driven Development

If there is something to add to the code, whether a bug or enhancement, a ticket should be opened so that it can be discussed. If the coding goes ahead, a new branch should be created from the `develop` branch with a reference to the ticket ID, eg:
`64 - Support react`

Commit messages should follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.3/#summary) format:

* tag[(scope)]: message

| Tag | Meaning |
| --------------- | -------------------- |
| fix | Bugfix |
| feat | New Feature |
| docs | Documentation update |
| BREAKING CHANGE | API Change |

Examples:

* fix: this is a fix for the project as a whole
* fix(cli): this is a fix for the cli
* docs: updated the contributors

## Branch Workflow

* Wails uses a gitflow-like approach to development
* Feature/Bugfix branches are created from the `develop` branch
* Once the work is complete, pull requests should be made against the develop branch
* As features are added, the `develop` branch is tagged with pre-release tags
* Releases are made weekly, so at the end of the weekly cycle, the latest features and bugfixes that were made will be merged to master and tagged with the next appropriate version.

Example:

* After release v0.14.0, a ticket (#63) is opened requesting react support
* This is worked on and a PR is made back to `develop`
* Once merged, `develop` is tagged with `v0.14.1-pre`
* A ticket (#64) is opened requesting ultralight support
* This is worked on and a PR is made back to `develop`
* Once merged, `develop` is tagged with `v0.14.2-pre`
* We reach the end of our week and merge v0.14.2-pre to master, tagging it as v0.15.0
* Work continues on the `devel` branch

<div class="imagecontainer">
<img src="/images/develbranch.png">
</div>


## Tooling

The Wails cli has developer tooling built in, but needs activating. To create a developer version, do the following:

```
cd cmd/wails
go install --tags=dev
```

This unlocks a `wails dev` command that has subcommands for development.

### Creating new project templates

With a developer enabled cli, you can run `wails dev newtemplate` to create a new project template. You will be asked a number of questions regarding your template and as a result, a new directory will be created in `<project-root>/cmd/templates`.

Here is an example run:

```
Wails v0.14.4-pre - Generating new project template
? Please enter the name of your template (eg: React/Webpack Basic): Mithril Basic
? Please enter a short description for the template (eg: React with Webpack 4): Mithril with Webpack 3
? Please enter a long description: Mithril v2.0.0-rc.4 with Webpack 4
? Please enter the name of the directory the frontend code resides (eg: frontend): frontend
? Please enter the install command (eg: npm install): npm install
? Please enter the build command (eg: npm run build): npm run build
? Please enter the serve command (eg: npm run serve): npm run serve
? Please enter the name of the directory to copy the wails bridge runtime (eg: src): src
? Please enter a directory name for the template: mithril-basic
Created new template 'Mithril Basic' in directory '/Users/lea/Projects/wails/cmd/templates/mithril-basic'
```
This generates the following `template.json`:

```json
{
"name": "Mithril Basic",
"version": "1.0.0",
"shortdescription": "Mithril with Webpack 3",
"description": "Mithril v2.0.0-rc.4 with Webpack 4",
"install": "npm install",
"build": "npm run build",
"author": "Duncan Disorderly <[email protected]>",
"created": "2019-05-20 20:16:30.394489 +1000 AEST m=+159.490635188",
"frontenddir": "frontend",
"serve": "npm run serve",
"bridge": "src",
"wailsdir": ""
}
```

*Note: The `wailsdir` key is currently unused but will be used in place of bridge in the [near future](https://github.com/wailsapp/wails/issues/88)*

17 changes: 17 additions & 0 deletions content/gettingstarted/_index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "入门"
date: 2019-08-29T04:51:27+10:00
weight: 1
chapter: true
disableNextPrev: true
---

# Getting Started

<p style="text-align: center; margin-top: 2rem;">Please select your Operating System</p>

<div>
<a href="/gettingstarted/mac/" style="color:black; font-size: 4rem; margin: 1rem;"><i class="fab fa-apple"></i> <span style="color:black; font-size: 2rem;">Mac</span></a>
<a href="/gettingstarted/linux/" style="color:black; font-size: 4rem; margin: 1rem;"><i class="fab fa-linux"></i> <span style="color:black; font-size: 2rem;">Linux</span></a>
<a href="/gettingstarted/windows/" style="color:black; font-size: 4rem; margin: 1rem;"><i class="fab fa-windows"></i> <span style="color:black; font-size: 2rem;">Windows</span></a>
</div>
68 changes: 68 additions & 0 deletions content/gettingstarted/installing.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: "安装 Wails"
date: 2019-08-29T04:54:28+10:00
draft: false
weight: 10
disableNextPrev: true
---

Installation is as simple as running the following command:

```
go get -u github.com/wailsapp/wails/cmd/wails
```

{{% notice tip %}}
Once installed, the `wails update` command may be used for subsequent updates.
{{% /notice %}}

{{% notice tip %}}
To get the latest [pre-release]({{< relref "/development/_index.md#branch-workflow" >}}) with bleeding-edge features the `-pre` flag can be appended `wails update -pre`.
{{% /notice %}}

### Setup

To finish the installation setup your Wails system by running the [setup command]({{< relref "/reference/cli.md#setup" >}}) `wails setup` and filling your handle and email.

## Generate a new project

Generate a new project using the [init command]({{< relref "/reference/cli.md#init" >}}) `wails init`.

Select the default options.

## Build it!

Change into the project directory `cd my-project` and compile your application using the [build command]({{< relref "/reference/cli.md#build" >}}) `wails build`.

If all went well, you should have a compiled program in your local directory. Run it with `./my-project` or double click `myproject.exe` if on windows.

<div class="imagecontainer">
<img src="/images/app.png" style="width:65%">
</div>

### Serve

#### `wails serve`

While developing your apps using wails the preferred method is by the [serve command]({{< relref "/reference/cli.md#serve" >}}) `wails serve`.

{{% notice tip %}}
This produces a much **faster** lightweight build in _debug_ mode, excluding `npm` build scripts, saving time when developing the backend and also enabling use of `npm run serve` for partial browser development of frontend!
{{% /notice %}}

#### `npm run serve`

Change into the frontend directory `cd my-project/frontend` and serve your GUI using `npm run serve`.


## Next Steps

If you would like to start making an app right away, we suggest you explore Wails via our _awesome_ [tutorials]({{% relref "../tutorials" %}}).
If you would prefer to get to know the framework a little better before building anything, we suggest having a look through the
[concepts]({{% relref "../about/concepts.md" %}}).
Finally if you are advanced user and would like to get right in to it head over to the [API reference]({{% relref "../reference/api" %}}) & [Cli reference]({{% relref "../reference/cli" %}}) sections.


{{% notice tip %}}
Come by our [Slack](https://gophers.slack.com/messages/CJ4P9F7MZ) channel ([_Invite_](https://invite.slack.golangbridge.org)) for a chat or just to share with us what you've built with wails!
{{% /notice %}}
109 changes: 109 additions & 0 deletions content/gettingstarted/linux.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
title: "Linux"
date: 2019-08-29T04:54:28+10:00
weight: 2
draft: false
disableNextPrev: true
---

There are many Linux distributions in existence and we strive to support as many as possible.

### Officially supported distros:

Distro | Version
--------|--------
Debian | 8, 9, 10
Ubuntu | 16.04, 18,04, 19.04, 19.10
Arch | Rolling
CentOS | 6, 7
Fedora | 29, 30


### Community supported distros:

Distro | Version
--------|--------
Zorin | 15
Parrot | 4.7
Mint | 19
Elementary | 5
Kali | Rolling
Neon | 5.16
VoidLinux & VoidLinux-musl | Rolling
Gentoo | Rolling
OpenSuSE| Leap and Tumbleweed
Raspbian |
ArcoLinux |
Deepin |
Manjaro + Manjaro-ARM | Rolling


_If you don't see your distro in the lists bellow you have two options. Either open a ticket asking for support or if you feel adventurus follow the [guide how to add support for your linux distro]({{}}) and also consider making a PR so the community can benefit._


## Prerequisites

Wails uses cgo to bind to the native rendering engines so a number of platform dependencies are needed as well as an installation of Go. The basic requirements are:

- Go 1.12 or above
- npm
- gcc, gtk, webkitgtk
- Docker for Cross-Compilation support

### Go

Download Go either using your system package manager or from the [Go Downloads Page](https://golang.org/dl/).

Ensure that you follow the official [Go installation instructions](https://golang.org/doc/install#install).

Add `$GOPATH/bin` to the `PATH` and `on` to the `GO111MODULE` environment variables. You can do this by adding these lines to your `/etc/profile` (for a system-wide installation) or `$HOME/.profile`:

```bash
export PATH=$PATH:$GOPATH/bin
export GO111MODULE=on
```

{{% notice note %}}
_Note: changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as `source $HOME/.profile`._
{{% /notice %}}

### npm

Download `npm` either using your system package manager or from the [Node Downloads Page](https://nodejs.org/en/download/). It is best to use the latest release as that is what we generally test against.

Run `npm --version` to verify.

### gcc, gtk, webkit

For Linux, Wails uses `gcc`, `webkit` and `GTK`. These need to be installed using the distribution specific commands below.

#### Debian/Ubuntu & derivatives

`sudo apt install build-essential libgtk-3-dev libwebkit2gtk-4.0-dev`

#### Arch Linux & derivatives

`sudo pacman -S gcc pkgconf webkit2gtk gtk3`

#### Centos

`sudo yum install gcc-c++ make pkgconf-pkg-config webkitgtk3-devel gtk3-devel`

#### Fedora

`sudo yum install gcc-c++ make pkgconf-pkg-config webkit2gtk3-devel gtk3-devel`

#### VoidLinux & VoidLinux-musl

`xbps-install base-devel gtk+3-devel webkit2gtk-devel`

#### Gentoo

`sudo emerge gtk+:3 webkit-gtk`


{{% notice note %}}
If you have successfully installed these dependencies on a different flavour of Linux, please consider clicking the "Edit this page" link at the top of the page and submit a PR.
{{% /notice %}}

Now you are ready to move on to the next step of [installing Wails]({{< ref "installing.md" >}}).
Loading

0 comments on commit 1074b79

Please sign in to comment.