Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zh-cn Translate to Documents ingame and some fix of zh-cn lang file #245

Open
wants to merge 3 commits into
base: 1.18-forge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 基本
本文档包含有关 [电脑](block/computer.md) 如何工作的一些基本信息。 这并不一定意味着这些信息很容易阅读。 这里的基本是指使用中的一般概念。

## 架构
这些 [电脑](block/computer.md) 在单核通用 RISC-V 架构上运行。 这意味着它们具有 64 位寄存器并支持浮点运算。 这使得在它们上启动现代 Linux 内核成为可能。

### 本机设备
连接到 [电脑](block/computer.md) 的本机设备是内存映射设备。 这意味着它们被映射到物理内存中的某个区域。 计算机使用常规的 Linux 驱动程序与之交互。

由于此数据结构在引导的时候被复制,因此启动无法更新。 这就是对本地设备(例如 [网卡](item/network_interface_card.md))进行更改时必须重新启动 [电脑](block/computer.md) 的原因。 属于这种情况的设备通常会在其工具提示中具有相应的注释。

### HLAPI 设备
另一种设备是高级 API 设备,有时也称为 RPC 设备。 这些设备使用单个控制器,通过单个串行设备与 [电脑](block/computer.md) 进行通信。 该控制器设备存在于所有 [电脑](block/computer.md) 中,负责从多个设备收集消息,并将消息分派给设备。 这个控制器使用的协议是一个简单的基于 JSON 消息的协议。 默认 Linux 库提供的 `devices` Lua 库包装了用于连接到此控制器的串行设备。 因此,*强烈*建议在使用 HLAPI 设备时使用 `devices` 库,例如 [红石接口](block/redstone_interface.md)。

由于所采用协议的性质,数据速率相当有限。 因此,大多数设备通常只提供相对简单的 API,不需要以任何方式发送大量数据。

## 配置
[电脑](block/computer.md) 可以在某种程度上进行配置。 [内存](item/memory.md)、[硬盘驱动器](item/hard_drive.md) 形式的额外存储以及最重要的是要安装哪些卡,很大程度上取决于用户。 请注意,默认的 Linux 发行版确实需要至少 20M 的内存,建议使用 24M。

大多数组件都会影响 [电脑](block/computer.md) 的整体能耗。 为了节约能源,只选择必要的组件是必不可少的。

## Linux
默认的 Linux 发行版包含一些基本的命令行工具,以及编写和运行 Lua 程序的能力。 有关如何使用 Lua 与 HLAPI 设备交互的概述,请参阅 [脚本](scripting.md) 手册条目。

本机设备使用常规的 Linux 驱动程序。 例如,硬盘驱动器显示为“/dev/vdaX”设备,可以定期格式化和挂载。

计算机提供两个硬件时钟 (RTC) 设备。 第一个以大多数用户会想到的比例计算时间。默认情况下使用它,例如命令行工具,如 `date` 和 `time`。 第二个测量时间,因为它在计算机运行的世界中工作。要获得当前世界时间,请使用`hwclock -f /dev/rtc1`。
8 changes: 8 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/bus_cable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 总线线缆
![派对巴士](block:oc2:bus_cable)

(译者注:‘派对巴士’实为双关,Bus同时有总线和巴士之意)

总线线缆连接 [总线接口](bus_interface.md) 到电脑.

已放置的线缆可以被装饰性方块隐藏. 对其使用 [扳手](../item/wrench.md) 去移除线缆的伪装.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 总线接口
![即插即用](item:oc2:bus_interface)

总线接口用于将外部设备连接至 [电脑](computer.md). 这包含一些设备块,例如 [红石接口](redstone_interface.md). 一些方块的通用功能也是可用的,例如能量储存方块的信息.

使用 [扳手](../item/wrench.md) 去设置总线接口的名称是可能的 . 这在连接多个相同设备时极为有用。: 当使用typeName方法搜索设备时 (`devices:find(typeName)`), 这些自定义名称也同样起效.

