From c4ff917ba08223ec06aba36ea7aa1dffaa505574 Mon Sep 17 00:00:00 2001 From: digital-teams Date: Sat, 30 Dec 2023 23:47:21 +0000 Subject: [PATCH] New Crowdin translations by GitHub Action (#539) --- .../current/02_zsh_plugin_standard.mdx | 54 +++++++++++-------- .../current/02_zsh_plugin_standard.mdx | 54 +++++++++++-------- 2 files changed, 64 insertions(+), 44 deletions(-) diff --git a/i18n/ja/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx b/i18n/ja/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx index 1844805d..693b2296 100644 --- a/i18n/ja/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx +++ b/i18n/ja/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx @@ -38,7 +38,7 @@ keywords: 3.4. software package containing any type of command line artifacts – when used with advanced plugin managers that have hooks, can run Makefiles, and add directories to `$PATH`. -Below follow the proposed enhancements and codifications of the definition of a "Zsh the plugin" and the actions of plugin managers – the proposed standardization. +Below are the proposed enhancements and codifications of the definition of a "Zsh the plugin" and the actions of plugin managers – the proposed standardization. Zshプラグインの書き方に関する情報を網羅しています。 @@ -67,7 +67,7 @@ Then `${0:h}` to get the plugin’s directory. 3. Use `$0` if it doesn’t contain the path to the Zsh binary, - 3.1. plugin manager will still be able to set `$0`, although more difficultly, requires `unsetopt function_argzero` before sourcing plugin script, and `0=…​` assignment after sourcing plugin script. + 3.1. plugin manager will still be able to set `$0`, although more difficult, requires `unsetopt function_argzero` before sourcing the plugin script, and `0=…​` assignment after sourcing the plugin script. 3.2. `unsetopt function_argzero` will be detected (it causes `$0` not to contain a plugin-script path, but the path to Zsh binary, if not overwritten by a `0=…​` assignment), @@ -75,11 +75,11 @@ Then `${0:h}` to get the plugin’s directory. 4. Use the `%N` prompt expansion flag, which always gives the absolute path to the script, - 4.1. plugin manager cannot alter this (no advanced loading of the plugin is possible), but simple plugin-file sourcing (without a plugin manager) will be saved from breaking caused by the mentioned `*_argzero` [options][], so this is a very good last-resort fallback. + 4.1. plugin manager cannot alter this (no advanced loading of the plugin is possible), but simple plugin-file sourcing (without a plugin manager) will be saved from breaking caused by the mentioned `*_argzero` [options][zsh-options], so this is a very good last-resort fallback. 5. Finally, in the second line, it will ensure that `$0` contains an absolute path by prepending it with `$PWD` if necessary. -The goal is flexibility, with essential motivation to support `eval "$( Reference: [zsh shell builtin commands][builtin-commands] + +The emulation is altered with the following options: - `${=${options[xtrace]:#off}:+-o xtrace}` – `xtrace` prints commands and their arguments as they are executed, this specific variable calls `xtrace` when needed, e.g.: when already active at the entry to the function. @@ -370,7 +378,7 @@ It resets all the options to their default state according to the `zsh` emulatio - `no_short_loops` – disables the short-loops syntax; this is done because when the syntax is enabled it limits the parser’s ability to detect errors (see this [zsh-workers post][] for the details), -- `rc_quotes` – adds useful ability to insert apostrophes into an apostrophe-quoted string, by use of `''` inside it, e.g.: `'a string’s example'` will yield the string `a string’s example`, +- `rc_quotes` – adds the useful ability to insert apostrophes into an apostrophe-quoted string, by use of `''` inside it, e.g.: `'a string’s example'` will yield the string \`a string’s example, - `no_auto_pushd` - disables the automatic push of the directory passed to `cd` builtin onto the directory stack; this is useful because otherwise, the internal directory changes done by the plugin will pollute the global directory stack. @@ -405,7 +413,7 @@ However, when adopted, the proposition will solve the following issues: 3. It would allow quickly discriminate between function types – e.g.: seeing the `:` prefix informs the user that it’s a hook-type function while seeing the `@` prefix informs the user that it’s an API-like function, etc. -4. It also provides an improvement during programming, by allowing to quickly limit the number of completions offered by the editor, e.g.: for Vim’s Ctrl-P completing, when entering +Ctrl-P, then only a subset of the functions are being completed (see below for the type of the functions). **Note:** the editor has to be configured so that it accepts such special characters as part of keywords, for Vim it’s: `:set isk+=@-@,.,+,/,:` for all of the proposed prefixes. +4. It also provides an improvement during programming, by allowing to quickly limit the number of completions offered by the editor, e.g.: for Vim’s Ctrl-P completing, when entering +Ctrl-P, then only a subset of the functions are being completed (see below for the type of the functions). **Note:** The editor has to be configured so that it accepts such special characters as part of keywords, for Vim it’s: `:set isk+=@-@,.,+,/,:` for all of the proposed prefixes. ## The Proposed function-name prefixes @@ -431,9 +439,9 @@ The proposition of the standard prefixes is as follows: 3. `+`: for output functions, i.e.: for functions that print to the standard output and error or a log, etc. Example function name: `+prompt_zinc_output_segment`. -4. `/`: for debugging functions, i.e: for functions that output debugs messages to the screen or a log or e.g.: gather some debug data. **Note:** the slash makes it impossible for such functions to be auto-loaded via the `autoload` mechanism. It is somewhat risky to assume, that this will never be needed for the functions, however, the limited number of available ASCII characters justifies such allocation. Example function name: `/prompt_zinc_dmsg`. +4. `/`: for debugging functions, i.e.: for functions that output debug messages to the screen or a log or e.g.: gather some debug data. **Note:** The slash makes it impossible for such functions to be auto-loaded via the `autoload` mechanism. It is somewhat risky to assume, that this will never be needed for the functions, however, the limited number of available ASCII characters justifies such allocation. Example function name: `/prompt_zinc_dmsg`. -5. `@`: for API-like functions, i.e: for functions that are on a boundary to a subsystem and expose their functionality through a well-defined, generally fixed interface. For example, this plugin standard [defines](#update-register-call) the function `@zsh-plugin-run-on-update`, which is exposing a plugin manager’s functionality in a well-defined way. +5. `@`: for API-like functions, i.e.: for functions that are on a boundary to a subsystem and expose their functionality through a well-defined, generally fixed interface. For example, this plugin standard [defines](#update-register-call) the function `@zsh-plugin-run-on-update`, which exposes a plugin manager’s functionality in a well-defined way. ## Example code utilizing the prefixes @@ -471,7 +479,7 @@ Replace the `prj*` prefix with your project name, e.g.: `rustef` for a `rust`-re ## Preventing parameter pollution -When writing a plugin one often needs to keep a state during the Zsh session. To do this it is natural to use global parameters. However, when the number of the parameters grows one might want to limit it. +When writing a plugin one often needs to keep a state during the Zsh session. To do this it is natural to use global parameters. However, when the number of parameters grows one might want to limit it. With the following method, only a single global parameter per plugin can be sufficient: @@ -529,4 +537,6 @@ Following the [Standard Plugins Hash](#standard-plugins-hash) section, the plugi [hook-functions]: https://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions -[options]: https://zsh.sourceforge.io/Doc/Release/Options.html +[zsh-options]: https://zsh.sourceforge.io/Doc/Release/Options.html + +[builtin-commands]: https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Commands.html diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx b/i18n/zh-Hans/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx index 924f5263..8a029dac 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx @@ -38,7 +38,7 @@ keywords: 3.4. software package containing any type of command line artifacts – when used with advanced plugin managers that have hooks, can run Makefiles, and add directories to `$PATH`. -Below follow the proposed enhancements and codifications of the definition of a "Zsh the plugin" and the actions of plugin managers – the proposed standardization. +Below are the proposed enhancements and codifications of the definition of a "Zsh the plugin" and the actions of plugin managers – the proposed standardization. 它们涵盖了如何编写Zsh插件的信息。 @@ -67,7 +67,7 @@ Then `${0:h}` to get the plugin’s directory. 3. Use `$0` if it doesn’t contain the path to the Zsh binary, - 3.1. plugin manager will still be able to set `$0`, although more difficultly, requires `unsetopt function_argzero` before sourcing plugin script, and `0=…​` assignment after sourcing plugin script. + 3.1. plugin manager will still be able to set `$0`, although more difficult, requires `unsetopt function_argzero` before sourcing the plugin script, and `0=…​` assignment after sourcing the plugin script. 3.2. `unsetopt function_argzero` will be detected (it causes `$0` not to contain a plugin-script path, but the path to Zsh binary, if not overwritten by a `0=…​` assignment), @@ -75,11 +75,11 @@ Then `${0:h}` to get the plugin’s directory. 4. Use the `%N` prompt expansion flag, which always gives the absolute path to the script, - 4.1. plugin manager cannot alter this (no advanced loading of the plugin is possible), but simple plugin-file sourcing (without a plugin manager) will be saved from breaking caused by the mentioned `*_argzero` [options][], so this is a very good last-resort fallback. + 4.1. plugin manager cannot alter this (no advanced loading of the plugin is possible), but simple plugin-file sourcing (without a plugin manager) will be saved from breaking caused by the mentioned `*_argzero` [options][zsh-options], so this is a very good last-resort fallback. 5. Finally, in the second line, it will ensure that `$0` contains an absolute path by prepending it with `$PWD` if necessary. -The goal is flexibility, with essential motivation to support `eval "$( Reference: [zsh shell builtin commands][builtin-commands] + +The emulation is altered with the following options: - `${=${options[xtrace]:#off}:+-o xtrace}` – `xtrace` prints commands and their arguments as they are executed, this specific variable calls `xtrace` when needed, e.g.: when already active at the entry to the function. @@ -370,7 +378,7 @@ It resets all the options to their default state according to the `zsh` emulatio - `no_short_loops` – disables the short-loops syntax; this is done because when the syntax is enabled it limits the parser’s ability to detect errors (see this [zsh-workers post][] for the details), -- `rc_quotes` – adds useful ability to insert apostrophes into an apostrophe-quoted string, by use of `''` inside it, e.g.: `'a string’s example'` will yield the string `a string’s example`, +- `rc_quotes` – adds the useful ability to insert apostrophes into an apostrophe-quoted string, by use of `''` inside it, e.g.: `'a string’s example'` will yield the string \`a string’s example, - `no_auto_pushd` - disables the automatic push of the directory passed to `cd` builtin onto the directory stack; this is useful because otherwise, the internal directory changes done by the plugin will pollute the global directory stack. @@ -405,7 +413,7 @@ However, when adopted, the proposition will solve the following issues: 3. It would allow quickly discriminate between function types – e.g.: seeing the `:` prefix informs the user that it’s a hook-type function while seeing the `@` prefix informs the user that it’s an API-like function, etc. -4. It also provides an improvement during programming, by allowing to quickly limit the number of completions offered by the editor, e.g.: for Vim’s Ctrl-P completing, when entering +Ctrl-P, then only a subset of the functions are being completed (see below for the type of the functions). **Note:** the editor has to be configured so that it accepts such special characters as part of keywords, for Vim it’s: `:set isk+=@-@,.,+,/,:` for all of the proposed prefixes. +4. It also provides an improvement during programming, by allowing to quickly limit the number of completions offered by the editor, e.g.: for Vim’s Ctrl-P completing, when entering +Ctrl-P, then only a subset of the functions are being completed (see below for the type of the functions). **Note:** The editor has to be configured so that it accepts such special characters as part of keywords, for Vim it’s: `:set isk+=@-@,.,+,/,:` for all of the proposed prefixes. ## The Proposed function-name prefixes @@ -431,9 +439,9 @@ The proposition of the standard prefixes is as follows: 3. `+`: for output functions, i.e.: for functions that print to the standard output and error or a log, etc. Example function name: `+prompt_zinc_output_segment`. -4. `/`: for debugging functions, i.e: for functions that output debugs messages to the screen or a log or e.g.: gather some debug data. **Note:** the slash makes it impossible for such functions to be auto-loaded via the `autoload` mechanism. It is somewhat risky to assume, that this will never be needed for the functions, however, the limited number of available ASCII characters justifies such allocation. Example function name: `/prompt_zinc_dmsg`. +4. `/`: for debugging functions, i.e.: for functions that output debug messages to the screen or a log or e.g.: gather some debug data. **Note:** The slash makes it impossible for such functions to be auto-loaded via the `autoload` mechanism. It is somewhat risky to assume, that this will never be needed for the functions, however, the limited number of available ASCII characters justifies such allocation. Example function name: `/prompt_zinc_dmsg`. -5. `@`: for API-like functions, i.e: for functions that are on a boundary to a subsystem and expose their functionality through a well-defined, generally fixed interface. For example, this plugin standard [defines](#update-register-call) the function `@zsh-plugin-run-on-update`, which is exposing a plugin manager’s functionality in a well-defined way. +5. `@`: for API-like functions, i.e.: for functions that are on a boundary to a subsystem and expose their functionality through a well-defined, generally fixed interface. For example, this plugin standard [defines](#update-register-call) the function `@zsh-plugin-run-on-update`, which exposes a plugin manager’s functionality in a well-defined way. ## Example code utilizing the prefixes @@ -471,7 +479,7 @@ Replace the `prj*` prefix with your project name, e.g.: `rustef` for a `rust`-re ## Preventing parameter pollution -When writing a plugin one often needs to keep a state during the Zsh session. To do this it is natural to use global parameters. However, when the number of the parameters grows one might want to limit it. +When writing a plugin one often needs to keep a state during the Zsh session. To do this it is natural to use global parameters. However, when the number of parameters grows one might want to limit it. With the following method, only a single global parameter per plugin can be sufficient: @@ -529,4 +537,6 @@ Following the [Standard Plugins Hash](#standard-plugins-hash) section, the plugi [hook-functions]: https://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions -[options]: https://zsh.sourceforge.io/Doc/Release/Options.html +[zsh-options]: https://zsh.sourceforge.io/Doc/Release/Options.html + +[builtin-commands]: https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Commands.html