Skip to content

Commit d8391e6

Browse files
authored
[i18n] Add Japanese translations to JavaScript API (#2800)
## Motivation for the change, related issues Part of #2202 Add Japanese translations to JavaScript API
1 parent e434c6e commit d8391e6

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
slug: /developers/apis/javascript-api
3+
---
4+
5+
# JavaScript API
6+
7+
WordPress Playground には、WordPress を完全に制御できる JavaScript API クライアントが付属しています。
8+
9+
<!--
10+
WordPress Playground comes with a JavaScript API client that grants you full control over your WordPress.
11+
-->
12+
13+
:::info ここでの API は「REST API」を意味するものではありません
14+
15+
WordPress Playground はブラウザベースのアプリケーションです。
16+
ここでの API とは、JavaScript 内で呼び出せる関数のセットを指します。
17+
これはネットワークベースの REST API ではありません。
18+
19+
:::
20+
21+
<!--
22+
:::info API here doesn't mean "REST API"
23+
24+
WordPress Playground is a browser-based application.
25+
The term API here refers to a set of functions you can
26+
call inside JavaScript. This is **not** a network-based REST API.
27+
28+
:::
29+
-->
30+
31+
## クイックスタート
32+
33+
<!--
34+
## Quick start
35+
-->
36+
37+
JavaScript API を使用するには、次のものが必要です。
38+
39+
<!--
40+
To use the JavaScript API, you'll need:
41+
-->
42+
43+
- `<iframe>` 要素
44+
- `@wp-playground/client` パッケージ(npm または CDN から)
45+
46+
<!--
47+
- An `<iframe>` element
48+
- The `@wp-playground/client` package (from npm or a CDN)
49+
-->
50+
51+
HTML ページで JavaScript API を使用する最も短い例を次に示します。
52+
53+
<!--
54+
Here's the shortest example of how to use the JavaScript API in a HTML page:
55+
-->
56+
57+
import JSApiShortExample from '@site/docs/\_fragments/\_js_api_short_example.mdx';
58+
59+
<JSApiShortExample />
60+
61+
:::info /remote.html は特別な URL です
62+
63+
`/remote.html` は、ブラウザ UI を備えたデモアプリではなく、Playground API エンドポイントを読み込む特別な URL です。`/``/remote.html` の違いについては、[このページ](/developers/apis/javascript-api/-html-vs-remote-html) をご覧ください。
64+
65+
:::
66+
67+
<!--
68+
:::info /remote.html is a special URL
69+
70+
`/remote.html` is a special URL that loads the Playground
71+
API endpoint instead of the demo app with the browser UI. Read more about the difference between `/` and `/remote.html` and [on this page](/developers/apis/javascript-api/-html-vs-remote-html).
72+
73+
:::
74+
-->
75+
76+
## ウェブサイトの制御
77+
78+
<!--
79+
## Controlling the website
80+
-->
81+
82+
`client` オブジェクトが作成されたので、これを使って iframe 内のウェブサイトを制御できます。制御方法は 3 つあります。
83+
84+
<!--
85+
Now that you have a `client` object, you can use it to control the website inside the iframe. There are three ways to do that:
86+
-->
87+
88+
- [Playground API Client](/developers/apis/javascript-api/playground-api-client)
89+
- [ブループリント JSON](/developers/apis/javascript-api/blueprint-json-in-api-client)
90+
- [ブループリント 関数](/developers/apis/javascript-api/blueprint-functions-in-api-client)
91+
92+
<!--
93+
- [Playground API Client](/developers/apis/javascript-api/playground-api-client)
94+
- [Blueprint JSON](/developers/apis/javascript-api/blueprint-json-in-api-client)
95+
- [Blueprint functions](/developers/apis/javascript-api/blueprint-functions-in-api-client)
96+
-->
97+
98+
## デバッグとテスト
99+
100+
<!--
101+
## Debugging and testing
102+
-->
103+
104+
迅速なテストとデバッグのために、JavaScript API クライアントは `index.html``remote.html` の両方で `window.playground` として公開されます。
105+
106+
<!--
107+
For quick testing and debugging, the JavaScript API client is exposed as `window.playground` by both `index.html` and `remote.html`.
108+
-->
109+
110+
```javascript
111+
> await playground.listFiles("/")
112+
(6) ['tmp', 'home', 'dev', 'proc', 'internal', 'wordpress']
113+
```
114+
115+
`index.html` では、`playground` は Proxy オブジェクトなので、ブラウザによる自動補完は利用できません。ただし、`remote.html` では、`playground` はクラスインスタンスなので、ブラウザの自動補完を利用できます。
116+
117+
<!--
118+
Note that in `index.html`, `playground` is a Proxy object and you won't get any autocompletion from the browser. In `remote.html`,
119+
however, `playground` is a class instance and you will benefit from browser's autocompletion.
120+
-->
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"label": "JavaScript API"
3+
}

0 commit comments

Comments
 (0)