Skip to content

Update zh_CN translation for nu books #514

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

Merged
merged 2 commits into from
Jun 19, 2022
Merged
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
20 changes: 15 additions & 5 deletions i18n-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{
"name": "coming_from_bash.md",
"en": "Completed",
"zh-CN": "b6c91cabfa@hustcer",
"zh-CN": "d6efb9a35a@hustcer",
"de": "translated by @sebastian-xyz",
"tr": "-",
"ja": "-",
Expand All @@ -62,7 +62,7 @@
{
"name": "configuration.md",
"en": "Completed",
"zh-CN": "fa90895307@hustcer",
"zh-CN": "d6efb9a35a@hustcer",
"de": "translated by @sebastian-xyz",
"tr": "-",
"ja": "-",
Expand All @@ -82,7 +82,7 @@
{
"name": "custom_commands.md",
"en": "Completed",
"zh-CN": "008c89fc26@hustcer",
"zh-CN": "d6efb9a35a@hustcer",
"de": "translated by @sebastian-xyz",
"tr": "-",
"ja": "-",
Expand Down Expand Up @@ -112,7 +112,7 @@
{
"name": "environment.md",
"en": "Completed",
"zh-CN": "fa90895307@hustcer",
"zh-CN": "d6efb9a35a@hustcer",
"de": "-",
"tr": "-",
"ja": "-",
Expand Down Expand Up @@ -249,6 +249,16 @@
"es": "-",
"pt-BR": "-"
},
{
"name": "overlays.md",
"en": "In progress",
"zh-CN": "-",
"de": "-",
"tr": "-",
"ja": "-",
"es": "-",
"pt-BR": "-"
},
{
"name": "parallelism.md",
"en": "Completed",
Expand Down Expand Up @@ -342,7 +352,7 @@
{
"name": "types_of_data.md",
"en": "Completed",
"zh-CN": "40925951fc@hustcer",
"zh-CN": "d6efb9a35a@hustcer",
"de": "-",
"tr": "-",
"ja": "-",
Expand Down
2 changes: 1 addition & 1 deletion i18n.nu
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get-cell [
let commit = ($val | split row '@')
let id = ($commit | get 0)
if ($commit | length) > 1 && (has-ref $id) {
$'Translate to ($id) by @($commit | get 1)'
$'($id)@($commit | get 1)'
} else {
$val
}
Expand Down
8 changes: 4 additions & 4 deletions zh-CN/book/coming_from_bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let-env Path = ($env.Path | prepend 'C:\Program Files\Git\usr\bin')
```

注意:本表针对 Nu 0.14.1 或更高版本。
注意:本表针对 Nu 0.60.0 或更高版本。

| Bash | Nu | Task |
| ------------------------------------ | ------------------------------------------------ | ------------------------------------------ |
Expand All @@ -34,9 +34,8 @@ let-env Path = ($env.Path | prepend 'C:\Program Files\Git\usr\bin')
| `rm <path>` | `rm <path>` | 删除给定的文件 |
| | `rm -t <path>` | 将给定的文件移到系统垃圾箱 |
| `rm -rf <path>` | `rm -r <path>` | 递归地删除给定的路径 |
| `chmod` | `<not yet possible>` | 改变文件属性 |
| `date -d <date>` | `"<date>" \| into datetime -f <format>` | 解析日期 ([日期格式文档](https://docs.rs/chrono/0.4.15/chrono/format/strftime/index.html)) |
| `sed` | `str find-replace` | 查找和替换一个字符串中的模式 |
| `sed` | `str replace` | 查找和替换一个字符串中的模式 |
| `grep <pattern>` | `where $it =~ <substring>` or `find <substring>` | 过滤包含特定字符串的字符串 |
| `man <command>` | `help <command>` | 获得特定命令的帮助信息 |
| | `help commands` | 列出所有可用的命令 |
Expand All @@ -57,4 +56,5 @@ let-env Path = ($env.Path | prepend 'C:\Program Files\Git\usr\bin')
| `<update ~/.bashrc>` | `vim $nu.config-path` | 永久添加和编辑别名(新开Shell会话生效) |
| `bash -c <commands>` | `nu -c <commands>` | 运行一组命令(需要0.9.1或更高版本) |
| `bash <script file>` | `nu <script file>` | 运行一个脚本文件(需要0.9.1或更高版本) |
| `\` | `(` followed by `)` | 目前还不支持换行延续性 |
| `\` | `( <command> )` | 当命令被 `(` 和 `)` 包裹的时候可以跨多行 |
| `pwd` | `$env.PWD` | 显示当前目录 |
28 changes: 28 additions & 0 deletions zh-CN/book/custom_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,34 @@ _注意:_ 标志是以其全称命名的,所以上面的例子的命令体
> greet -a 10 hello
```

标志也可以作为基本开关使用,这意味着它们的存在或不存在被当作定义的参数。延伸前面的例子:

```shell
def greet [
name: string
--age (-a): int
--twice
] {
if $twice {
echo $name $name $age $age
} else {
echo $name $age
}
}
```

而这个定义可以通过如下方式调用:

```
> greet -a 10 --twice hello
```

或者只是没有开关标志:

```
> greet -a 10 hello
```

## 剩余参数

在某些情况下, 你可能想定义一个需要任意数量的位置参数的命令。我们可以用一个剩余参数(Rest Parameter)来实现这一点,通过下面的`...`语法:
Expand Down
29 changes: 21 additions & 8 deletions zh-CN/book/types_of_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,20 @@ Nu 在其命令中采用了这种方法,并将其扩展到包括其他类型
## 整数

整数(或整形)数字:例子包括 1、5 和 100。
你可以用 `into int` 命令将一个字符串转换成一个整数:

```shell
> "1" | into int
```

## 小数

小数是指带有一些小数成分的数字,例如,1.5,2.0,和 15.333。
你可以用 `into decimal` 命令将一个字符串转换成一个小数:

```shell
> "1.2" | into decimal
```

## 字符串

Expand Down Expand Up @@ -68,6 +78,13 @@ Nushell 的一个独特特征是,你也可以创建一个没有任何引号的
> echo "hello"
```

通过 `into <type>` 命令将一个字符串转换为另一种类型:

```shell
> "1" | into int
> "1.2" | into decimal
```

另见 [字符串的使用](loading_data.html#处理字符串)。

## 文本行
Expand Down Expand Up @@ -146,10 +163,6 @@ Eg) `1wk`是一个星期的时间间隔。

你也可以使区间的开始部分开放。在这种情况下,Nushell 将从`0`开始向上计数。区间`..2`包含数字 0、1 和 2。

## 文件路径

文件路径(File Paths)是在给定的操作系统中代表文件路径的一种与平台无关的方式。比如`/usr/bin`和`C:\Users\file.txt`。

## 文件大小

文件大小(File Sizes)保存在一种特殊的称为字节的整数类型中。例如包括 `100b`, `15kb`, 和 `100mb`。
Expand All @@ -172,12 +185,12 @@ Eg) `1wk`是一个星期的时间间隔。

二进制数据,像图像文件的数据一样,是一组原始字节。

你可以使用 `0x[...]` `0b[...]` 或 `0o[...]` 形式将二进制写成一个字面值
你可以使用 `0x[...]` `0b[...]` 或 `0o[...]` 的形式将二进制写成一个字面值

```
> 0x[1F FF]
> 0b[1 1010]
> 0o[777]
> 0x[1F FF] # 十六进制
> 0b[1 1010] # 二进制
> 0o[777] # 八进制
```

不完整的字节将用零来填充。
Expand Down