需要注意的是,[电脑](computer.md) 也必须用总线接口去连接 [总线](bus_cable.md) .
8 changes: 8 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/charger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 充电器
![代号:Leeroy](block:oc2:charger)

充电器从连接的电源输送电力到其上方的用电器.

这个充电器同时也支持通过无线传输为RF能源的机器充电. 特别是实体和方块以及在常规储存容器内的物品(例如方块和实体) 将会被充电.

这个设备在为 [机器人](../item/robot.md) 或是你物品栏内的的用电器充电时特别有用.
15 changes: 15 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/computer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 电脑
![1 + 1 = 10](block:oc2:computer)

电脑为你运行操作系统或运行低级程序提供了基础.

阅读 [快速入门指南](../getting_started.md) 以了解如何组装一个可以运作的电脑.

### 组装
使用电脑自带的储存空间来配置你的电脑. 通过用 [扳手](../item/wrench.md)点击电脑或在终端界面通过左侧的按钮来访问该界面.

### 连接
为了连接外部设备, 使用 [总线接口](bus_interface.md) 和 [总线线缆](bus_cable.md). 需要注意的是,电脑必须通过总线接口去连接总线.

### 能量
通常情况下,电脑需要能量去运作. 大部分生产RF能源的现代发电机应该是兼容的. 电脑有一个小型的内部能量储存单元. 然而,这通常不能支持机器长时间运行.
14 changes: 14 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/disk_drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 软盘驱动器
![带她旋转起来](block:oc2:disk_drive)

软盘驱动器提供了一个快速信息交换的选项. [软盘](../item/floppy.md) 可以在电脑运行时热插拔, 这使其区别于 [硬盘](../item/hard_drive.md).

需要注意的是,强烈建议用户在移除软盘前先在系统中卸载软盘以避免任何可能的数据丢失

在GNU/Linux系统中,软盘通常会以 `/dev/vdX` 设备的形式出现, 紧随着硬盘. 他们不会自动格式化或挂载,只会以RAW格式下的设备方块出现. 为了使用他们,你需要先设置他们.例如,在一个标准的Linux发行版中,以下这些指令十分有用 :

- 运行 `mke2fs /dev/vdX` 以格式化该软盘. 当第一次使用该软盘时运行该命令. *注意!这将清除软盘上的所有数据*
- 运行`mount /dev/vdX <mount directory>` 以在格式化后挂载该软盘. 请确认你挂载的目录是存在且是空目录.
- 运行`umount <mount directory>` 以卸载该软盘.请确认在移除软盘前执行该命令以避免数据丢失.

电脑需要在安装或移除该部件之前*关机* .在电脑运行时安装该部件将不能使用, 移除该部件可能会导致系统崩溃.
15 changes: 15 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 方块
该索引列出了所有被记录的方块。 如果你寻找的是一个物品,请参阅 [物品索引](../item/index.md)。

要快速查阅世界上一个方块的资料,只需在对着方块块用本[手册](../item/manual.md)右键(电脑等可交互的方块需要按下Shift)。

- [总线线缆](bus_cable.md)
- [总线接口](bus_interface.md)
- [充电器](charger.md)
- [电脑](computer.md)
- [磁盘驱动器](disk_drive.md)
- [键盘](keyboard.md)
- [网络连接口](network_connector.md)
- [网线集线器](network_hub.md)
- [投影仪](projector.md)
- [红石接口](redstone_interface.md)
12 changes: 12 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/keyboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 键盘
![选择按下还是不按下](block:oc2:keyboard)

键盘允许键盘按键事件能被 [电脑](computer.md) 响应.他的主要用例 是[投影仪](projector.md), 当正在使用Linux时.

当使用标准的Linux发行版时,设备将会通过`evdev`提供事件. 为了不需要额外设置便可使用, 使用一个 [投影仪](projector.md). 键盘的输入将会发送到显示在投影仪上的终端进程.

