docs: sync documents (#2443)

Co-authored-by: misitebao <misitebao@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2023-03-11 17:57:56 +11:00
committed by GitHub
co-authored by misitebao
parent e339c40e85
commit 4cd873fecb
215 changed files with 5219 additions and 2810 deletions
@@ -2,7 +2,7 @@
sidebar_position: 20
---
# Dogs API
# ドッグAPI
```mdx-code-block
<div class="text--center">
@@ -17,25 +17,25 @@ sidebar_position: 20
:::note
このチュートリアルは[@tatadan](https://twitter.com/tatadan)の好意により提供されたもので、[Wails Examples Repository](https://github.com/tataDan/wails-v2-examples)の一部を構成しています。
このチュートリアルは[@tatadan](https://twitter.com/tatadan)より提供されたもので、[Wails Examples Repository](https://github.com/tataDan/wails-v2-examples)の一部になります。
:::
このチュートリアルでは、Webから犬の写真を取得し表示するアプリケーションを開発します。
このチュートリアルでは、Webから犬の写真を取得し表示するためのアプリケーションを開発していきます。
### プロジェクト作成する
### プロジェクト作成
では、アプリケーションを作成しましょう。ターミナルで次のコマンドを入力します: `wails init -n dogs-api -t svelte`
アプリケーションを作成していきましょう。 ターミナルで次のように入力します: `wails init -n dogs-api -t svelte`
注: IDEサポートを追加したい場合は、オプションでこのコマンドの最後に`-ide vscode`または`ide goland`を追加することができます
: IDEサポートが欲しい場合は、コマンドの末尾に、`-ide vscode`オプションまたは`-ide goland`オプションを付与してください
では、cd `dogs-api`をして、プロジェクトファイルの編集を始めましょう。
では、`cd dogs-api`で移動し、プロジェクトファイルの編集を始めましょう。
### 未使用コード削除する
### 未使用コード削除
まず、使用しないことがわかっているいくつかの要素を削除することから始めます:
まず、使用しないと分かっているいくつかの要素を削除していきます:
- `app.go`を開き、以下の行を削除してください:
- `app.go`を開き、の行を削除します:
```go
// Greet returns a greeting for the given name
@@ -49,9 +49,9 @@ func (a *App) Greet(name string) string {
### アプリケーションの作成
では、新しいGoコードを追加してみましょう。
では、新しいGoコードを書いていきましょう。
`app.go`の関数定義の前に、次の構造体宣言を追加します:
関数を定義する前に、`app.go`に下記の構造体宣言を追加します:
```go
type RandomImage struct {
@@ -70,7 +70,7 @@ type ImagesByBreed struct {
}
```
下の関数を`app.go`に追加します既存の関数定義の後ろに追加するかもしれません):
の関数を`app.go`に追加します(おそらく既存の関数定義の後ろに追加することになります):
```go
func (a *App) GetRandomImageUrl() string {
@@ -149,9 +149,7 @@ import (
)
```
以下の行を`frontend/src/App.svelte`に追加します:
```html
`frontend/src/App.svelte`に次の行を追加します:
<!-- prettier-ignore-start -->
```html
@@ -240,8 +238,8 @@ import (
### アプリケーションのテスト
バインディングを生成しアプリケーションをテストするには、`wails dev`を実行します
バインディングを生成しアプリケーションをテストするには、`wails dev`コマンドを実行してください
### アプリケーションのコンパイル
アプリケーションを単一の、本番用のバイナリにコンパイルするには、`wails build`を実行します。
アプリケーションを本番用の単一バイナリにコンパイルするには、`wails build`コマンドを実行してください。
@@ -4,27 +4,27 @@ sidebar_position: 10
# Hello World
The aim of this tutorial is to get you up and running with the most basic application using Wails. You will be able to:
このチュートリアルの目的は、Wailsを使用して、最も基礎的なアプリケーションを起動および実行することです。 あなたは、次のことができるようになります:
- Create a new Wails application
- Build the application
- Run the application
- 新しいWailsアプリケーションを作成する
- アプリケーションをビルドする
- アプリケーションを実行する
:::note
This tutorial uses Windows as the target platform. Output will vary slightly depending on your operating system.
このチュートリアルでは、Windowsをターゲットプラットフォームとして使用します。 出力される内容は、オペレーティングシステムによって多少異なります。
:::
## Create a new Wails application
## 新しいWailsアプリケーションを作成する
To create a new Wails application using the default vanilla JS template, you need to run the following command:
デフォルトのバニラJSテンプレートを使用して、新しいWailsアプリケーションを作成するには、次のコマンドを実行します:
```bash
wails init -n helloworld
```
You should see something similar to the following:
すると、次のように表示されます:
```
Wails CLI v2.0.0
@@ -40,7 +40,7 @@ Template Support: https://wails.io
Initialised project 'helloworld' in 232ms.
```
This will create a new directory called `helloworld` in the current directory. In this directory, you will find a number of files:
これにより、カレントディレクトリに`helloworld`という新しいディレクトリが作成されます。 このディレクトリには、いくつかのファイルがあります:
```
build/ - Contains the build files + compiled application
@@ -52,15 +52,15 @@ go.mod - The go module file
go.sum - The go module checksum file
```
## Build the application
## アプリケーションをビルドする
To build the application, change to the new `helloworld` project directory and run the following command:
アプリケーションをビルドするには、新しくできた`helloworld`プロジェクトディレクトリに移動し、次のコマンドを実行します:
```bash
wails build
```
You should see something like the following:
すると、次のように表示されます:
```
Wails CLI v2.0.0
@@ -86,11 +86,11 @@ Building target: windows/amd64
Built 'C:\Users\leaan\tutorial\helloworld\build\bin\helloworld.exe' in 10.616s.
```
This has compiled the application and saved it in the `build/bin` directory.
これにより、アプリケーションがコンパイルされ、`build/bin`ディレクトリに保存されます。
## Run the application
## アプリケーションを実行する
If we view the `build/bin` directory in Windows Explorer, we should see our project binary:
Windowsのエクスプローラで`build/bin`ディレクトリを閲覧すると、プロジェクトのバイナリファイルが存在するはずです:
```mdx-code-block
<div class="text--center">
@@ -102,13 +102,13 @@ If we view the `build/bin` directory in Windows Explorer, we should see our proj
<br />
```
We can run it by simply double-clicking the `helloworld.exe` file.
`helloworld.exe`ファイルをダブルクリックするだけで起動できます。
On Mac, Wails generates a `helloworld.app` file which can be run by double-clicking it.
Macの場合、Wailsは`helloworld.app`ファイルを生成します。このファイルをダブルクリックすることで起動できます。
On Linux, you can run the application using `./helloworld` from the `build/bin` directory.
Linuxの場合、`build/bin`ディレクトリ内の`./helloworld`を呼び出すことでアプリケーションを起動できます。
You should see the application working as expected:
アプリケーションが期待したとおりに動作することでしょう:
```mdx-code-block
<div class="text--center">
@@ -119,4 +119,4 @@ You should see the application working as expected:
/>
</div>
<br />
```
```