Skip to content

Commit 10239c1

Browse files
committed
i18n: add zh-Hans for tutorials
Signed-off-by: 82Flex <82flex@gmail.com>
1 parent 7d5b1e2 commit 10239c1

20 files changed

Lines changed: 229 additions & 95 deletions

docusaurus.config.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ import type * as Preset from '@docusaurus/preset-classic';
55
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
66
function getSiteTagline() {
77
switch(process.env.DOCUSAURUS_CURRENT_LOCALE) {
8-
case "zh-Hans": return "强大而灵活的 iOS 自动化工具,始于 2015 年。";
8+
case "zh-Hans": return "强大而灵活的 iOS 自动化工具 —— 经典传承,始于 2015 年。";
99
default: return "Powerful and flexible automation tool for iOS since 2015.";
1010
}
1111
}
1212

13+
function getEditUrl(type: 'docs' | 'blog' | 'pages') {
14+
switch(process.env.DOCUSAURUS_CURRENT_LOCALE) {
15+
case "zh-Hans": return `https://github.com/OwnGoalStudio/XXTouchElite/tree/main/i18n/zh-Hans/docusaurus-plugin-content-${type}/`;
16+
default: return "https://github.com/OwnGoalStudio/XXTouchElite/tree/main/";
17+
}
18+
}
19+
1320
const config: Config = {
1421
title: 'XXTouch Elite',
1522
tagline: getSiteTagline(),
@@ -53,8 +60,7 @@ const config: Config = {
5360
showLastUpdateTime: true,
5461
// Please change this to your repo.
5562
// Remove this to remove the "edit this page" links.
56-
editUrl:
57-
'https://github.com/OwnGoalStudio/XXTouchElite/tree/main/',
63+
editUrl: getEditUrl('docs'),
5864
},
5965
blog: {
6066
showReadingTime: true,
@@ -65,8 +71,7 @@ const config: Config = {
6571
},
6672
// Please change this to your repo.
6773
// Remove this to remove the "edit this page" links.
68-
editUrl:
69-
'https://github.com/OwnGoalStudio/XXTouchElite/tree/main/',
74+
editUrl: getEditUrl('blog'),
7075
// Useful options to enforce blogging best practices
7176
onInlineTags: 'ignore',
7277
onInlineAuthors: 'warn',

i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorial/congratulations.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
sidebar_position: 7
33
---
44

5-
# Congratulations!
5+
# 恭喜!
66

7-
You have just learned the basics of XXTouch Elite and made your first script to the GitHub Gist.
7+
你刚刚学习了 XXTouch Elite 的基础知识,并将你的第一个脚本上传到了 GitHub Gist
88

9-
XXTouch Elite has **much more to offer**!
9+
XXTouch Elite 还有**更多功能**等你探索!
1010

11-
Anything unclear or buggy in this tutorial? [Please report it!](https://github.com/OwnGoalStudio/XXTouchElite/issues/new)
11+
本教程中有任何不清楚或存在问题的地方?[请报告!](https://github.com/OwnGoalStudio/XXTouchElite/issues/new)
1212

13-
## What’s next?
13+
## 接下来呢?
1414

15-
- Learn more about [Lua scripting](https://www.tutorialspoint.com/lua).
16-
- Have a look at the [Lua 5.3 Reference Manual](https://cloudwu.github.io/lua53doc/manual.html).
17-
- Read the [API reference](../lua-manual/intro.md).
18-
- Haven’t installed XXTouch Elite yet? [Get it here](https://havoc.app/package/xxtouchelite).
19-
- Find inspirations in our [Blog](/blog).
20-
- Get involved in the [XXTouch Elite Community](https://github.com/OwnGoalStudio/XXTouchElite/issues).
15+
- 了解更多 [Lua 脚本编写](https://www.tutorialspoint.com/lua)
16+
- 查看 [Lua 5.3 参考手册](https://cloudwu.github.io/lua53doc/manual.html)
17+
- 阅读 [API 参考](../lua-manual/intro.md)
18+
- 还没安装 XXTouch Elite[点击这里获取](https://havoc.app/package/xxtouchelite)
19+
- 在我们的 [博客](/blog) 中寻找灵感。
20+
- 加入 [XXTouch Elite 社区](https://github.com/OwnGoalStudio/XXTouchElite/issues)

i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorial/intro.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,39 @@
22
sidebar_position: 1
33
---
44

5-
# Intro
5+
# 简介
66

77
![Intro.001](./img/Intro.001.png)
88

9-
XXTouch Elite is a powerful and flexible tool that allows you to create custom automation scripts for your devices. With XXTouch Elite, you can automate repetitive tasks, control smart home devices, and much more.
9+
XXTouch Elite 是一个功能强大且灵活的工具,允许你为设备创建自定义自动化脚本。通过 XXTouch Elite,你可以自动化重复性任务、控制智能家居设备等等。
1010

11-
XXTouch Elite uses [Lua](https://www.lua.org/) (v5.3) as its scripting language, which is a lightweight and **easy-to-learn** programming language. Lua is known for its simplicity and flexibility, making it an ideal choice for automation tasks.
11+
XXTouch Elite 使用 [Lua](https://www.lua.org/) (v5.3) 作为脚本语言,这是一种轻量且**易学**的编程语言。Lua 以其简单性和灵活性著称,是自动化任务的理想选择。
1212

13-
This documentation will guide you through the process of getting started with XXTouch Elite, including installation, configuration, and writing your first script. Whether you’re a beginner or an experienced programmer, you’ll find everything you need to know to start automating your devices with XXTouch Elite.
13+
本文档将指导你如何开始使用 XXTouch Elite,包括安装、配置和编写你的第一个脚本。无论你是初学者还是经验丰富的程序员,都能在这里找到开始使用 XXTouch Elite 自动化设备所需的一切。
1414

15-
## Requirements
15+
## 前置条件
1616

17-
- XXTouch Elite is designed to work on iPhone/iPad with iOS 14 and later.
18-
- You need to [jailbreak your device](https://ios.cfw.guide/types-of-jailbreak/) to use XXTouch Elite. Following jailbreak methods are supported and tested:
17+
- XXTouch Elite 设计用于运行 iOS 14 及以上版本的 iPhone 或 iPad。
18+
- 你需要 [越狱设备](https://ios.cfw.guide/types-of-jailbreak/) 才能使用 XXTouch Elite。以下越狱方法已支持并测试:
1919
- [unc0ver](https://unc0ver.dev/)
2020
- [Taurine](https://taurine.app/)
21-
- [Palera1n](https://palera.in/) (Rootless)
22-
- [Dopamine](https://ellekit.space/dopamine/) (Rootless and RootHide)
21+
- [Palera1n](https://palera.in/)Rootless
22+
- [Dopamine](https://ellekit.space/dopamine/)Rootless RootHide
2323

2424
![Requirements.002](./img/Requirements.002.png)
2525

26-
## Installation
26+
## 安装
2727

28-
1. Buy [XXTouch Elite](https://havoc.app/package/xxtouchelite) from Havoc Repo.
29-
2. Install “XXTouch Elite” from Sileo package manager.
30-
3. You may need to restart your device after installation.
28+
1. 从 Havoc 源购买 [XXTouch Elite](https://havoc.app/package/xxtouchelite)
29+
2. 从 Sileo 包管理器安装“XXTouch Elite”
30+
3. 安装后可能需要重启设备。
3131

3232
![Requirements.003](./img/Requirements.003.png)
3333

34-
## Updating your XXTouch Elite version
34+
## 更新 XXTouch Elite 版本
3535

36-
Keep your XXTouch Elite up to date by checking for updates in Sileo. You can also enable automatic updates in Sileo settings.
36+
通过在 Sileo 中检查更新保持 XXTouch Elite 的最新版本。你也可以在 Sileo 设置中启用自动更新。
3737

38-
## Problems?
38+
## 遇到问题?
3939

40-
Ask for help on our [GitHub repository](https://github.com/OwnGoalStudio/XXTouchElite/issues) or join our [Discord server](https://discord.gg/RTyMX6c9). We are happy to help you with any issues you may encounter while using XXTouch Elite.
40+
在我们的 [GitHub 仓库](https://github.com/OwnGoalStudio/XXTouchElite/issues) 提问或加入我们的 [Discord 服务器](https://discord.gg/RTyMX6c9)。我们很乐意帮助你解决使用 XXTouch Elite 时遇到的任何问题。

i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorial/make-some-notes.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,48 @@
22
sidebar_position: 5
33
---
44

5-
# Make Some Notes
5+
# 做一些笔记
66

7-
Now we are ready to start developing scripts. You can use the web interface to create and edit scripts, as well as test them in real-time.
7+
现在我们已经准备好开始开发脚本了。你可以使用网页界面来创建和编辑脚本,并实时测试它们。
88

9-
In this tutorial, we will create a simple script that opens “Notes” on your device, creates a new note, and writes the most famous sentence in the developer community: `Hello, World!`.
9+
在本教程中,我们将创建一个简单的脚本,该脚本将在你的设备上打开 “备忘录” 应用,创建一个新笔记,并写下开发者社区中最著名的一句话:`Hello, World!`
1010

11-
## Create a New Script
11+
## 创建新脚本
1212

13-
Let’s start by creating a new script. Click on the “New Script” button on the top-right corner of the page. Enter a name for your script, e.g. `my-awesome-script.lua`.
13+
让我们从创建一个新脚本开始。点击页面右上角的 “新建脚本” 按钮。为你的脚本输入一个名称,例如 `my-awesome-script.lua`
1414

1515
![Web_Access.003](./img/Web_Access.003.png)
1616

17-
## Open “Notes
17+
## 打开 “备忘录
1818

19-
The first thing we need to do is to open the “Notes” app. To do this, we will use the [`app.run`](../lua-manual/app.md#run-the-app-apprun) function. The [`app.run`](../lua-manual/app.md#run-the-app-apprun) function takes a string as an argument, which is the bundle identifier of the app we want to open. In our case, we want to open the “Notes” app, so we will use the string `"com.apple.mobilenotes"`.
19+
我们需要做的第一件事是打开 “备忘录” 应用。为此,我们将使用 [`app.run`](../lua-manual/app.md#run-the-app-apprun) 函数。[`app.run`](../lua-manual/app.md#run-the-app-apprun) 函数接受一个字符串作为参数,该字符串是我们想要打开的应用的包标识符。在我们的例子中,我们想要打开 “备忘录” 应用,因此我们将使用字符串 `"com.apple.mobilenotes"`
2020

2121
```lua
2222
nLog("Open Notes...")
2323
app.run("com.apple.mobilenotes")
2424
```
2525

26-
Note that the [`nLog`](../lua-manual/appendix/logging-facilities.md#nlog) function is used to log messages to the console. This is useful for debugging and testing your scripts.
26+
请注意,[`nLog`](../lua-manual/appendix/logging-facilities.md#nlog) 函数用于将消息记录到控制台。这对于调试和测试你的脚本非常有用。
2727

28-
Click “Play” button at the bottom-right corner of the page to run the script. You should see the “Notes” app open on your device.
28+
点击页面右下角的 “播放” 按钮运行脚本。你应该会看到 “备忘录” 应用在你的设备上打开。
2929

3030
![Web_Access.004](./img/Web_Access.004.png)
3131

3232
:::info
33-
Find the bundle identifier of an app from “More” → “Application List” in “X.X.T.E.” app.
33+
在 “X.X.T.E.” 应用中,从 “更多” → “应用列表” 中找到应用的包标识符。
3434
:::
3535

36-
## Find “New Note” Button
36+
## 找到 “新建笔记” 按钮
3737

38-
Now that we have opened the “Notes” app, we need to find the “New Note” button. To do this, we will use the [`screen.find_color`](../lua-manual/screen.md#-multi-point-similarity-mode-color-finding-screenfind_color) function. The [`screen.find_color`](../lua-manual/screen.md#-multi-point-similarity-mode-color-finding-screenfind_color) function takes a color table as an argument, which is the collection of the color samples we want to find.
38+
现在我们已经打开了 “备忘录” 应用,我们需要找到 “新建笔记” 按钮。为此,我们将使用 [`screen.find_color`](../lua-manual/screen.md#-multi-point-similarity-mode-color-finding-screenfind_color) 函数。[`screen.find_color`](../lua-manual/screen.md#-multi-point-similarity-mode-color-finding-screenfind_color) 函数接受一个颜色表作为参数,这是我们想要找到的颜色样本的集合。
3939

4040
![Make_Notes](./img/Make_Notes.gif)
4141

42-
Open “Color Picker” in the sidebar, locate the “New Note” button, and click on it. This will add the color sample to the color table. You have to add more color samples to increase the possibility of finding the button.
42+
在侧边栏中打开 “颜色选择器”,找到 “新建笔记” 按钮并点击它。这将把颜色样本添加到颜色表中。你需要添加更多颜色样本以增加找到按钮的可能性。
4343

4444
![Web_Access.005](./img/Web_Access.005.png)
4545

46-
Copy generated code from `find_color` function and paste it into your script:
46+
`find_color` 函数中复制生成的代码并粘贴到你的脚本中:
4747

4848
```lua
4949
local x, y
@@ -66,37 +66,37 @@ touch.tap(x, y)
6666
sys.sleep(2)
6767
```
6868

69-
Here we’ve added 6 color samples to the color table. Use `while ... do` loop to keep searching for the button until it is found. The [`sys.sleep(1)`](../lua-manual/sys.md#-second-level-delay-syssleep) function is used to pause the script for 1 second before searching again.
69+
这里我们向颜色表中添加了 6 个颜色样本。使用 `while ... do` 循环不断搜索按钮,直到找到为止。[`sys.sleep(1)`](../lua-manual/sys.md#-second-level-delay-syssleep) 函数用于在再次搜索之前暂停脚本 1 秒。
7070

71-
The [`screen.find_color`](../lua-manual/screen.md#-multi-point-similarity-mode-color-finding-screenfind_color) function returns the coordinates of the button if it is found, or `nil` if it is not found. We will use these coordinates with [`touch.tap`](../lua-manual/touch.md#simulate-a-single-tap-on-the-screen-touchtap) to click on the button.
71+
[`screen.find_color`](../lua-manual/screen.md#-multi-point-similarity-mode-color-finding-screenfind_color) 函数返回按钮的坐标(如果找到),或者返回 `nil`(如果未找到)。我们将使用这些坐标与 [`touch.tap`](../lua-manual/touch.md#simulate-a-single-tap-on-the-screen-touchtap) 一起点击按钮。
7272

7373
:::tip
74-
Making color samples is not an easy task. Here are some practical tips:
74+
制作颜色样本并不容易。以下是一些实用技巧:
7575

76-
1. **Select different colors**. Different colors make the search more unique.
77-
2. **Avoid graph edges**. Due to the anti-aliasing effect, the colors on the edges vary a lot.
78-
3. **Stay spread out**. The sampled points should be spread out to cover more space in the area that you want to locate.
76+
1. **选择不同的颜色**。不同的颜色使搜索更具唯一性。
77+
2. **避免图形边缘**。由于抗锯齿效果,边缘上的颜色变化很大。
78+
3. **保持分散**。采样点应分散开来,以覆盖你想要定位的区域中的更多空间。
7979

8080
:::
8181

82-
## Enter “Hello, World!”
82+
## 输入 “Hello, World!”
8383

84-
Sending text to the “Notes” app is the most straightforward part. We can use the [`key.send_text`](../lua-manual/key.md#simulate-typing-text-keysend_text) function to send text to the app. The [`key.send_text`](../lua-manual/key.md#simulate-typing-text-keysend_text) function takes a string as an argument, which is the text we want to send.
84+
向 “备忘录” 应用发送文本是最简单的部分。我们可以使用 [`key.send_text`](../lua-manual/key.md#simulate-typing-text-keysend_text) 函数向应用发送文本。[`key.send_text`](../lua-manual/key.md#simulate-typing-text-keysend_text) 函数接受一个字符串作为参数,这是我们想要发送的文本。
8585

8686
```lua
8787
nLog("Enter text…")
8888
key.send_text("Hello, world!")
8989
```
9090

91-
Click “Play” button at the bottom-right corner of the page to run the script.
91+
点击页面右下角的 “播放” 按钮运行脚本。
9292

9393
![Make_Notes_Final](./img/Make_Notes_Final.gif)
9494

95-
## Tap “Done
95+
## 点击 “完成
9696

97-
Finally, we need to tap the “Done” button to save the note. We can use the [`screen.ocr_text`](../lua-manual/screen.md#-screen-optical-character-recognition-screenocr_text) function to find the “Done” button and then use [`touch.tap`](../lua-manual/touch.md#simulate-a-single-tap-on-the-screen-touchtap) to click on it. This part is a bit tricky because texts are easily affected by the font and size, so we need to use OCR (Optical Character Recognition) to find it.
97+
最后,我们需要点击 “完成” 按钮以保存笔记。我们可以使用 [`screen.ocr_text`](../lua-manual/screen.md#-screen-optical-character-recognition-screenocr_text) 函数找到 “完成” 按钮,然后使用 [`touch.tap`](../lua-manual/touch.md#simulate-a-single-tap-on-the-screen-touchtap) 点击它。这部分有点棘手,因为文本容易受到字体和大小的影响,因此我们需要使用 OCR(光学字符识别)来找到它。
9898

99-
**Here is our final script:**
99+
**以下是我们的最终脚本:**
100100

101101
```lua
102102
nLog("Open “Notes”…")

i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorial/ready-to-develop.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
sidebar_position: 4
33
---
44

5-
# Ready to Develop
5+
# 准备开发
66

7-
To get started with script development, you need to have a laptop or desktop computer with Safari or Chrome installed.
7+
要开始脚本开发,你需要一台安装了 Safari Chrome 的笔记本电脑或台式电脑。
88

9-
## Enable Remote Access
9+
## 启用远程访问
1010

11-
To protect your device from unauthorized access, you need to enable remote access in the “X.X.T.E.” app.
11+
为了保护你的设备免受未经授权的访问,你需要在 “X.X.T.E.” 应用中启用远程访问。
1212

1313
![Remote_Access.001](./img/Remote_Access.001.png)
1414

15-
## Access from Web Browser
15+
## 从网页浏览器访问
1616

17-
Then you can access your scripts from your web browser by entering the following URL:
17+
然后,你可以通过在网页浏览器中输入以下 URL 来访问你的脚本:
1818

1919
```txt
2020
http://<ip_address>:46952
2121
```
2222

23-
Where `<ip_address>` is the IP address of your device and `46952` is the default port number of XXTouch Elite.
23+
其中 `<ip_address>` 是你的设备的 IP 地址,`46952` XXTouch Elite 的默认端口号。
2424

2525
![Web_Access.001](./img/Web_Access.001.png)

i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorial/record-and-replay.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22
sidebar_position: 2
33
---
44

5-
# Record and Replay
5+
# 录制和回放
66

7-
Press physical volume buttons to record and replay your actions.
7+
按下物理音量按钮即可录制和回放你的操作。
88

9-
You can customize the behaviors of the volume buttons in “More” → “Shortcut Config”.
9+
你可以在 “更多” → “快捷键配置” 中自定义音量按钮的行为。
1010

11-
## How to Record
11+
## 如何录制
1212

13-
1. Press volume button and select “Record”.
14-
2. Do whatever you want
15-
3. Press volume button again and select “Stop”.
13+
1. 按下音量按钮并选择 “录制”。
14+
2. 执行你想要的操作
15+
3. 再次按下音量按钮并选择 “停止”。
1616

1717
![Record_And_Replay.003](./img/Record_And_Replay.003.png)
1818

19-
## How to Replay
19+
## 如何回放
2020

21-
1. Select any script.
22-
2. Press volume button and select “Launch”.
21+
1. 选择任意脚本。
22+
2. 按下音量按钮并选择 “启动”。
2323

2424
![Record_And_Replay.005](./img/Record_And_Replay.005.png)
2525

26-
## Playback Options
26+
## 回放选项
2727

28-
You can customize the playback speed and the number of loops for recorded scripts.
28+
你可以自定义录制脚本的回放速度和循环次数。
2929

30-
1. Slide the script to the right and click the “Property” button.
31-
2. Tap “Speed and Repeat Settings”.
32-
3. Set the playback speed and the number of loops (or infinite).
33-
4. Press volume button and select “Launch”.
30+
1. 向右滑动脚本并点击 “属性” 按钮。
31+
2. 点击 “速度和重复设置”。
32+
3. 设置回放速度和循环次数(或无限循环)。
33+
4. 按下音量按钮并选择 “启动”。
3434

3535
![Record_And_Replay.006](./img/Record_And_Replay.006.png)

i18n/zh-Hans/docusaurus-plugin-content-docs/current/tutorial/run-custom-script.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
sidebar_position: 3
33
---
44

5-
# Run Custom Script
5+
# 运行自定义脚本
66

7-
Playing recorded scripts is great, but it is unlikely to respond to all the possible situations that can occur in a real-world scenario. For this reason, it is important to create a script that can handle different situations.
7+
运行录制的脚本很棒,但它可能无法应对现实场景中可能发生的所有情况。因此,创建一个可以处理不同情况的脚本非常重要。
88

9-
Now we’ve written a script for you that will help you get started. This script will open the “Settings”, scroll down to find “App Store” option, and click on it.
9+
现在我们为你编写了一个脚本,帮助你入门。这个脚本将打开 “设置”,向下滚动找到 “App Store” 选项并点击它。
1010

1111
```lua
1212
local function tapWord(word)
@@ -37,12 +37,12 @@ while not tapWord("App Store") do
3737
end
3838
```
3939

40-
## Find App Store
40+
## 找到 App Store
4141

42-
You can follow the steps below to run the script above:
42+
你可以按照以下步骤运行上述脚本:
4343

44-
1. Create a new lua script file named `my-first-script.lua`.
45-
2. Copy the code below and paste it into the file, and save it.
46-
3. Slide the script to the right and click the “Launch” button.
44+
1. 创建一个名为 `my-first-script.lua` 的新 Lua 脚本文件。
45+
2. 将上述代码复制并粘贴到文件中,然后保存。
46+
3. 向右滑动脚本并点击“启动”按钮。
4747

4848
![Create_A_Script.002](./img/Create_A_Script.002.png)

0 commit comments

Comments
 (0)