需要注意的是,唯一能和总线接口大小匹配只有键盘的底面. 键盘可以被放置在任何地方,只需要通过总线连接到电脑.

当开始在键盘上打字说, 简单的右击键盘. 有经验的打字者将发现他们无需在打字时看着键盘 (你仍然可以在使用键盘时向四周看). 再次右击键盘以停止使用它.

电脑需要在安装或移除该部件之前*关机* .在电脑运行时安装该部件将不能使用, 移除该部件可能会导致系统崩溃.
10 changes: 10 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/network_connector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 网络连接器
![数据必须流动](block:oc2:network_connector)

网络连接器是组成网络系统的基础部部件以用于连接不同[电脑](computer.md). 使用 [网线](../item/network_cable.md) 以互相连接.

每个连接器也作为中继数据包时的‘跃点’. 数据包只会在丢包前传输过有限的连接器.

需要注意的是每个连接器只能连接两个网络线缆.串联多个连接器来增加数据跨越的范围.

通过串联连接器来创建一个简单的局域网. 如果要创造一个网状网络, 请使用 [网线集线器](network_hub.md). 集线器将会连接所有与其链接的网络连接器.
4 changes: 4 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/network_hub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 网线集线器
![从一到五(译者注:疑似含有其他含义,暂定该翻译)](block:oc2:network_hub)

网线集线器互相连接多个[网络连接器](network_connector.md) . 他将转发连接器发送的数据包到任何一个连接在该集线器上的连接器. 这个转发过程将被记作一个跃点, 减少数据包存在的时间.
12 changes: 12 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/block/projector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 投影仪
![墙上上有投影!](block:oc2:projector)

投影仪是 [电脑](computer.md) 的一个帧缓冲设备。投影仪的分辨率为 640 x 480 像素,颜色格式为 r5g6b5:5位用于红色,6位用于绿色,5位用于蓝色。

投影仪需要直接供电才能运行。 设备总线无法自行提供足够的能量。 供电不足时,投影机镜头会发出红光来指示。

在 Linux 系统上,投影仪通常会显示为 `/dev/fbX` 设备。要将数据发送到帧缓冲区,可以写入这些设备。 例如,要清除帧缓冲区,可能会像这样将零传输到设备:`cat /dev/zero > /dev/fb0`。

当使用默认的 Linux 发行版时,可以使用 [键盘](keyboard.md) 将输入发送到虚拟终端,在第一个连接的帧缓冲区上运行。

电脑需要在安装或移除该部件之前*关机* .在电脑运行时安装该部件将不能使用, 移除该部件可能会导致系统崩溃。
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 红石接口(尚未完成翻译)
![所有东西都是红的!](block:oc2:redstone_interface)

(译者注:上文的Red(stone)略去了Stone,故做此翻译)

红石接口提供了发射和接收红石信号的全向总线.

用该设备来与红石设备互动,如门和灯, 或者其他提供红石通讯方式的设备.

这是一个高级设备.其必须通过高级设备API控制. 标准的Linux发行版提供了这个API的库. 例如:
`local d = require("devices")`
`local r = d:find("redstone")`
`r:setRedstoneOutput("up", 15)`

## API
设备名称: `redstone`

### Sides
The side parameter in the following methods represents a side local to the device block. Valid values are: `up`, `down`, `left`, `right`, `front`, `back`, `north`, `south`, `west` and `east`.

Each face of the block has an indicator for convenience. Side names represent the names with the block seen from the primary face (indicated by a single marking). When looking at the primary face:
- `front` and `south` is the face we are looking at.
- `back` and `north` is the face behind the block.
- `left` and `west` is the face to our left.
- `right` and `east` is the face to our right.
- `up` and `down` are the top and bottom faces.

### Methods
`getRedstoneInput(side):number` gets the received redstone signal for the specified side.
- `side` is a string representing the side to get the input on. See the "Sides" section.
- Returns the number representing the current input signal strength.

