1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-11-16 01:57:07 +00:00

New translations readme.md (Chinese Simplified)

This commit is contained in:
Matan Kushner 2023-11-03 09:27:52 +09:00
parent 05f146577c
commit 8d46d7c4e6

View File

@ -244,7 +244,7 @@ mustard = '#af8700'
### 默认提示符格式
The default `format` is used to define the format of the prompt, if empty or no `format` is provided. The default is as shown:
如果没有提供`format`字段或者它的值是空的,将会使用默认的`format`配置来指定提示符的格式。 默认配置如下:
```toml
format = '$all'
@ -338,7 +338,7 @@ $shell\
$character"""
```
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.
如果你只是想扩展默认的格式,你可以使用 `$all`; 你另外添加到格式中的modules不会重复出现。 例如:
```toml
# Move the directory to the second line
@ -480,7 +480,7 @@ very-long-subscription-name = 'vlsn'
## Battery
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%.
`battery` 组件显示电池充电情况和当前充电状态。 这个组件只会在当前电量低于 10% 时显示。
### 配置项
@ -508,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). If no `display` is provided. The default is as shown:
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` 没有设置, 默认配置如下:
```toml
[[battery.display]]
@ -520,7 +520,7 @@ The default value for the `charging_symbol` and `discharging_symbol` option is r
#### 配置项
The `display` option is an array of the following table.
`display` 字段的子字段如下:
| 选项 | 默认值 | 描述 |
| -------------------- | ------------ | --------------------------------------------------------------------------------------------------------- |
@ -670,9 +670,9 @@ format = 'via [$name $version]($style)'
## Character
The `character` module shows a character (usually an arrow) beside where the text is entered in your terminal.
`character` 组件用于在您输入终端的文本旁显示一个字符(通常是一个箭头)。
The character will tell you whether the last command was successful or not. It can do this in two ways:
这个字符可以告诉您最后一个命令是否执行成功。 It can do this in two ways:
- changing color (`red`/`green`)
- changing shape (``/`✖`)
@ -797,15 +797,15 @@ The `cobol` module shows the currently installed version of COBOL. By default, t
## Command Duration
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.
`cmd_duration` 组件显示上一个命令执行的时间。 此组件只在命令执行时间长于两秒时显示,或者当其 `min_time` 字段被设置时,按此值为执行时间的显示下限。
::: warning Do not hook the DEBUG trap in Bash
::: warning 不要在 Bash 里捕获 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` 上使用 Starship在运行 `eval $(starship)` 后,不要捕获 `DEBUG` 信号,否则此组件**将会**坏掉。
:::
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.
需要在自动每一条命令前执行某些操作的 Bash 用户可以使用 [rcaloras 的 bash_preexec 框架](https://github.com/rcaloras/bash-preexec)。 只需要在执行 `eval $(starship init $0)` 前简单地定义 `preexec_functions``precmd_functions` 两个列表,就可以照常运行了。
### 配置项
@ -845,7 +845,7 @@ The `conda` module shows the current [Conda](https://docs.conda.io/en/latest/) e
::: tip
This does not suppress conda's own prompt modifier, you may want to run `conda config --set changeps1 False`.
此组件没有禁用 conda 自带的提示符修改,您可能需要执行 `conda config --set changeps1 False`
:::
@ -1066,11 +1066,11 @@ format = 'via [🦕 $version](green bold) '
## Directory
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.
`directory` 组件显示当前目录的路径,显示的路径会截断到三个父目录以内。 如果您处于一个 git 仓库中,显示的路径则最多会截断到该仓库的根目录。
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.
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`.
例如,对于 `~/Dev/Nix/nixpkgs/pkgs`,其中 `nixpkgs` 是 git 仓库根目录fish 风格相关选项设置为 `1`。 您将会看到 `~/D/N/nixpkgs/pkgs`,而在设置 fish 风格之前,当前路径将显示成 `nixpkgs/pkgs`
### 配置项
@ -1091,7 +1091,7 @@ For example, given `~/Dev/Nix/nixpkgs/pkgs` where `nixpkgs` is the repo root, an
| `use_os_path_sep` | `true` | Use the OS specific path separator instead of always using `/` (e.g. `\` on Windows) |
<details>
<summary>This module has a few advanced configuration options that control how the directory is displayed.</summary>
<summary>此组件有几个高级配置选项来控制当前目录路径的显示方式。</summary>
| Advanced Option | 默认值 | 描述 |
| --------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@ -1183,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. 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.
The `dotnet` module shows the relevant version of the [.NET Core SDK](https://dotnet.microsoft.com/) for the current directory. 如果当前目录已被绑定了一个版本的 SDK则显示被帮定的版本。 否则此组件将显示最新安装的 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:
@ -1198,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.
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.
在内部,此组件使用自己的版本检测机制。 一般来说此组件是直接执行 `dotnet --version` 的两倍快,但当你的 .NET 项目使用了不常见的目录布局时此组件可能显示一个错误的版本。 如果相比于速度您更需要正确的版本号,您可以在组件设置中设置 `heuristic = false` 来禁用该机制。
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.
@ -1321,7 +1321,7 @@ format = 'via [ $version](cyan bold) '
## Environment Variable
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:
The `env_var` module displays the current value of a selected environment variables. 此组件只有满足以下条件之一时才会被显示:
- 设置的 `variable` 是一个已存在的环境变量
- 未定义 `variable`,但定义了 `default`
@ -1645,7 +1645,7 @@ very-long-project-name = 'vlpn'
## Git Branch
The `git_branch` module shows the active branch of the repo in your current directory.
`git_branch` 组件显示当前目录的 git 仓库的活动分支。
### 配置项
@ -1724,7 +1724,7 @@ tag_symbol = '🔖 '
## Git State
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.
`git_state` 组件会显示当前目录在哪个 git 仓库中以及正在进行的操作例如_REBASING__BISECTING_ 等。 进度信息(例如 REBASING 3/10如果存在则也会被显示。
### 配置项
@ -1768,7 +1768,7 @@ The `git_metrics` module will show the number of added and deleted lines in the
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -1806,7 +1806,7 @@ format = '[+$added]($added_style)/[-$deleted]($deleted_style) '
## Git Status
The `git_status` module shows symbols representing the state of the repo in your current directory.
`git_status`组件通过相应的符号显示您当前目录中 git 仓库的状态。
::: tip
@ -2146,7 +2146,7 @@ format = 'via [⎈ $version](bold white) '
## Hostname
The `hostname` module shows the system hostname.
`hostname` 组件显示系统主机名。
### 配置项
@ -2236,7 +2236,7 @@ symbol = '🌟 '
## Jobs
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.
`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 default functionality is:
@ -2384,7 +2384,7 @@ Displays the current [Kubernetes context](https://kubernetes.io/docs/concepts/co
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
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.
@ -2496,7 +2496,7 @@ context_alias = "gke-$cluster"
## Line Break
The `line_break` module separates the prompt into two lines.
`line_break` 组件将提示分隔为两行。
### 配置项
@ -2589,13 +2589,13 @@ format = 'via [🌕 $version](bold blue) '
## Memory Usage
The `memory_usage` module shows current system memory and swap usage.
`memory_usage` 组件显示当前系统内存和交换区使用情况。
By default the swap usage is displayed if the total system swap is non-zero.
默认情况下,如果系统交换区使用不为 0则会显示交换区使用情况。
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -2754,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. The module will be shown when inside a nix-shell environment.
The `nix_shell` module shows the [nix-shell](https://nixos.org/guides/nix-pills/developing-with-nix-shell.html) environment. 当处于一个 nix-shell 环境中时,此组件会被显示。
### 配置项
@ -2968,7 +2968,7 @@ The [os_info](https://lib.rs/crates/os_info) crate used by this module is known
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3060,7 +3060,7 @@ Arch = "Arch is the best! "
## Package Version
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.
当前目录是软件包的代码仓库时,将显示 `package` 组件,并显示软件包当前版本。 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
@ -3308,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.
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`.
如果`pyenv_version_name`被设置为`true`, 本组件将会展示pyenv版本名。 否则则显示通过`python --version`获得的版本号
By default the module will be shown if any of the following conditions are met:
@ -3475,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/). The module will be shown if any of the following conditions are met:
By default the `red` module shows the currently installed version of [Red](https://www.red-lang.org/). 此组件将在符合以下任意条件时显示:
- The current directory contains a file with `.red` or `.reds` extension
@ -3513,7 +3513,7 @@ symbol = '🔴 '
## Ruby
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:
By default the `ruby` module shows the currently installed version of [Ruby](https://www.ruby-lang.org/). 此组件将在符合以下任意条件时显示:
- 当前目录包含 `Gemfile` 文件
- The current directory contains a `.ruby-version` file
@ -3557,7 +3557,7 @@ symbol = '🔺 '
## Rust
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:
By default the `rust` module shows the currently installed version of [Rust](https://www.rust-lang.org/). 此组件将在符合以下任意条件时显示:
- 当前目录包含 `Cargo.toml` 文件
- 当前目录包含一个使用 `.rs` 扩展名的文件
@ -3642,7 +3642,7 @@ The `shell` module shows an indicator for currently used shell.
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3847,7 +3847,7 @@ The `status` module displays the exit code of the previous command. If $success_
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3908,7 +3908,7 @@ The `sudo` module displays if sudo credentials are currently cached. The module
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -3953,7 +3953,7 @@ disabled = false
## Swift
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:
By default the `swift` module shows the currently installed version of [Swift](https://swift.org/). 此组件将在符合以下任意条件时显示:
- The current directory contains a `Package.swift` file
- The current directory contains a file with the `.swift` extension
@ -4051,11 +4051,11 @@ format = '[🏎💨 $workspace]($style) '
## Time
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.
`time` 组件显示当前的 **本地** 时间。 `format` 字段值会提供给 [`chrono`](https://crates.io/crates/chrono) crate 用来控制时间显示方式。 请参阅 [chrono strftime 文档](https://docs.rs/chrono/0.4.7/chrono/format/strftime/index.html) 以了解可用格式选项。
::: tip
This module is disabled by default. To enable it, set `disabled` to `false` in your configuration file.
此组件默认被禁用。 若要启用此组件,请在配置文件中设置 `disable` 字段为 `false`
:::
@ -4097,7 +4097,7 @@ time_range = '10:00:00-14:00:00'
## Username
The `username` module shows active user's username. The module will be shown if any of the following conditions are met:
`username` 组件显示当前活跃的用户名。 此组件将在符合以下任意条件时显示:
- The current user is root/admin
- 当前用户与登录用户不相同
@ -4248,7 +4248,7 @@ format = '[🆅 $repo](bold blue) '
## Zig
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:
By default the `zig` module shows the currently installed version of [Zig](https://ziglang.org/). 此组件将在符合以下任意条件时显示:
- The current directory contains a `.zig` file
@ -4354,30 +4354,30 @@ Format strings can also contain shell specific prompt sequences, e.g. [Bash](htt
#### 自定义命令 shell
`shell` accepts a non-empty list of strings, where:
`shell` 接受一个非空字符串列表:
- 第一个字符串是用于执行命令的 shell 路径。
- 剩下的将作为参数传递给 shell。
If unset, it will fallback to STARSHIP_SHELL and then to 'sh' on Linux, and 'cmd /C' on Windows.
如果未设置,它将回退到 STARSHIP_SHELL然后回退到 Linux 上的 "sh" 命令,在 Windows 上则是 "cmd /C"。
The `command` will be passed in on stdin.
`command` 将会被传递给标准输入。
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.
如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 PowerShell则会自动添加 `-NoProfile -Command -` 参数。 如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 Cmd则会自动添加 `/C` 参数,并且将 `stdin` 设置为 `false`。 如果 `shell` 未设置或仅包含一个元素,并且 Starship 检测到正在使用 Cmd则会自动添加 `-C` 参数,并且将 `stdin` 设置为 `false`。 可以通过将参数显式传递给 shell 来避免这种行为,例如:
```toml
shell = ['pwsh', '-Command', '-']
```
::: warning Make sure your custom shell configuration exits gracefully
::: warning 请确保您的自定义 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).
如果您设置了一个自定义命令, 请确保 starship 使用的默认 shell (在 `shell` 选项设置) 执行命令后会正常退出。
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 需要 `-Command` 参数来执行单行命令。 忽略此参数可能导致 starship 无尽递归shell 可能会尝试加载带有 starship 的完整配置并重新执行自定义命令,导致无尽循环。
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.
建议使用类似于 PowerShell 中 `-NoProfile` 的启动参数,这样还能避免额外的配置加载时间。
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.
自动检测 shell 和添加适当的参数的功能已被实现,但包含的 shell 支持可能有缺漏。 遇到这种情况,请[提交一个带有 shell 信息和 starship 配置的 issue](https://github.com/starship/starship/issues/new/choose)。
:::