From e525da6d3704c62e1d8c17a8e7afb94a2aa29504 Mon Sep 17 00:00:00 2001 From: Matan Kushner Date: Fri, 12 Jun 2026 13:47:59 -0400 Subject: [PATCH] New translations readme.md (Chinese Traditional) [ci skip] --- docs/zh-TW/advanced-config/README.md | 149 ++++++++++++++++----------- 1 file changed, 88 insertions(+), 61 deletions(-) diff --git a/docs/zh-TW/advanced-config/README.md b/docs/zh-TW/advanced-config/README.md index bde791d2d..f60e53927 100644 --- a/docs/zh-TW/advanced-config/README.md +++ b/docs/zh-TW/advanced-config/README.md @@ -1,12 +1,12 @@ # 進階設定 -正因為 Starship 是一個多才多藝的 shell,有時候你必須要做比修改 `starship.toml` 更多事情來讓它完成特定工作。 這個頁面說明了一些用於 Starship 的進階設定技巧。 +正因為 Starship 是一個多才多藝的 shell,有時候你必須要做比修改 `starship.toml` 更多事情來讓它完成特定工作。 這個頁面說明了一些用於 Starship 的進階設定技巧。 這個頁面說明了一些用於 Starship 的進階設定技巧。 > [!WARNING] 本章節中的設定檔在未來的 Starship 版本發行時可能會有所變動。 ## TransientPrompt in PowerShell -It is possible to replace the previous-printed prompt with a custom string. 這在並非所有提示訊息都需要的情況下會很有用。 To enable this, run `Enable-TransientPrompt` in the shell session. To make it permanent, put this statement in your `$PROFILE`. Transience can be disabled on-the-fly with `Disable-TransientPrompt`. +It is possible to replace the previous-printed prompt with a custom string. 這在並非所有提示訊息都需要的情況下會很有用。 這在並非所有提示訊息都需要的情況下會很有用。 To enable this, run `Enable-TransientPrompt` in the shell session. To make it permanent, put this statement in your `$PROFILE`. Transience can be disabled on-the-fly with `Disable-TransientPrompt`. By default, the left side of input gets replaced with `>`. To customize this, define a new function called `Invoke-Starship-TransientFunction`. For example, to display Starship's `character` module here, you would do @@ -22,7 +22,8 @@ Enable-TransientPrompt ## TransientPrompt and TransientRightPrompt in Cmd -Clink allows you to replace the previous-printed prompt with custom strings. 這在並非所有提示訊息都需要的情況下會很有用。 To enable this, run `clink set prompt.transient ` where \ can be one of: +The [Ble.sh](https://github.com/akinomyoga/ble.sh) framework at v0.4 or higher allows you to replace the previous-printed prompt with custom strings. This is useful in cases where all the prompt information is not always needed. To enable +this, run `clink set prompt.transient ` where \ can be one of: - `always`: always replace the previous prompt - `same_dir`: replace the previous prompt only if the working directory is same @@ -52,7 +53,10 @@ load(io.popen('starship init cmd'):read("*a"))() ## TransientPrompt and TransientRightPrompt in Fish -It is possible to replace the previous-printed prompt with a custom string. 這在並非所有提示訊息都需要的情況下會很有用。 如果要啟用這項功能,請在 Shell 工作階段中執行 `enable_transience` 指令。 若要使其永久啟用 ,請將上述指令加入到 `~/.config/fish/config.fish` 中。 你也可以隨時用 `disable_transience` 來臨時關閉這個功能。 +It is possible to replace the previous-printed prompt with a custom string. 這在並非所有提示訊息都需要的情況下會很有用。 To enable +this, run `enable_transience` in the shell session. To make it permanent, put +this statement in your `~/.config/fish/config.fish`. Transience can be disabled on-the-fly with +`disable_transience`. Note that in case of Fish, the transient prompt is only printed if the commandline is non-empty, and syntactically correct. @@ -78,9 +82,14 @@ enable_transience ## TransientPrompt and TransientRightPrompt in Bash -The [Ble.sh](https://github.com/akinomyoga/ble.sh) framework at v0.4 or higher allows you to replace the previous-printed prompt with custom strings. This is useful in cases where all the prompt information is not always needed. To enable this, put this in `~/.bashrc` `bleopt prompt_ps1_transient=`: +The [Ble.sh](https://github.com/akinomyoga/ble.sh) framework at v0.4 or higher allows you to replace +the previous-printed prompt with custom strings. This is useful in cases where all +the prompt information is not always needed. To enable this, put this in `~/.bashrc` +`bleopt prompt_ps1_transient=`: -The \ here is a colon-separated list of `always`, `same-dir` and `trim`. When `prompt_ps1_final` is empty and the option `prompt_ps1_transient` has a non-empty \, the prompt specified by `PS1` is erased on leaving the current command line. If \ contains a field `trim`, only the last line of multiline `PS1` is preserved and the other lines are erased. Otherwise, the command line will be redrawn as if `PS1=` is specified. When a field `same-dir` is contained in \ and the current working directory is different from the final directory of the previous command line, this option `prompt_ps1_transient` is ignored. +The \ here is a colon-separated list of `always`, `same-dir` and `trim`. +When `prompt_ps1_final` is empty and the option `prompt_ps1_transient` has a non-empty \, the prompt specified by `PS1` is erased on leaving the current command line. +If \ contains a field `trim`, only the last line of multiline `PS1` is preserved and the other lines are erased. Otherwise, the command line will be redrawn as if `PS1=` is specified. When a field `same-dir` is contained in \ and the current working directory is different from the final directory of the previous command line, this option `prompt_ps1_transient` is ignored. Make the following changes to your `~/.blerc` (or in `~/.config/blesh/init.sh`) to customize what gets displayed on the left and on the right: @@ -122,9 +131,13 @@ load(io.popen('starship init cmd'):read("*a"))() ## Bash 中的自定義預提示 (pre-prompt) 與預執行 (pre-execution) 指令 -Bash 不像其他大多的 shell 具有正式的預執行/預指令框架。 因為這個原因,很難在 `bash` 中提供能完全自定義的 hook。 然而,Starship 有提供給你有限的能力來插入你自己的函式到渲染提示字元的程序中: +PowerShell does not have a formal preexec/precmd framework like most other shells. +Because of this, it is difficult to provide fully customizable hooks in `powershell`. +然而,Starship 有提供給你有限的能力來插入你自己的函式到渲染提示字元的程序中: -- 為了在畫出提示字元之前執行一個自定義的函式,請定義一個函式,並將它的名稱放入 `starship_precmd_user_func` 之中。 例如,為了要在提示字元前畫出一個火箭,你就要 +- 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 ```bash function blastoff(){ @@ -133,7 +146,10 @@ 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/). 然而,你**必須**在初始化 Starship _之前_ 對 DEBUG 訊號設下trap! Starship 可以保留 DEBUG trap 的數值,但是如果該 trap 在 starship 啟動後被被覆寫,某些功能會損壞。 +- 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/). + 然而,你**必須**在初始化 Starship _之前_ 對 DEBUG 訊號設下trap! Starship 可以保留 DEBUG trap 的數值,但是如果該 trap 在 starship 啟動後被被覆寫,某些功能會損壞。 + Starship can preserve the value of the DEBUG trap, but if the trap is overwritten + after starship starts up, some functionality will break. ```bash function blastoff(){ @@ -147,7 +163,9 @@ set +o functrace ## Custom pre-prompt and pre-execution Commands in PowerShell -PowerShell does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `powershell`. 然而,Starship 有提供給你有限的能力來插入你自己的函式到渲染提示字元的程序中: +PowerShell does not have a formal preexec/precmd framework like most other shells. +Because of this, it is difficult to provide fully customizable hooks in `powershell`. +然而,Starship 有提供給你有限的能力來插入你自己的函式到渲染提示字元的程序中: Create a function named `Invoke-Starship-PreCommand` @@ -159,7 +177,8 @@ function Invoke-Starship-PreCommand { ## 改變視窗標題 -Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish 甚至預設就會這樣做。 Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`. +Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish 甚至預設就會這樣做。 +Fish 甚至預設就會這樣做。 Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`. 首先,定義一個改變視窗標題的函式(在 bash 與 zsh 之中都一樣): @@ -243,6 +262,12 @@ Produces a prompt like the following: ▶ starship on  rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s ``` +When using `zsh` (v5.0.5+), the shell adds a default trailing space to the right prompt. This can cause alignment issues specifically when using the Starship `$fill` module. To remove this gap, add the following to your `.zshrc`: + +```zsh +ZLE_RPROMPT_INDENT=0 +``` + ## Continuation Prompt Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote). @@ -338,22 +363,22 @@ The `claude_model` module displays the current Claude model being used in the se #### 選項 -| 選項 | 預設 | 說明 | -| --------------- | ---------------------------- | ----------------------------------------------------------------------------------------- | -| `format` | `'[$symbol$model]($style) '` | 此模組的格式。 | -| `symbol` | `'🤖 '` | The symbol shown before the model name. | -| `style` | `'bold blue'` | 這個模組的風格。 | +| 選項 | 預設 | 說明 | +| --------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `format` | `'[$symbol$model]($style) '` | 此模組的格式。 | +| `symbol` | `'🤖 '` | The symbol shown before the model name. | +| `style` | `'bold blue'` | 這個模組的風格。 | | `model_aliases` | `{}` | Map of model IDs or display names to shorter aliases. Checks ID first, then display name. | -| `disabled` | `false` | Disables the `claude_model` module. | +| `disabled` | `false` | Disables the `claude_model` module. | #### 變數 -| 變數 | 範例 | 說明 | -| --------- | ------------------- | ------------------------------------- | -| model | `Claude 3.5 Sonnet` | The display name of the current model | -| model_id | `claude-3-5-sonnet` | The model ID | -| symbol | | 對應 `symbol` 選項的設定值 | -| style\* | | 對應 `style` 選項的設定值 | +| 變數 | 範例 | 說明 | +| ----------------------------- | ------------------- | ------------------------------------- | +| model | `Claude 3.5 Sonnet` | The display name of the current model | +| model_id | `claude-3-5-sonnet` | The model ID | +| symbol | | 對應 `symbol` 選項的設定值 | +| style\* | | 對應 `style` 選項的設定值 | \*: 此變數僅能用於 style 字串的一部分 @@ -383,9 +408,9 @@ The `claude_context` module displays context window usage as a percentage and vi #### 選項 -| 選項 | 預設 | 說明 | -| ---------------------- | --------------------------------- | -------------------------------------------------- | -| `format` | `'[$gauge $percentage]($style) '` | 此模組的格式。 | +| 選項 | 預設 | 說明 | +| ---------------------- | --------------------------------- | ------------------------------------------------------------------ | +| `format` | `'[$gauge $percentage]($style) '` | 此模組的格式。 | | `symbol` | `''` | The symbol shown before the gauge. | | `gauge_width` | `5` | The width of the gauge in characters. | | `gauge_full_symbol` | `'█'` | The symbol used for filled segments of the gauge. | @@ -402,7 +427,7 @@ The `display` option is an array of objects that define thresholds and styles fo | ----------- | ------------ | ------------------------------------------------------------------------ | | `threshold` | `0.0` | The minimum context windows usage percentage to match this configuration | | `style` | `bold green` | The value of `style` if this display configuration is matched | -| `hidden` | `false` | Hide this module if this the configuration is matched. | +| `hidden` | `false` | Hide this module if this the configuration is matched. | ```toml [[claude_context.display]] @@ -424,19 +449,19 @@ style = "bold red" #### 變數 -| 變數 | 範例 | 說明 | -| ---------------------------- | ------- | ----------------------------------------------------- | -| gauge | `██▒░░` | Visual representation of context usage | -| percentage | `65%` | Context usage as a percentage | -| input_tokens | `45.2k` | Total input tokens in conversation | -| output_tokens | `12.3k` | Total output tokens in conversation | -| curr_input_tokens | `5.1k` | Input tokens from most recent API call | -| curr_output_tokens | `1.2k` | Output tokens from most recent API call | +| 變數 | 範例 | 說明 | +| ----------------------------------------------------------------------------------------- | ------- | ----------------------------------------------------- | +| gauge | `██▒░░` | Visual representation of context usage | +| percentage | `65%` | Context usage as a percentage | +| input_tokens | `45.2k` | Total input tokens in conversation | +| output_tokens | `12.3k` | Total output tokens in conversation | +| curr_input_tokens | `5.1k` | Input tokens from most recent API call | +| curr_output_tokens | `1.2k` | Output tokens from most recent API call | | curr_cache_creation_tokens | `1.5k` | Cache creation tokens from most recent API call | | curr_cache_read_tokens | `23.4k` | Cache read tokens from most recent API call | -| total_tokens | `200k` | Total context window size | -| symbol | | 對應 `symbol` 選項的設定值 | -| style\* | | Mirrors the style from the matching display threshold | +| total_tokens | `200k` | Total context window size | +| symbol | | 對應 `symbol` 選項的設定值 | +| style\* | | Mirrors the style from the matching display threshold | \*: 此變數僅能用於 style 字串的一部分 @@ -502,10 +527,10 @@ The `claude_cost` module displays the total cost of the current Claude Code sess #### 選項 -| 選項 | 預設 | 說明 | -| ---------- | ---------------------------------- | ----------------------------------- | -| `format` | `'[$symbol(\\$$cost)]($style) '` | 此模組的格式。 | -| `symbol` | `'💰 '` | The symbol shown before the cost. | +| 選項 | 預設 | 說明 | +| ---------- | ---------------------------------- | --------------------------------------------------- | +| `format` | `'[$symbol(\\$$cost)]($style) '` | 此模組的格式。 | +| `symbol` | `'💰 '` | The symbol shown before the cost. | | `display` | [請看下列](#display-1) | Threshold and style configurations. | | `disabled` | `false` | Disables the `claude_cost` module. | @@ -513,11 +538,11 @@ The `claude_cost` module displays the total cost of the current Claude Code sess The `display` option is an array of objects that define cost thresholds and styles. The module uses the style from the highest matching threshold or hides the module if `hidden` is `true`. -| 選項 | 預設 | 說明 | -| ----------- | ------------ | ------------------------------------------------------------- | -| `threshold` | `0.0` | The minimum cost in USD to match this configuration | -| `style` | `bold green` | The value of `style` if this display configuration is matched | -| `hidden` | `false` | Hide this module if this configuration is matched. | +| 選項 | 預設 | 說明 | +| ----------- | ------------ | ------------------------------------------------------------------ | +| `threshold` | `0.0` | The minimum cost in USD to match this configuration | +| `style` | `bold green` | The value of `style` if this display configuration is matched | +| `hidden` | `false` | Hide this module if this configuration is matched. | **Default configuration:** @@ -537,15 +562,15 @@ style = "bold red" #### 變數 -| 變數 | 範例 | 說明 | -| ------------- | -------- | ----------------------------------------------------- | -| cost | `1.23` | Total session cost in USD (formatted to 2 decimals) | -| duration | `1m 30s` | Total session duration | -| api_duration | `45s` | Total API call duration | -| lines_added | `1.2k` | Total lines of code added | -| lines_removed | `500` | Total lines of code removed | -| symbol | | 對應 `symbol` 選項的設定值 | -| style\* | | Mirrors the style from the matching display threshold | +| 變數 | 範例 | 說明 | +| ---------------------------------- | -------- | ---------------------------------------------------------------------- | +| cost | `1.23` | Total session cost in USD (formatted to 2 decimals) | +| duration | `1m 30s` | Total session duration | +| api_duration | `45s` | Total API call duration | +| lines_added | `1.2k` | Total lines of code added | +| lines_removed | `500` | Total lines of code removed | +| symbol | | 對應 `symbol` 選項的設定值 | +| style\* | | Mirrors the style from the matching display threshold | \*: 此變數僅能用於 style 字串的一部分 @@ -578,10 +603,10 @@ format = "[$symbol$cost ($duration)]($style) " ## 風格字串 -風格字串是一個以空白分開的單詞清單。 單字並不會區分大小寫(換句話說,`bold` 與 `BoLd` 是被當作兩個相同的字串)。 每個單詞可以是下列其中之一: +風格字串是一個以空白分開的單詞清單。 The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). 每個單詞可以是下列其中之一: - `bold` -- `斜體字` +- `italic` - `underline` - `dimmed` - `inverted` @@ -593,15 +618,17 @@ format = "[$symbol$cost ($duration)]($style) " - `` - `none` -其中 `` 是指定顏色用的(下面解釋)。 `fg:` and `` currently do the same thing, though this may change in the future. `` can also be set to `prev_fg` or `prev_bg` which evaluates to the previous item's foreground or background color respectively if available or `none` otherwise. `inverted` swaps the background and foreground colors. 單詞在字串中的順序不重要。 +where `` is a color specifier (discussed below). `fg:` and `` currently do the same thing, though this may change in the future. +`` can also be set to `prev_fg` or `prev_bg` which evaluates to the previous item's foreground or background color respectively if available or `none` otherwise. +`inverted` swaps the background and foreground colors. 單詞在字串中的順序不重要。 The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. 未來可能會將 `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`). -- 一個 `#` 後面跟隨著六位數的十六進位數字。 這個指定了 [RGB 十六進制色碼](https://www.w3schools.com/colors/colors_hexadecimal.asp)。 -- 一個介於 0~255 之間的數字。 這個指定了 [8-bit ANSI 色碼](https://i.stack.imgur.com/KTSQa.png)。 +- A `#` followed by a six-digit hexadecimal number. 一個 `#` 後面跟隨著六位數的十六進位數字。 這個指定了 [RGB 十六進制色碼](https://www.w3schools.com/colors/colors_hexadecimal.asp)。 +- 一個介於 0~255 之間的數字。 一個介於 0~255 之間的數字。 這個指定了 [8-bit ANSI 色碼](https://i.stack.imgur.com/KTSQa.png)。 如果前景/後景被指定了多種顏色,最後一個顏色具有最高優先性。