`setRedstoneOutput(side, value:number)` sets the emitted redstone signal for the specified side.
- `side` is a string representing the side to set the signal on. See the "Sides" section.
- `value` is a number representing the signal strength to set in the range of [0, 15].

`getRedstoneOutput(side):number` gets the emitted redstone signal for the specified side.
- `side` is a string representing the side to get the output on. See the "Sides" section.
- Returns the number representing the current output signal strength.
30 changes: 30 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/getting_started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 入门指南
本文描述了组装和运行 [电脑](block/computer.md) 所需的步骤,并举例说明如何使用它与设备交互。

## 组装
首先,您需要一台电脑,以及几个配件。 如果你还没有,得制作这些:
- 1x [电脑](block/computer.md)
- 1x **Linux** [硬盘](item/hard_drive.md) (用普通的8M [硬盘](item/hard_drive.md) 和 [螺丝刀扳手](item/wrench.md) 合成)
- 3x 8M [内存](item/memory.md)

![基本配件](../img/getting_started_basics.png)

搜集好配件后,放置 [电脑](block/computer.md), 对着使用 [螺丝刀扳手](item/wrench.md) 打开 [电脑](block/computer.md) 物品栏。 或者,打开终端,然后使用左侧的切换按钮切换到 [电脑](block/computer.md) 物品栏。 在这里,将制作好的 [硬盘](item/hard_drive.md) 和 [内存](item/memory.md) 放入 [电脑](block/computer.md)。

![电脑物品栏](../img/getting_started_inventory.png)

## 运行
要启动刚组装完的 [电脑](block/computer.md),得为其提供能源。 查看终端或 [电脑](block/computer.md) 物品栏左侧的能量条。 它会显示您当前存储在 [电脑](block/computer.md) 中的能量,以及每刻(tick)运行所需的能量。

![能量信息](../img/getting_started_energy_cn.png)

当有足够的能量运行时,切换到终端并点击左上角的电源按钮启动, 然后会出现登录提示。

![登录提示](../img/getting_started_login.png)

输入“root”作为登录用户名,然后按下回车。 这样你就有台可以使用的 [电脑](block/computer.md) 了!
现在也可以添加更多设备,具体取决于您要使用 [电脑](block/computer.md) 的目的。 有关如何控制设备的信息,请查看 [脚本](scripting.md) 手册条目。

但最重要的是:

玩得开心!
45 changes: 45 additions & 0 deletions src/main/resources/assets/oc2/doc/zh_cn/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
*Work In Progess!*

# 电脑专家手册

你好啊! 你看到了我,要么你是偶然发现的,要么你是对 [组装你的第一台电脑](getting_started.md) 感兴趣,要么你正在寻找有关特定 [方块](block/index.md) 或者 [物品](item/index.md) 的信息。

## 概述
[电脑](block/computer.md) 可以给你提供多种用途,从娱乐到生产线、高度可定制的机器人和设备的自动化。

操作系统 (OS)是每台 [电脑](block/computer.md) 的核心。 默认的操作系统是一个非常简陋的 Linux 发行版。 它只提供最基本的命令行工具,以及编写和运行 Lua 程序的方法。

Lua 在与高级 API 设备 (HLAPI) 交互时起到关键作用,例如 [红石接口](block/redstone_interface.md)。 默认的操作系统附带一些实用程序库来启用与此类设备的交互,特别是`devices`库。 要了解有关如何从 Lua 与 HLAPI 设备交互的更多信息,请参阅 [脚本](scripting.md) 手册条目。

除了HLAPI 设备还有本地设备,例如 [硬盘](item/hard_drive.md) 和 [网卡](item/network_interface_card.md)。 这些设备都由本地 Linux 驱动程序控制,并且在添加或删除时还需要重新启动系统。 不过,平常使用的设备几乎都是 HLAPI 设备。

