docs(i18n): Update translations (#875)

This commit is contained in:
Matan Kushner
2020-02-04 12:11:36 -05:00
committed by GitHub
parent 860accac55
commit 8e9d9409cf
24 changed files with 998 additions and 834 deletions
+21 -23
View File
@@ -1,28 +1,26 @@
---
home: true
heroImage: /logo.svg
heroText: null
heroText:
tagline: The cross-shell prompt for astronauts
actionText: 入门 →
actionLink: ./guide/
features:
-
title: 兼容性优先
details: Starship 可以在各种常见的操作系统和常见的 shell 上运行。 尝试着在各种地方使用它吧!
-
title: 使用 Rust 编写
details: 具有 Rust 独树一帜的速度与安全性,使你的提示符尽可能的快速可靠。
-
title: 可自定义
details: 每个小细节都可以按您喜欢的自定义,不论是最小化以求速度,还是最大化以获得最完善的功能。
footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#Used for the description meta tag, for SEO
metaTitle: "Starship:可用于各种 Shell 的提示符"
description: Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the information you need, while staying sleek and minimal. Quick installation available for Bash, Fish, ZSH, Ion, and Powershell.
---
<div class="features">
<div class="feature">
<h2>注重兼容性</h2>
<p>能在各种常见的 Shell 上运行。 尝试着在各种地方使用它吧!</p>
</div>
<div class="feature">
<h2>Rust 制造</h2>
<p>具有 Rust 独树一帜的速度与安全性。</p>
</div>
<div class="feature">
<h2>可自定义</h2>
<p>每个小细节都可以按您喜欢的自定义,不论是最小化以求速度,还是最大化以获得最完善的功能。</p>
</div>
</div>
<div class="center">
<video class="demo-video" muted autoplay loop playsinline>
<source src="/demo.webm" type="video/webm">
@@ -35,24 +33,24 @@ footer: ISC Licensed | Copyright © 2019-present Starship Contributors
1. 安装 **starship** 二进制文件:
#### Install Latest Version
#### 安装最新版本
With Shell:
使用 Shell 命令:
```sh
curl -fsSL https://starship.rs/install.sh | bash
```
#### Install via Package Manager
#### 通过软件包管理器安装
With [Homebrew](https://brew.sh/):
使用 [Homebrew](https://brew.sh/)
```sh
brew install starship
```
With [Scoop](https://scoop.sh):
使用 [Scoop](https://scoop.sh)
```powershell
scoop install starship
@@ -96,7 +94,7 @@ footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#### Powershell
添加 `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` (或者`~/.config/powershell/Microsoft.PowerShell_profile.ps1` on -Nix)到
`~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` (对于 *nix 系统是`~/.config/powershell/Microsoft.PowerShell_profile.ps1`)的最后,添加以下内容
```sh
# ~\Documents\PowerShell\Profile.ps1
@@ -107,7 +105,7 @@ footer: ISC Licensed | Copyright © 2019-present Starship Contributors
#### Ion
Add the following to the end of `~/.config/ion/initrc`:
`~/.config/ion/initrc` 的最后,添加以下内容:
```sh
# ~/.config/ion/initrc
+20 -20
View File
@@ -1,6 +1,6 @@
# 高级配置
While Starship is a versatile shell, sometimes you need to do more than edit `starship.toml` to get it to do certain things. This page details some of the more advanced configuration techniques used in starship.
Starship 功能繁多,有时您必须在编辑 `starship.toml` 之外做更多工作才能实现某些效果。 此页面详细介绍了一些在 starship 中使用的高级配置技巧。
::: warning
@@ -8,11 +8,11 @@ While Starship is a versatile shell, sometimes you need to do more than edit `st
:::
## Custom pre-prompt and pre-execution Commands in Bash
## 在 Bash 中自定义预提示和预执行命令
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
Bash 没有像大多数其它 shell 一样的正式预执行/预命令框架。 因此,很难在 `bash` 中提供完全可自定义的 hook 机制。 然而,Starship 确实能使您有限地在提示符渲染过程中插入自己的函数执行:
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
- 若要在提示符显示之前运行自定义函数,需要定义此函数,然后将函数名赋值给 `starship_reserved_user_func`。 例如,要在提示符之前绘制一枚火箭,您应该写
```bash
function blastoff(){
@@ -21,21 +21,21 @@ function blastoff(){
starship_precmd_user_func="blastoff"
```
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal *before* initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
- 要在一个命令运行前运行自定义函数,您可以使用 [`DEBUG` trap 机制](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/)。 然而,您**必须**在捕捉 DEBUG 信号*之前*启动 Starship Starship 可以保留 DEBUG trap 的值,但如果该 trap 在 starship 启动后被覆盖,一些功能将会被破坏。
```bash
function blastoff(){
echo "🚀"
}
trap blastoff DEBUG # Trap DEBUG *before* running starship
trap blastoff DEBUG # 启动 starship *之前* 设置 DEBUG trap
eval $(starship init bash)
```
## 更改窗口标题
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash` or `zsh`.
一些 shell 提示符会自动更改您的窗口标题(比如改成您的工作目录)。 Fish 甚至默认会执行此功能。 Starship 没有实现此功能,但将这个功能添加到 `bash` `zsh` 是相当简单的。
First, define a window title change function (identical in bash and zsh):
首先,定义窗口标题更改函数(在 bash zsh 中相同):
```bash
function set_win_title(){
@@ -43,25 +43,25 @@ function set_win_title(){
}
```
You can use variables to customize this title (`$USER`, `$HOSTNAME`, and `$PWD` are popular choices).
您可以使用变量来定制标题(常用的有 `$USER``$HOSTNAME` `$PWD`)。
In `bash`, set this function to be the precmd starship function:
`bash` 中,设置此函数为 starship 预执行函数:
```bash
starship_precmd_user_func="set_win_title"
```
In `zsh`, add this to the `precmd_functions` array:
`zsh`中,将此函数添加到 `reservmd_functions` 列表:
```bash
precmd_functions+=(set_win_title)
```
If you like the result, add these lines to your shell configuration file (`~/.bashrc` or `~/.zsrhc`) to make it permanent.
如果您对产生的效果感到满意,请将以上代码添加到您的 shell 配置文件(`~/.bashrc` `~/zsrhc`)中以使其永久化。
## 样式设定
样式字符串是用空分隔的单词列表。 The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following:
样式字符串是用空分隔的单词列表。 其中单词不是大小写敏感的(例如 `bold` `BoLd` 被视为同一字符串)。 每个单词可以是以下之一:
- `bold`
- `underline`
@@ -71,14 +71,14 @@ If you like the result, add these lines to your shell configuration file (`~/.ba
- `<color>`
- `none`
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing , though this may change in the future. The order of words in the string does not matter.
`<color>` 是颜色说明符(下面解释)。 `fg:<color>` `<color>` 当前产生一样的效果,尽管未来可能会改变。 字符串中的单词顺序不影响显示结果。
The `none` token overrides all other tokens in a string, so that e.g. `fg:red none fg:blue` will still create a string with no styling. It may become an error to use `none` in conjunction with other tokens in the future.
`none` 标识符会覆盖字符串中所有其他标识符,比如 `fg:red none fg:blue` 将创建一个没有样式设置的字符串。 未来可能会将 `none` 与其它标识符一起使用视为一种错误。
颜色指定器可以是以下内容之一:
颜色说明符可以是以下内容之一:
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
- 标准终端颜色之一:`black``red``green``blue``yellow``purple``cyan``white`。 您可以使用可选前缀 `bright-` 来获取明亮版本的颜色(例如,`bright-white`)。
- 一个 `#` 后跟一个六位十六进制数。 这将指定一个 [十六进制 RGB 颜色代码](https://www.w3schools.com/colors/colors_hexadecimal.asp)
- 0-255 之间的数字。 这将指定一个 [8 位 ANSI 颜色码](https://i.stack.imgur.com/KTSQa.png)
If multiple colors are specified for foreground/background, the last one in the string will take priority.
如果为文本/背景指定了多个颜色,字符串中最后指定的颜色将具有最高优先级。
File diff suppressed because it is too large Load Diff
+19 -19
View File
@@ -1,27 +1,27 @@
# FAQ
# 常见问题
## What is the configuration used in the demo GIF?
## 主页 GIF 示例中的效果用的是什么配置?
- **Terminal Emulator**: [iTerm2](https://iterm2.com/)
- **Theme**: Minimal
- **Color Scheme**: [Snazzy](https://github.com/sindresorhus/iterm2-snazzy)
- **Font**: [Fira Code](https://github.com/tonsky/FiraCode)
- **Shell**: [Fish Shell](https://fishshell.com/)
- **Configuration**: [matchai's Dotfiles](https://github.com/matchai/dotfiles/blob/master/.config/fish/config.fish)
- **Prompt**: [Starship](https://starship.rs/)
- **终端模拟器**[iTerm2](https://iterm2.com/)
- **主题**Minimal
- **颜色方案**[Snazzy](https://github.com/sindresorhus/iterm2-snazzy)
- **字体**[Fira Code](https://github.com/tonsky/FiraCode)
- **Shell**[Fish Shell](https://fishshell.com/)
- **fish 配置**[matchai's Dotfiles](https://github.com/matchai/dotfiles/blob/master/.config/fish/config.fish)
- **提示符工具**[Starship](https://starship.rs/)
## Do `prompt_order` and `<module>.disabled` do the same thing?
## `prompt_order` `<module>.disabled` 的效果是一样的吗?
Yes, they can both be used to disable modules in the prompt. If all you plan to do is disable modules, `<module>.disabled` is the preferred way to do so for these reasons:
是的,他们都可以用来禁用提示符中的组件。 如果你只是想禁用组件,推荐使用 `<module>.disabled`,原因如下:
- Disabling modules is more explicit than omitting them from the prompt_order
- Newly created modules will be added to the prompt as Starship is updated
- “禁用组件”比在 prompt_order 中忽略某个组件更为清晰明确
- 当 Starship 升级后,新组件将能够自动被加入提示符中
## The docs say Starship is cross-shell, but it doesn't support X shell. Why?
## 你们的文档说“Starship 是跨 shell 的”,但它不支持 X shell。 为什么?
The way Starship is built, it should be possible to add support for virtually any shell. The starship binary is stateless and shell agnostic, so as long as your shell supports prompt customization and shell expansion, Starship can be used.
Starship 的构建方式决定了它应当能够增加对几乎所有 shell 的支持。 Starship 的二进制文件是无状态、不知道当前 shell 的,所以只要你的 shell 支持自定义提示符和 shell 扩展,就能使用 Starship。
Here's a small example getting Starship working with bash:
这是一个在 bash 上使用 Starship 的简单例子:
```sh
# Get the status code from the last command executed
@@ -34,12 +34,12 @@ NUM_JOBS=$(jobs -p | wc -l)
PS1="$(starship prompt --status=$STATUS --jobs=NUM_JOBS)"
```
The [Bash implementation](https://github.com/starship/starship/blob/master/src/init/starship.bash) built into Starship is slightly more complex to allow for advanced features like the [Command Duration module](https://starship.rs/config/#Command-Duration) and to ensure that Starship is compatible with pre-installed Bash configurations.
内置于 Starship 的 [Bash 适配](https://github.com/starship/starship/blob/master/src/init/starship.bash) 稍微复杂一些,实现了像 [命令用时统计组件](https://starship.rs/config/#Command-Duration) 这样的功能,还确保 Starship 能与之前设置的 Bash 配置相兼容。
For a list of all flags accepted by `starship prompt`, use the following command:
使用以下命令了解 `starship prompt` 所能接受的所有参数:
```sh
starship prompt --help
```
The prompt will use as much context as is provided, but no flags are "required".
Starship 会处理所提供的全部上下文参数并在提示符中显示,但没有参数是“必需”的。
+51 -49
View File
@@ -21,7 +21,7 @@
src="https://img.shields.io/discord/567163873606500352?logo=discord"
alt="加入 Discord" /></a>
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<a href="#contributors"><img src="https://img.shields.io/badge/all%20contributors-68-orange" alt="所有贡献者"></a>
<a href="#contributors"><img src="https://img.shields.io/badge/all%20contributors-69-orange" alt="所有贡献者"></a>
<!-- ALL-CONTRIBUTORS-BADGE:END -->
</p>
@@ -61,7 +61,7 @@
<h1></h1>
<p align="center"> Starship 是轻量的,快速的,可以快速定制的,适用于任何 shell 的提示符!<br /> 它可以在不影响流畅性=的情况下,在你工作时展示你所需要的信息。 <p>
<p align="center"> Starship 可以适配于任何 shell,是一种轻量,快速,高度可定制化的提示符工具<br /> 它可以你工作时展示你所需要的信息,兼备的流畅的使用体验。 <p>
<p align="center">
<br>
@@ -73,85 +73,86 @@
## 🍬 特性
- 当上一个命令以非 0 状态退出时,提示字符会变为红色
- 当前 Go 版本 (`🐹`)
- Current Java version (``)
- Current Node.js version (``)
- Current PHP version (`🐘`)
- 当前 Python 版本 (`🐍`)
- 当前 Ruby 版本 (`💎`)
- 当前 Rust 版本 (`🦀`)
- Current .NET version (`•NET`)
- 当前目录下现在的包版本 (`📦`)
- 显示当前 Go 版本`🐹`
- 显示当前 Haskell 版本(`λ`
- 显示当前 Java 版本(``
- 显示当前 Node.js 版本(``
- 显示当前 PHP 版本`🐘`
- 显示当前 Python 版本`🐍`
- 显示当前 Ruby 版本`💎`
- 显示当前 Rust 版本(`🦀`
- 显示当前 .NET 版本(`•NET`
- 显示当前目录中项目的版本(`📦`
- npm (Node.js)
- cargo (Rust)
- poetry (Python)
- composer (PHP)
- 当前 Git 分支与一应俱全的仓库状态
- `=` conflicting changes
- `⇡` ahead of remote branch
- `⇣` behind of remote branch
- `⇕` diverged changes
- `?` untracked changes
- `$` — stashed changes
- `!` modified files
- `+` added files
- `»` renamed files
- `✘` deleted files
- Current Mercurial branch
- 当前电剩余容量与状态
- `⇡` charging
- `⇣` discharging
- `•` fully charged
- 后台运行进程数的指示器 (`✦`)
- 当前 Kubernetes Cluster 与 Namespace (`☸`)
- Current Amazon Web Services (AWS) profile (`☁️`)
- Execution time of the last command
- Custom environment variable value
- composerPHP
- 显示当前 Git 分支与各种仓库状态
- `=`— 修改冲突
- `⇡`— 领先于远程分支
- `⇣`— 落后于远程分支
- `⇕`— 与远程分支存在分歧
- `?`— 存在未记录的文件
- `$`— 存在 stash 快照
- `!`— 存在被修改的文件
- `+`— 暂存区中存在内容
- `»`— 文件重命名
- `✘`— 文件被删除
- 显示当前的 Mercurial 分支
- 显示当前电剩余与电源状态
- `⇡` —— 电池充电中
- `⇣` —— 电池耗电中
- `•` —— 电池已充满
- 显示后台运行进程数`✦`
- 显示当前 Kubernetes 集群与命名空间(`☸`
- 显示当前 AWS 配置(`☁️`
- 显示上一条命令的执行用时
- 自定义环境变量值
- Nix-shell 环境检测
- 非当前登录用户的用户名
- Optional current time in 12/24hr format
- Current Terraform Workspace and version (`💠`)
- Current Conda environment (`C`)
- 如果当前用户与不是登录用户,显示当前用户名
- 12/24 小时格式的时间显示(可选)
- 显示 Terraform 工作区和当前版本(`💠`
- 显示当前 Conda 环境(`C`
## 🚀 安装
### 基础要求
### 前置要求
- 安装有一个 [Powerline 字体](https://github.com/powerline/fonts) (如 [Fira Code](https://github.com/tonsky/FiraCode)) 并在您的终端启用 。
- 安装一种 [Powerline 字体](https://github.com/powerline/fonts)如 [Fira Code](https://github.com/tonsky/FiraCode)并在您的终端启用 。
### 入门
### 开始安装
1. 安装 **starship** 二进制文件:
#### Install Latest Version
#### 安装最新版本
##### From prebuilt binary, with Shell:
##### 下载预构建的二进制文件,使用 Shell 命令:
```sh
curl -fsSL https://starship.rs/install.sh | bash
```
##### From source on [crates.io](https://crates.io/):
##### 直接从 [crates.io](https://crates.io/) 获取源代码编译:
```sh
cargo install starship
```
#### Install via Package Manager
#### 通过软件包管理器安装
##### With [Homebrew](https://brew.sh/):
##### 使用 [Homebrew](https://brew.sh/)
```sh
brew install starship
```
##### With [Scoop](https://scoop.sh):
##### 使用 [Scoop](https://scoop.sh)
```powershell
scoop install starship
@@ -195,7 +196,7 @@
#### PowerShell
添加 `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` (或`~/.config/powershell/Microsoft.PowerShell_profile.ps1` on -Nix)到
将以下内容添加`~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1` (或`~/.config/powershell/Microsoft.PowerShell_profile.ps1`,对于 *nix 系统)
```sh
# ~\Documents\PowerShell\Profile.ps1
@@ -206,7 +207,7 @@
#### Ion
Add the following to the end of `~/.config/ion/initrc`:
`~/.config/ion/initrc` 的最后,添加以下内容:
```sh
# ~/.config/ion/initrc
@@ -220,7 +221,7 @@
## 🤝 贡献
我们一直在寻找贡献者!你都可以参与贡献 ** 不论的技能如何 **。 如果您希望快速为项目作出贡献,请尝试解决 [good first issue](https://github.com/starship/starship/labels/🌱%20good%20first%20issue)。
我们一直在寻求各种形式的贡献!**不论的技能水平如何**,您都可以为项目做出贡献。 如果您希望快速为项目作出贡献,请尝试解决 [good first issue](https://github.com/starship/starship/labels/🌱%20good%20first%20issue)。
### 急需
@@ -328,6 +329,7 @@
<td align="center"><a href="https://blog.brightone.space"><img src="https://avatars1.githubusercontent.com/u/12615679?v=4" width="100px;" alt="" /><br /><sub><b>Oleksii Filonenko</b></sub></a><br /><a href="#translation-filalex77" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/ivanovart"><img src="https://avatars2.githubusercontent.com/u/5867379?v=4" width="100px;" alt="" /><br /><sub><b>Artem Ivanov</b></sub></a><br /><a href="#translation-ivanovart" title="Translation">🌍</a></td>
<td align="center"><a href="http://www.drivendata.org"><img src="https://avatars3.githubusercontent.com/u/1799186?v=4" width="100px;" alt="" /><br /><sub><b>Peter Bull</b></sub></a><br /><a href="https://github.com/starship/starship/commits?author=pjbull" title="Code">💻</a> <a href="https://github.com/starship/starship/commits?author=pjbull" title="Tests">⚠️</a></td>
<td align="center"><a href="https://andrewpro.me"><img src="https://avatars1.githubusercontent.com/u/8220926?v=4" width="100px;" alt="" /><br /><sub><b>Andrew Prokhorenkov</b></sub></a><br /><a href="https://github.com/starship/starship/commits?author=m0nhawk" title="Code">💻</a> <a href="https://github.com/starship/starship/commits?author=m0nhawk" title="Documentation">📖</a> <a href="https://github.com/starship/starship/commits?author=m0nhawk" title="Tests">⚠️</a> <a href="#projectManagement-m0nhawk" title="Project Management">📆</a></td>
</tr>
</table>
+4 -4
View File
@@ -1,16 +1,16 @@
# Presets
# 社区配置分享
Here is a collection of community-submitted configuration presets for Starship. If you have a preset to share, please [submit a PR](https://github.com/starship/starship/edit/master/docs/presets/README.md) updating this file! 😊
这里有一系列社区提供的 Starship 预设配置。 如果您想分享一套配置,请 [提交 PR](https://github.com/starship/starship/edit/master/docs/presets/README.md) 来更新此文件! 😊
## Nerd Font Symbols
This preset doesn't change anything except for the symbols used for each module. If emojis aren't your thing, this might catch your eye!
除了每个组件使用的符号外,这套配置不会改变任何内容。 如果你不喜欢 emoji,这可能会吸引你的眼球!
![Screenshot of Nerd Font Symbols preset](/presets/nerd-font-symbols.png)
### 基础要求
- A [Nerd Font](https://www.nerdfonts.com/) installed and enabled in your terminal (the example uses Fira Code Nerd Font)
- 安装一种 [Nerd 字体](https://www.nerdfonts.com/) 并在您的终端启用(示例使用的是 Fira Code 字体)。
### 配置