Skip to content

Commit d6efb9a

Browse files
authored
feat: update some zh_CN translations of nu book (#513)
1 parent 0e80a44 commit d6efb9a

File tree

10 files changed

+60
-42
lines changed

10 files changed

+60
-42
lines changed

book/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ If Nushell is used as a login shell, you can use a specific configuration file w
100100

101101
The file `login.nu` is sourced after `env.nu` and `config.nu`, so that you can overwrite those configurations if you need.
102102

103-
There is an enviroment variable `$nu.loginshell-path` containing the path to this file.
103+
There is an environment variable `$nu.loginshell-path` containing the path to this file.
104104

105105
### macOS: Keeping `/usr/bin/open` as `open`
106106

book/environment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ See [Defining environment from custom commands](environment.md#defining-environm
6565

6666
See [Modules](modules.md) for details.
6767

68-
## Reading environment varibles
68+
## Reading environment variables
6969

7070
Individual environment variables are fields of a record that is stored in the `$env` variable and can be read with `$env.VARIABLE`:
7171

i18n-meta.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{
1313
"name": "README.md",
1414
"en": "Completed",
15-
"zh-CN": "b6c91cabfa@hustcer",
15+
"zh-CN": "fa90895307@hustcer",
1616
"de": "-",
1717
"tr": "-",
1818
"ja": "-",
@@ -62,7 +62,7 @@
6262
{
6363
"name": "configuration.md",
6464
"en": "Completed",
65-
"zh-CN": "008c89fc26@hustcer",
65+
"zh-CN": "fa90895307@hustcer",
6666
"de": "translated by @sebastian-xyz",
6767
"tr": "-",
6868
"ja": "-",
@@ -112,7 +112,7 @@
112112
{
113113
"name": "environment.md",
114114
"en": "Completed",
115-
"zh-CN": "008c89fc26@hustcer",
115+
"zh-CN": "fa90895307@hustcer",
116116
"de": "-",
117117
"tr": "-",
118118
"ja": "-",
@@ -142,7 +142,7 @@
142142
{
143143
"name": "installation.md",
144144
"en": "Completed",
145-
"zh-CN": "008c89fc26@hustcer",
145+
"zh-CN": "fa90895307@hustcer",
146146
"de": "translated by @sebastian-xyz",
147147
"tr": "-",
148148
"ja": "-",
@@ -162,7 +162,7 @@
162162
{
163163
"name": "loading_data.md",
164164
"en": "Completed",
165-
"zh-CN": "40925951fc@hustcer",
165+
"zh-CN": "fa90895307@hustcer",
166166
"de": "-",
167167
"tr": "-",
168168
"ja": "-",
@@ -192,7 +192,7 @@
192192
{
193193
"name": "moving_around.md",
194194
"en": "Completed",
195-
"zh-CN": "c13a71d11@hustcer",
195+
"zh-CN": "fa90895307@hustcer",
196196
"de": "-",
197197
"tr": "-",
198198
"ja": "-",
@@ -212,7 +212,7 @@
212212
{
213213
"name": "nushell_map_functional.md",
214214
"en": "Completed",
215-
"zh-CN": "ae23eeba3@hustcer",
215+
"zh-CN": "fa90895307@hustcer",
216216
"de": "-",
217217
"tr": "-",
218218
"ja": "-",
@@ -242,7 +242,7 @@
242242
{
243243
"name": "operators.md",
244244
"en": "Completed",
245-
"zh-CN": "0b0389f2c@hustcer",
245+
"zh-CN": "fa90895307@hustcer",
246246
"de": "-",
247247
"tr": "-",
248248
"ja": "-",
@@ -292,7 +292,7 @@
292292
{
293293
"name": "scripts.md",
294294
"en": "Completed",
295-
"zh-CN": "b6c91cabfa@hustcer",
295+
"zh-CN": "fa90895307@hustcer",
296296
"de": "-",
297297
"tr": "-",
298298
"ja": "-",
@@ -322,7 +322,7 @@
322322
{
323323
"name": "table_of_contents.md",
324324
"en": "Completed",
325-
"zh-CN": "c13a71d11@hustcer",
325+
"zh-CN": "fa90895307@hustcer",
326326
"de": "-",
327327
"tr": "-",
328328
"ja": "-",
@@ -332,7 +332,7 @@
332332
{
333333
"name": "thinking_in_nushell.md",
334334
"en": "Completed",
335-
"zh-CN": "12fbd8f31c@hustcer",
335+
"zh-CN": "fa90895307@hustcer",
336336
"de": "-",
337337
"tr": "-",
338338
"ja": "-",
@@ -362,7 +362,7 @@
362362
{
363363
"name": "working_with_lists.md",
364364
"en": "Completed",
365-
"zh-CN": "b6c91cabfa@hustcer",
365+
"zh-CN": "fa90895307@hustcer",
366366
"de": "-",
367367
"tr": "-",
368368
"ja": "-",

zh-CN/book/configuration.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ _(你可以把 Nushell 的配置加载顺序想象成在启动时执行两行 [R
1818
Nushell 的主要设置是以记录的形式保存在 `config` 环境变量中。这个记录可以用以下方式创建:
1919

2020
```bash
21-
let-env $config = {
21+
let-env config = {
2222
...
2323
}
2424
```
2525

2626
你也可以隐藏(shadow)`$env.config`并更新它:
2727

2828
```bash
29-
let-env $config = ($env.config | upsert <field name> <field value>)
29+
let-env config = ($env.config | upsert <field name> <field value>)
3030
```
3131

3232
按照约定,这个变量被定义在`config.nu`文件中。
@@ -51,9 +51,9 @@ _(尽管 `$env.config` 是一个环境变量,按照惯例它仍然在 `config.
5151
- `PROMPT_INDICATOR_VI_NORMAL = "〉 "`
5252
- `PROMPT_MULTILINE_INDICATOR = "::: "`
5353

54-
### 使用内置命令
54+
### 使用内置命令进行配置
5555

56-
从 Nushell 0.64 版本开始新增了 2 个内置命令(`config nu``config env`),凭借这两个命令,你可以使用自定义的编辑器或者 IDE 快速地更改 Nushell 配置信息
56+
从 Nushell 0.64 版本开始新增了两个内置命令(`config nu``config env`), 通过这两个命令,你可以使用自定义的编辑器或者 IDE 快速地更改 Nushell 配置信息
5757

5858
Nushell 遵循如下的规则来匹配编辑器:
5959

@@ -94,6 +94,14 @@ Nushell 遵循如下的规则来匹配编辑器:
9494
9595
这样你就可以使用`chsh`命令来将 Nu 设置为你的登录 Shell。在你注销后下次登录时,应该可以看到一个闪亮的 Nu 提示。
9696
97+
### 使用 `login.nu` 进行配置
98+
99+
如果 Nushell 被用作登录 Shell,你可以使用一个特定的配置文件,该文件只在该情况下才会被加载。因此,一个名为 `login.nu` 的文件必须在标准配置目录中。
100+
101+
文件 `login.nu` 的加载在 `env.nu``config.nu` 之后,所以你可以覆盖这些配置,如果你需要的话。
102+
103+
有一个环境变量 `$nu.loginshell-path` 包含该文件的路径。
104+
97105
### macOS: 保持 `open` 为 `/usr/bin/open`
98106
99107
一些工具(例如 Emacs)依靠`open`命令来打开 Mac 上的文件。

zh-CN/book/environment.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ let-env PATH = ($env.PATH | prepend '/path/you/want/to/add')
6565
6666
参见 [模块](modules.md#环境变量) 部分了解更多详情。
6767
68+
## 读取环境变量
69+
70+
单个环境变量是记录的一个字段,存储在 `$env` 变量中,可以用 `$env.VARIABLE` 读取:
71+
72+
```
73+
> $env.FOO
74+
BAR
75+
```
76+
6877
## 作用域
6978
7079
当你设置环境变量时,它将只在当前作用域内可用(变量所在的块和它里面的任何块)。

zh-CN/book/loading_data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Nu 目前支持直接从以下格式加载表数据:
6060
> open README.md
6161
```
6262

63-
我们会看到该文件的内容,如果文件太大则会得到一个方便的滚动视图来查看文件,然后再跳回终端。为了提高可读性,Nu 还将语法高亮显示常见的文件格式,如源码文件、Markdown 等等
63+
我们会看到该文件的内容。
6464

6565
本质上,这些文本文件对 Nu 来说就是一个大字符串。接下来,我们将讨论如何处理这些字符串,以便从中获得我们需要的数据。
6666

zh-CN/book/nushell_map_functional.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
| default | | | | |
2626
| drop | | | | |
2727
| du | | | | |
28-
| each | map, mapv, iterate | map, forEach | map | |
28+
| each | map, mapv, iterate | map, forEach | map, mapM | |
2929
| echo | println | | putStrLn, print | |
3030
| enter | | | | |
3131
| exit | System/exit | | | |

zh-CN/book/operators.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22

33
Nushell 支持以下常见的数学、逻辑和字符串操作的运算符:
44

5-
| 运算符 | 描述 |
6-
| -------- | --------------------------------- |
7-
| `+` ||
8-
| `-` ||
9-
| `*` ||
10-
| `/` ||
11-
| `**` | 指数 (幂) |
12-
| `mod` | 取模 |
13-
| `==` | 等于 |
14-
| `!=` | 不等于 |
15-
| `<` | 小于 |
16-
| `<=` | 小于等于 |
17-
| `>` | 大于 |
18-
| `>=` | 大于等于 |
19-
| `=~` | 正则匹配 / 字符串包含另一个字符串 |
20-
| `!~` | 正则不匹配 / 字符串**包含另一个 |
21-
| `in` | 列表包含值 |
22-
| `not-in` | 列表不包含值 |
23-
| `&&` | 两个布尔值与运算 |
24-
| `||` | 两个布尔值或运算 |
5+
| 运算符 | 描述 |
6+
| ---------- | --------------------------------- |
7+
| `+` ||
8+
| `-` ||
9+
| `*` ||
10+
| `/` ||
11+
| `**` | 指数 (幂) |
12+
| `mod` | 取模 |
13+
| `==` | 等于 |
14+
| `!=` | 不等于 |
15+
| `<` | 小于 |
16+
| `<=` | 小于等于 |
17+
| `>` | 大于 |
18+
| `>=` | 大于等于 |
19+
| `=~` | 正则匹配 / 字符串包含另一个字符串 |
20+
| `!~` | 正则不匹配 / 字符串**包含另一个 |
21+
| `in` | 列表包含值 |
22+
| `not-in` | 列表不包含值 |
23+
| `not` | 逻辑取反 |
24+
| `&&`, `and`| 两个布尔值与运算 |
25+
| `||`, `or` | 两个布尔值或运算 |
2526

2627
圆括号可用于分组以指定求值顺序,或用于调用命令并在表达式中使用结果。
2728

zh-CN/book/scripts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def main [x: int] {
7171
110
7272
```
7373

74-
## Shebangs (`!#`)
74+
## Shebangs (`#!`)
7575

7676
在 Linux 和 macOS 上,你可以选择使用 [Shebang](<https://en.wikipedia.org/wiki/Shebang_(Unix)>)来告诉操作系统一个文件应该被 `Nu` 解释。例如,在一个名为 `myscript` 的文件中包含以下内容:
7777

zh-CN/book/working_with_lists.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ echo "total =" ($scores | math sum) # easier approach, same result
7676

7777
echo "product =" ($scores | reduce --fold 1 { |it, acc| $acc * $it }) # 96
7878

79-
echo $scores | reduce -n { |it, acc| $acc + $it.index * $it.item } # 3 + 1*8 + 2*4 = 19
79+
echo $scores | reduce -n { |it, acc| $acc.item + $it.index * $it.item } # 3 + 1*8 + 2*4 = 19
8080
```
8181
8282
## 访问列表

0 commit comments

Comments
 (0)