## 快速入门
如果你只想马上使用 [电脑](block/computer.md) ,请阅读 [入门指南](getting_started.md)。 它讲了如何组装你的第一台 [电脑](block/computer.md) 和如何使用 [电脑](block/computer.md) 说明。

## 参考
本手册包含与 [电脑](block/computer.md) 等相关的块和项目的参考信息。

如果您正在寻找有关特定的方块或物品的信息,请查看相应的查询表:
- [方块列表](block/index.md)
- [物品列表](item/index.md)

如果您对某个特定主题感兴趣,有一些更常见的概述条目:
- [基本](basics.md)
- [脚本](scripting.md)
- [机器人技术](robotics.md)
- [构建互联网](networking.md)

## 译者
翻译作者:[ChenZR233](https://center.mcmod.cn/258731/) 、 Kalthy_B(E-mail:[email protected])

版权属于:[ChenZR233](https://center.mcmod.cn/258731/) 所有

更多翻译:[ChenZRの网盘](https://chenzr.xn--0tr.top/go/MCHanHua)

翻译类型:机翻润色

译者提示:右键可以回到上一页!

注意:本翻译为半成品未完全汉化!

感谢您使用本翻译!
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 方块操作模块
![破坏它,然后迅速重新放置](item:oc2:block_operations_module)

The block operations module provides to [robots](robot.md) the ability to break and place blocks in the world.

## API
Device name: `block_operations`

This is a high level API device. It can be controlled using Lua in the default Linux distribution. For example:
`local d = require("devices")`
`local m = d:find("block_operations")`
`m:excavate("front")`

### Sides
The side parameter in the following methods represents a direction from the perspective of the robot. Valid values are: `front`, `up` and `down`.

### Methods
`excavate([side]):boolean` tries to break a block in the specified direction. Collected blocks will be inserted starting at the currently selected inventory slot. If the selected slot is full, the next slot will be used, and so on. If the inventory has no space for the dropped block, it will drop into the world.
- `side` is the relative direction in to break a block in. Optional, defaults to `front`. See the "Sides" section.
- Returns whether the operation was successful.

`place([side]):boolean` tries to place a block in the specified direction. Blocks will be placed from the currently selected inventory slot. If the slot is empty, no block will be placed.
- `side` is the relative direction to place the block in. Optional, defaults to `front`. See the "Sides" section.
- Returns whether the operation was successful.

`durability():number` returns the remaining durability of the module's excavation tool. Once the durability has reached zero, no further excavation operations can be performed until it is repaired.
- Returns the remaining durability of the module's excavation tool

`repair():boolean` attempts to repair the module's excavation tool using materials in the currently selected inventory slot. This method will consume one item at a time. Any regular tool may act as the source for repair materials, such as pickaxes and shovels. The quality of the tool directly effects the amount of durability restored.
- Returns whether some material could be used to repair the module's excavation tool.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 文件导入/导出卡
![在墙上哭泣!](item:oc2:file_import_export_card)

文件导入/导出卡允许电脑打破第四面墙. 它允许:
- 从实体机上传文件到虚拟[电脑](../block/computer.md).
- 从虚拟电脑下载文件到实体机.

为了方便性, 标准的发行版提供两个脚本来进行该操作, `import.lua` 和 `export.lua`.

`import.lua` 将会做以下事:当运行时, prompt for a file to upload to the virtual computer. The file will be stored in the current working directory. If a file with the name of the imported file already exists, the option to provide an alternative name will be offered.

`export.lua` takes as its parameter the path to a file in a virtual computer. It then downloads this file to your real computer and offers a save dialog, offering the choice of where to save the downloaded file, or to cancel the operation.

Both scripts will prompt all users currently interacting with the computer's terminal. For upload operations (`import.lua`), the first uploaded file will be used. The prompts on other clients will be canceled. For download operations all clients will be offered to save the exported file.
Loading