New translations readme.md (Chinese Simplified)

This commit is contained in:
Matan Kushner 2023-11-02 18:24:24 +09:00
parent 49b30f51bc
commit 860fd4fa68
1 changed files with 60 additions and 53 deletions

View File

@ -206,6 +206,13 @@ detect_extensions = ['ts', '!video.ts', '!audio.ts']
| `add_newline` | `true` | 在 shell 提示符之间插入空行。 |
| `palette` | `''` | Sets which color palette from `palettes` to use. |
| `palettes` | `{}` | Collection of color palettes that assign [colors](/advanced-config/#style-strings) to user-defined names. Note that color palettes cannot reference their own color definitions. |
| `follow_symlinks` | `true` | Follows symlinks to check if they're directories; used in modules such as git. |
::: tip
If you have symlinks to networked filesystems, consider setting `follow_symlinks` to `false`.
:::
### 示例
@ -237,7 +244,7 @@ mustard = '#af8700'
### 默认提示符格式
如果没有提供`format`字段或者它的值是空的,将会使用默认的`format`配置来指定提示符的格式。 默认配置如下:
The default `format` is used to define the format of the prompt, if empty or no `format` is provided. The default is as shown:
```toml
format = '$all'
@ -331,7 +338,7 @@ $shell\
$character"""
```
如果你只是想扩展默认的格式,你可以使用 `$all`; 你另外添加到格式中的modules不会重复出现。 例如:
If you just want to extend the default format, you can use `$all`; modules you explicitly add to the format will not be duplicated. Eg.
```toml
# Move the directory to the second line
@ -473,7 +480,7 @@ very-long-subscription-name = 'vlsn'
## Battery
`battery` 组件显示电池充电情况和当前充电状态。 这个组件只会在当前电量低于 10% 时显示。
The `battery` module shows how charged the device's battery is and its current charging status. The module is only visible when the device's battery is below 10%.
### 配置项
@ -501,7 +508,7 @@ discharging_symbol = '💀 '
### Battery 组件的显示
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). 如果 `display` 没有设置, 默认配置如下:
The `display` configuration option is used to define when the battery indicator should be shown (threshold), which symbol would be used (symbol), and what it would like (style). If no `display` is provided. The default is as shown:
```toml
[[battery.display]]
@ -513,7 +520,7 @@ The default value for the `charging_symbol` and `discharging_symbol` option is r
#### 配置项
`display` 字段的子字段如下:
The `display` option is an array of the following table.
| 选项 | 默认值 | 描述 |
| -------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
@ -663,9 +670,9 @@ format = 'via [$name $version]($style)'
## Character
`character` 组件用于在您输入终端的文本旁显示一个字符(通常是一个箭头)。
The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal.
这个字符可以告诉您最后一个命令是否执行成功。 It can do this in two ways:
The character will tell you whether the last command was successful or not. It can do this in two ways:
- changing color (`red`/`green`)
- changing shape (``/`✖`)
@ -790,15 +797,15 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
## Command Duration
`cmd_duration` 组件显示上一个命令执行的时间。 此组件只在命令执行时间长于两秒时显示,或者当其 `min_time` 字段被设置时,按此值为执行时间的显示下限。
The `cmd_duration` module shows how long the last command took to execute. The module will be shown only if the command took longer than two seconds, or the `min_time` config value, if it exists.
::: warning 不要在 Bash 里捕获 DEBUG 信号
::: warning Do not hook the DEBUG trap in Bash
如果您正在 `bash` 上使用 Starship在运行 `eval $(starship)` 后,不要捕获 `DEBUG` 信号,否则此组件**将会**坏掉。
If you are running Starship in `bash`, do not hook the `DEBUG` trap after running `eval $(starship init $0)`, or this module **will** break.
:::
需要在自动每一条命令前执行某些操作的 Bash 用户可以使用 [rcaloras 的 bash_preexec 框架](https://github.com/rcaloras/bash-preexec)。 只需要在执行 `eval $(starship init $0)` 前简单地定义 `preexec_functions``precmd_functions` 两个列表,就可以照常运行了。
Bash users who need preexec-like functionality can use [rcaloras's bash_preexec framework](https://github.com/rcaloras/bash-preexec). Simply define the arrays `preexec_functions` and `precmd_functions` before running `eval $(starship init $0)`, and then proceed as normal.
### 配置项
@ -838,7 +845,7 @@ The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) e
::: tip
此组件没有禁用 conda 自带的提示符修改,您可能需要执行 `conda config --set changeps1 False`
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
:::
@ -1059,11 +1066,11 @@ format = 'via [🦕 $version](green bold) '
## Directory
`directory` 组件显示当前目录的路径,显示的路径会截断到三个父目录以内。 如果您处于一个 git 仓库中,显示的路径则最多会截断到该仓库的根目录。
The `directory` module shows the path to your current directory, truncated to three parent folders. Your directory will also be truncated to the root of the git repo that you're currently in.
When using the `fish_style_pwd_dir_length` option, instead of hiding the path that is truncated, you will see a shortened name of each directory based on the number you enable for the option.
例如,对于 `~/Dev/Nix/nixpkgs/pkgs`,其中 `nixpkgs` 是 git 仓库根目录fish 风格相关选项设置为 `1`。 您将会看到 `~/D/N/nixpkgs/pkgs`,而在设置 fish 风格之前,当前路径将显示成 `nixpkgs/pkgs`
For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, and the option set to `1`. You will now see `~/D/N/nixpkgs/pkgs`, whereas before it would have been `nixpkgs/pkgs`.
### 配置项
@ -1084,7 +1091,7 @@ When using the `fish_style_pwd_dir_length` option, instead of hiding the path th
| `use_os_path_sep` | `true` | Use the OS specific path separator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>此组件有几个高级配置选项来控制当前目录路径的显示方式。</summary>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
| Advanced Option | 默认值 | 描述 |
| --------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@ -1176,7 +1183,7 @@ format = 'via [🐋 $context](blue bold)'
## Dotnet
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) for the current directory. 如果当前目录已被绑定了一个版本的 SDK则显示被帮定的版本。 否则此组件将显示最新安装的 SDK 版本。
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) for the current directory. If the SDK has been pinned in the current directory, the pinned version is shown. Otherwise the module shows the latest installed version of the SDK.
By default this module will only be shown in your prompt when one or more of the following files are present in the current directory:
@ -1191,7 +1198,7 @@ By default this module will only be shown in your prompt when one or more of the
You'll also need the .NET Core SDK installed in order to use it correctly.
在内部,此组件使用自己的版本检测机制。 一般来说此组件是直接执行 `dotnet --version` 的两倍快,但当你的 .NET 项目使用了不常见的目录布局时此组件可能显示一个错误的版本。 如果相比于速度您更需要正确的版本号,您可以在组件设置中设置 `heuristic = false` 来禁用该机制。
Internally, this module uses its own mechanism for version detection. Typically it is twice as fast as running `dotnet --version`, but it may show an incorrect version if your .NET project has an unusual directory layout. If accuracy is more important than speed, you can disable the mechanism by setting `heuristic = false` in the module options.
The module will also show the Target Framework Moniker (<https://docs.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-frameworks>) when there is a `.csproj` file in the current directory.
@ -1314,7 +1321,7 @@ format = 'via [ $version](cyan bold) '
## Environment Variable
The `env_var` module displays the current value of a selected environment variables. 此组件只有满足以下条件之一时才会被显示:
The `env_var` module displays the current value of a selected environment variables. The module will be shown only if any of the following conditions are met:
- 设置的 `variable` 是一个已存在的环境变量
- 未定义 `variable`,但定义了 `default`
@ -1638,7 +1645,7 @@ very-long-project-name = 'vlpn'
## Git Branch
`git_branch` 组件显示当前目录的 git 仓库的活动分支。
The `git_branch` module shows the active branch of the repo in your current directory.
### 配置项
@ -1717,7 +1724,7 @@ tag_symbol = '🔖 '
## Git State
`git_state` 组件会显示当前目录在哪个 git 仓库中以及正在进行的操作例如_REBASING__BISECTING_ 等。 进度信息(例如 REBASING 3/10如果存在则也会被显示。
The `git_state` module will show in directories which are part of a git repository, and where there is an operation in progress, such as: _REBASING_, _BISECTING_, etc. If there is progress information (e.g., REBASING 3/10), that information will be shown too.
### 配置项
@ -1761,7 +1768,7 @@ The `git_metrics` module will show the number of added and deleted lines in the
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -1799,7 +1806,7 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
## Git Status
`git_status`组件通过相应的符号显示您当前目录中 git 仓库的状态。
The `git_status` module shows symbols representing the state of the repo in your current directory.
::: tip
@ -2139,7 +2146,7 @@ format = 'via [⎈ $version](bold white) '
## Hostname
`hostname` 组件显示系统主机名。
The `hostname` module shows the system hostname.
### 配置项
@ -2229,7 +2236,7 @@ symbol = '🌟 '
## Jobs
`jobs` 组件显示当前正在运行的任务数量。 仅当有后台任务运行时,此组件才会显示。 The module will show the number of jobs running if there are at least 2 jobs, or more than the `number_threshold` config value, if it exists. The module will show a symbol if there is at least 1 job, or more than the `symbol_threshold` config value, if it exists. You can set both values to 0 in order to _always_ show the symbol and number of jobs, even if there are 0 jobs running.
The `jobs` module shows the current number of jobs running. The module will be shown only if there are background jobs running. The module will show the number of jobs running if there are at least 2 jobs, or more than the `number_threshold` config value, if it exists. The module will show a symbol if there is at least 1 job, or more than the `symbol_threshold` config value, if it exists. You can set both values to 0 in order to _always_ show the symbol and number of jobs, even if there are 0 jobs running.
The default functionality is:
@ -2377,7 +2384,7 @@ Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/co
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
When the module is enabled it will always be active, unless any of `detect_extensions`, `detect_files` or `detect_folders` have been set in which case the module will only be active in directories that match those conditions.
@ -2489,7 +2496,7 @@ context_alias = "gke-$cluster"
## Line Break
`line_break` 组件将提示分隔为两行。
The `line_break` module separates the prompt into two lines.
### 配置项
@ -2582,13 +2589,13 @@ format = 'via [🌕 $version](bold blue) '
## Memory Usage
`memory_usage` 组件显示当前系统内存和交换区使用情况。
The `memory_usage` module shows current system memory and swap usage.
默认情况下,如果系统交换区使用不为 0则会显示交换区使用情况。
By default the swap usage is displayed if the total system swap is non-zero.
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -2747,7 +2754,7 @@ symbol = '🎣 '
## Nix-shell
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. 当处于一个 nix-shell 环境中时,此组件会被显示。
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. The module will be shown when inside a nix-shell environment.
### 配置项
@ -2961,7 +2968,7 @@ The [os_info](https://lib.rs/crates/os_info) crate used by this module is known
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3053,7 +3060,7 @@ Arch = "Arch is the best! "
## Package Version
当前目录是软件包的代码仓库时,将显示 `package` 组件,并显示软件包当前版本。 The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `python`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards`, `daml` and `dart` packages.
The `package` module is shown when the current directory is the repository for a package, and shows its current version. The module currently supports `npm`, `nimble`, `cargo`, `poetry`, `python`, `composer`, `gradle`, `julia`, `mix`, `helm`, `shards`, `daml` and `dart` packages.
- [**npm**](https://docs.npmjs.com/cli/commands/npm) The `npm` package version is extracted from the `package.json` present in the current directory
- [**Cargo**](https://doc.rust-lang.org/cargo/) The `cargo` package version is extracted from the `Cargo.toml` present in the current directory
@ -3301,7 +3308,7 @@ format = 'via [$symbol$version](bold white)'
The `python` module shows the currently installed version of [Python](https://www.python.org/) and the current [Python virtual environment](https://docs.python.org/tutorial/venv.html) if one is activated.
如果`pyenv_version_name`被设置为`true`, 本组件将会展示pyenv版本名。 否则则显示通过`python --version`获得的版本号
If `pyenv_version_name` is set to `true`, it will display the pyenv version name. Otherwise, it will display the version number from `python --version`.
By default the module will be shown if any of the following conditions are met:
@ -3468,7 +3475,7 @@ format = 'via [🦪 $version]($style) '
## Red
By default the `red` module shows the currently installed version of [Red](https://www.red-lang.org/). 此组件将在符合以下任意条件时显示:
By default the `red` module shows the currently installed version of [Red](https://www.red-lang.org/). The module will be shown if any of the following conditions are met:
- The current directory contains a file with `.red` or `.reds` extension
@ -3506,7 +3513,7 @@ symbol = '🔴 '
## Ruby
By default the `ruby` module shows the currently installed version of [Ruby](https://www.ruby-lang.org/). 此组件将在符合以下任意条件时显示:
By default the `ruby` module shows the currently installed version of [Ruby](https://www.ruby-lang.org/). The module will be shown if any of the following conditions are met:
- 当前目录包含 `Gemfile` 文件
- The current directory contains a `.ruby-version` file
@ -3550,7 +3557,7 @@ symbol = '🔺 '
## Rust
By default the `rust` module shows the currently installed version of [Rust](https://www.rust-lang.org/). 此组件将在符合以下任意条件时显示:
By default the `rust` module shows the currently installed version of [Rust](https://www.rust-lang.org/). The module will be shown if any of the following conditions are met:
- 当前目录包含 `Cargo.toml` 文件
- 当前目录包含一个使用 `.rs` 扩展名的文件
@ -3635,7 +3642,7 @@ The `shell` module shows an indicator for currently used shell.
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3840,7 +3847,7 @@ The `status` module displays the exit code of the previous command. If $success_
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3901,7 +3908,7 @@ The `sudo` module displays if sudo credentials are currently cached. The module
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -3946,7 +3953,7 @@ disabled = false
## Swift
By default the `swift` module shows the currently installed version of [Swift](https://swift.org/). 此组件将在符合以下任意条件时显示:
By default the `swift` module shows the currently installed version of [Swift](https://swift.org/). The module will be shown if any of the following conditions are met:
- The current directory contains a `Package.swift` file
- The current directory contains a file with the `.swift` extension
@ -4044,11 +4051,11 @@ format = '[🏎💨 $workspace]($style) '
## Time
`time` 组件显示当前的 **本地** 时间。 `format` 字段值会提供给 [`chrono`](https://crates.io/crates/chrono) crate 用来控制时间显示方式。 请参阅 [chrono strftime 文档](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) 以了解可用格式选项。
The `time` module shows the current **local** time. The `format` configuration value is used by the [`chrono`](https://crates.io/crates/chrono) crate to control how the time is displayed. Take a look [at the chrono strftime docs](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) to see what options are available.
::: tip
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
:::
@ -4090,7 +4097,7 @@ time_range = '10:00:00-14:00:00'
## Username
`username` 组件显示当前活跃的用户名。 此组件将在符合以下任意条件时显示:
The `username` module shows active user's username. The module will be shown if any of the following conditions are met:
- The current user is root/admin
- 当前用户与登录用户不相同
@ -4241,7 +4248,7 @@ format = '[🆅 $repo](bold blue) '
## Zig
By default the `zig` module shows the currently installed version of [Zig](https://ziglang.org/). 此组件将在符合以下任意条件时显示:
By default the `zig` module shows the currently installed version of [Zig](https://ziglang.org/). The module will be shown if any of the following conditions are met:
- The current directory contains a `.zig` file
@ -4347,30 +4354,30 @@ Format strings can also contain shell specific prompt sequences, e.g. [Bash](htt
#### 自定义命令 shell
`shell` 接受一个非空字符串列表:
`shell` accepts a non-empty list of strings, where:
- 第一个字符串是用于执行命令的 shell 路径。
- 剩下的将作为参数传递给 shell。
如果未设置,它将回退到 STARSHIP_SHELL然后回退到 Linux 上的 "sh" 命令,在 Windows 上则是 "cmd /C"。
If unset, it will fallback to STARSHIP_SHELL and then to 'sh' on Linux, and 'cmd /C' on Windows.
`command` 将会被传递给标准输入。
The `command` will be passed in on stdin.
如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 PowerShell则会自动添加 `-NoProfile -Command -` 参数。 如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 Cmd则会自动添加 `/C` 参数,并且将 `stdin` 设置为 `false`。 如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 Cmd则会自动添加 `-C` 参数,并且将 `stdin` 设置为 `false`。 可以通过将参数显式传递给 shell 来避免这种行为,例如:
If `shell` is not given or only contains one element and Starship detects PowerShell will be used, the following arguments will automatically be added: `-NoProfile -Command -`. If `shell` is not given or only contains one element and Starship detects Cmd will be used, the following argument will automatically be added: `/C` and `stdin` will be set to `false`. If `shell` is not given or only contains one element and Starship detects Nushell will be used, the following arguments will automatically be added: `-c` and `stdin` will be set to `false`. This behavior can be avoided by explicitly passing arguments to the shell, e.g.
```toml
shell = ['pwsh', '-Command', '-']
```
::: warning 请确保您的自定义 shell 配置正常退出
::: warning Make sure your custom shell configuration exits gracefully
如果您设置了一个自定义命令, 请确保 starship 使用的默认 shell (在 `shell` 选项设置) 执行命令后会正常退出。
If you set a custom command, make sure that the default Shell used by starship will properly execute the command with a graceful exit (via the `shell` option).
例如PowerShell 需要 `-Command` 参数来执行单行命令。 忽略此参数可能导致 starship 无尽递归shell 可能会尝试加载带有 starship 的完整配置并重新执行自定义命令,导致无尽循环。
For example, PowerShell requires the `-Command` parameter to execute a one liner. Omitting this parameter might throw starship into a recursive loop where the shell might try to load a full profile environment with starship itself again and hence re-execute the custom command, getting into a never ending loop.
建议使用类似于 PowerShell 中 `-NoProfile` 的启动参数,这样还能避免额外的配置加载时间。
Parameters similar to `-NoProfile` in PowerShell are recommended for other shells as well to avoid extra loading time of a custom profile on every starship invocation.
自动检测 shell 和添加适当的参数的功能已被实现,但包含的 shell 支持可能有缺漏。 遇到这种情况,请[提交一个带有 shell 信息和 starship 配置的 issue](https://github.com/starship/starship/issues/new/choose)。
Automatic detection of shells and proper parameters addition are currently implemented, but it's possible that not all shells are covered. [Please open an issue](https://github.com/starship/starship/issues/new/choose) with shell details and starship configuration if you hit such scenario.
:::