From 0dffd7da11e7559ea5ab56671ed22f9d68eb278e Mon Sep 17 00:00:00 2001 From: SinclairLin Date: Mon, 16 Feb 2026 01:30:25 +0800 Subject: [PATCH 1/3] docs: add bilingual README and set i18n target to zh-CN --- .github/workflows/a18n.yml | 2 + README.md | 138 ++++++++++++++++++++----------------- README.zh-CN.md | 134 +++++++++++++++++++++++++++++++++++ 3 files changed, 211 insertions(+), 63 deletions(-) create mode 100644 README.zh-CN.md diff --git a/.github/workflows/a18n.yml b/.github/workflows/a18n.yml index f0ddc1c..73fa0bd 100644 --- a/.github/workflows/a18n.yml +++ b/.github/workflows/a18n.yml @@ -29,6 +29,8 @@ jobs: # 设置环境变量 CHATGPT_API_KEY: ${{ secrets.CHATGPT_API_KEY }} CHATGPT_API_BASE: ${{ secrets.CHATGPT_API_BASE }} + I18N_TARGET_LANG: zh-CN + TRANSLATE_TARGET_LANG: zh-CN run: | pip install -r requirements.txt python auto-translater.py || true diff --git a/README.md b/README.md index 7d40981..bbf9b79 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,79 @@ -## 目录结构 -``` +[中文](./README.zh-CN.md) | English + +## Directory Structure +```text ./ ├── cache/ ├── config/ -│   ├── aliases.zsh -│   ├── env.zsh -│   ├── fzf.zsh -│   ├── git.zsh -│   └── hook.zsh +│ ├── aliases.zsh +│ ├── env.zsh +│ ├── fzf.zsh +│ ├── git.zsh +│ └── hook.zsh ├── lib/ -│   ├── file_preview.sh -│   ├── get_cursor.sh -│   ├── img_preview.sh -│   └── init.sh +│ ├── file_preview.sh +│ ├── get_cursor.sh +│ ├── img_preview.sh +│ └── init.sh ├── plugins/ -│   ├── extract/ -│   ├── fzf-tab/ -│   ├── randport/ -│   ├── z.lua/ -│   ├── zsh-autosuggestions/ -│   └── zsh-syntax-highlighting/ +│ ├── extract/ +│ ├── fzf-tab/ +│ ├── randport/ +│ ├── z.lua/ +│ ├── zsh-autosuggestions/ +│ └── zsh-syntax-highlighting/ ├── scripts/ -│   └── install_zsh_config.sh +│ └── install_zsh_config.sh ├── themes/ -│   └── simple.zsh-theme +│ └── simple.zsh-theme └── omz.zsh ``` + ## Installation -### 自动安装 -理论上可以支持大多数发行版,请自行测试,**运行前务必备份!** -``` +### Automatic Installation +In theory this should work on most Linux distributions. Please test in your environment and **back up first** before running. + +```bash curl -fsSL https://raw.githubusercontent.com/SinclairLin/omz/main/scripts/install_zsh_config.sh -o install_zsh_config.sh chmod +x install_zsh_config.sh ./install_zsh_config.sh ``` -> 注意:自动安装脚本会优先使用系统包管理器,Debian stable/oldstable 上部分依赖版本可能偏旧。 -> 建议安装后手动检查版本,必要时再单独升级关键依赖。 +> Note: The installer prefers your system package manager. On Debian stable/oldstable, some dependency versions may be old. +> It is recommended to check versions after installation and upgrade key dependencies if needed. -快速检查: -``` +Quick checks: + +```bash zsh --version lua -v fzf --version fd --version || fdfind --version ``` -### 手动安装 -#### Requires -- `Zsh`,`lua`,`fd` -in Arch Linux: -``` +### Manual Installation +#### Requirements +- `zsh`, `lua`, `fd` + +On Arch Linux: + +```bash sudo pacman -S zsh lua fd ``` -in Debian: -``` -sudo apt install zsh lua5.4 fd-find +On Debian: + +```bash +sudo apt install zsh lua5.4 fd-find command -v fd >/dev/null 2>&1 || sudo ln -s /usr/bin/fdfind /usr/local/bin/fd ``` -in OpenWrt: -``` +On OpenWrt: + +```bash opkg install zsh -sed -i 's|:/bin/ash|:/usr/bin/zsh|g' /etc/passwd # 更换默认shell +sed -i 's|:/bin/ash|:/usr/bin/zsh|g' /etc/passwd # switch default shell wget https://github.com/sharkdp/fd/releases/download/v10.3.0/fd-v10.3.0-aarch64-unknown-linux-musl.tar.gz tar -zxvf fd-v10.3.0-aarch64-unknown-linux-musl.tar.gz mv fd-v10.3.0-aarch64-unknown-linux-musl/fd /usr/bin @@ -73,17 +82,19 @@ fd --version ``` - fzf -``` + +```bash git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install ``` -- 可选增强工具(版本过旧时建议自行升级) -`eza`/`bat`/`ueberzug`/`img2txt`/`lazygit`/`ranger` +- Optional enhancements (upgrade manually if distro versions are too old): +`eza` / `bat` / `ueberzug` / `img2txt` / `lazygit` / `ranger` -#### source -clone 我的配置到`~/.config`: -``` +#### Source +Clone this config to `~/.config`: + +```bash git clone https://github.com/SinclairLin/omz ~/.config/zsh && \ echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc ``` @@ -92,41 +103,42 @@ echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc - [zsh-extract](https://github.com/SinclairLin/zsh-extract) -> 定义一个`extract`函数,只需执行`extract `或`x `即可解压一个压缩文件。 -> 这样就可以不必知道解压文件的具体命令,该函数会建立一个新的文件夹,然后将文件提取到新的文件夹中。 -> 具体可以解压那些文件:[SinclairLin/zsh-extract](https://github.com/SinclairLin/zsh-extract/blob/master/README.md#supported-file-extensions)。 +> Defines an `extract` function. Run `extract ` or `x ` to unpack archives. +> You do not need to remember exact extraction commands. It creates a new folder and extracts files into it. +> Supported archive types: [SinclairLin/zsh-extract](https://github.com/SinclairLin/zsh-extract/blob/master/README.md#supported-file-extensions). - [zsh-randport](https://github.com/SinclairLin/zsh-randport) -> 定义一个`randport`函数,使其可以在49152 - 65535之间随机挑选一个空闲端口打印到屏幕上。 +> Defines a `randport` function that prints a random available port in the range `49152 - 65535`. - [z.lua](https://github.com/skywind3000/z.lua) -> 使用`z `会帮你跳转到所有的路径里 Frecent 值最高的那条路径去。 +> `z ` jumps to the path with the highest frecent score among matched directories. **EXAMPLES:** -``` -z foo # 跳转到包含 foo 并且权重(Frecent)最高的路径 -z foo bar # 跳转到同时包含 foo 和 bar 并且权重最高的路径 -z -r foo # 跳转到包含 foo 并且访问次数最高的路径 -z -t foo # 跳转到包含 foo 并且最近访问过的路径 -z -l foo # 不跳转,只是列出所有匹配 foo 的路径 -z -c foo # 跳转到包含 foo 并且是当前路径的子路径的权重最高的路径 -z -e foo # 不跳转,只是打印出匹配 foo 并且权重最高的路径 -z -i foo # 进入交互式选择模式,让你自己挑选去哪里(多个结果的话) -z -I foo # 进入交互式选择模式,但是使用 fzf 来选择 -z -b foo # 跳转到父目录中名称以 foo 开头的那一级 + +```bash +z foo # jump to the best matched path containing foo by frecent score +z foo bar # jump to the best matched path containing both foo and bar +z -r foo # jump to the most frequently visited path containing foo +z -t foo # jump to the most recently visited path containing foo +z -l foo # list matched paths only, do not jump +z -c foo # jump to the best matched subdirectory under current path +z -e foo # print the best matched path only, do not jump +z -i foo # interactive selection mode when there are multiple matches +z -I foo # interactive selection mode using fzf +z -b foo # jump to parent directory level whose name starts with foo ``` - [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) -> 根据历史记录和完成情况在输入时建议命令。 -> 使用快捷键``接受当前建议,`<^ right>`只接受一个word。 +> Suggests commands from history and completions while typing. +> Use `` to accept the full suggestion, `<^ right>` to accept one word. - [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) -> 让`Zsh`可以实现类似`Fish shell`的语法高亮。 +> Adds Fish-like syntax highlighting to Zsh. - [fzf-tab](https://github.com/Aloxaf/fzf-tab) -> 将`Zsh`的默认补全选择菜单替换为[fzf](https://github.com/junegunn/fzf)。 +> Replaces Zsh's default completion menu with [fzf](https://github.com/junegunn/fzf). diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 0000000..86a4254 --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,134 @@ +中文 | [English](./README.md) + +## 目录结构 +``` +./ +├── cache/ +├── config/ +│   ├── aliases.zsh +│   ├── env.zsh +│   ├── fzf.zsh +│   ├── git.zsh +│   └── hook.zsh +├── lib/ +│   ├── file_preview.sh +│   ├── get_cursor.sh +│   ├── img_preview.sh +│   └── init.sh +├── plugins/ +│   ├── extract/ +│   ├── fzf-tab/ +│   ├── randport/ +│   ├── z.lua/ +│   ├── zsh-autosuggestions/ +│   └── zsh-syntax-highlighting/ +├── scripts/ +│   └── install_zsh_config.sh +├── themes/ +│   └── simple.zsh-theme +└── omz.zsh +``` +## Installation + +### 自动安装 +理论上可以支持大多数发行版,请自行测试,**运行前务必备份!** +``` +curl -fsSL https://raw.githubusercontent.com/SinclairLin/omz/main/scripts/install_zsh_config.sh -o install_zsh_config.sh +chmod +x install_zsh_config.sh +./install_zsh_config.sh +``` + +> 注意:自动安装脚本会优先使用系统包管理器,Debian stable/oldstable 上部分依赖版本可能偏旧。 +> 建议安装后手动检查版本,必要时再单独升级关键依赖。 + +快速检查: +``` +zsh --version +lua -v +fzf --version +fd --version || fdfind --version +``` + +### 手动安装 +#### Requires +- `Zsh`,`lua`,`fd` +in Arch Linux: +``` +sudo pacman -S zsh lua fd +``` + +in Debian: +``` +sudo apt install zsh lua5.4 fd-find +command -v fd >/dev/null 2>&1 || sudo ln -s /usr/bin/fdfind /usr/local/bin/fd +``` + +in OpenWrt: +``` +opkg install zsh +sed -i 's|:/bin/ash|:/usr/bin/zsh|g' /etc/passwd # 更换默认shell +wget https://github.com/sharkdp/fd/releases/download/v10.3.0/fd-v10.3.0-aarch64-unknown-linux-musl.tar.gz +tar -zxvf fd-v10.3.0-aarch64-unknown-linux-musl.tar.gz +mv fd-v10.3.0-aarch64-unknown-linux-musl/fd /usr/bin +chmod +x /usr/bin/fd +fd --version +``` + +- fzf +``` +git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf +~/.fzf/install +``` + +- 可选增强工具(版本过旧时建议自行升级) +`eza`/`bat`/`ueberzug`/`img2txt`/`lazygit`/`ranger` + +#### source +clone 我的配置到`~/.config`: +``` +git clone https://github.com/SinclairLin/omz ~/.config/zsh && \ +echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc +``` + +## Plugins + +- [zsh-extract](https://github.com/SinclairLin/zsh-extract) + +> 定义一个`extract`函数,只需执行`extract `或`x `即可解压一个压缩文件。 +> 这样就可以不必知道解压文件的具体命令,该函数会建立一个新的文件夹,然后将文件提取到新的文件夹中。 +> 具体可以解压那些文件:[SinclairLin/zsh-extract](https://github.com/SinclairLin/zsh-extract/blob/master/README.md#supported-file-extensions)。 + +- [zsh-randport](https://github.com/SinclairLin/zsh-randport) + +> 定义一个`randport`函数,使其可以在49152 - 65535之间随机挑选一个空闲端口打印到屏幕上。 + +- [z.lua](https://github.com/skywind3000/z.lua) + +> 使用`z `会帮你跳转到所有的路径里 Frecent 值最高的那条路径去。 + +**EXAMPLES:** +``` +z foo # 跳转到包含 foo 并且权重(Frecent)最高的路径 +z foo bar # 跳转到同时包含 foo 和 bar 并且权重最高的路径 +z -r foo # 跳转到包含 foo 并且访问次数最高的路径 +z -t foo # 跳转到包含 foo 并且最近访问过的路径 +z -l foo # 不跳转,只是列出所有匹配 foo 的路径 +z -c foo # 跳转到包含 foo 并且是当前路径的子路径的权重最高的路径 +z -e foo # 不跳转,只是打印出匹配 foo 并且权重最高的路径 +z -i foo # 进入交互式选择模式,让你自己挑选去哪里(多个结果的话) +z -I foo # 进入交互式选择模式,但是使用 fzf 来选择 +z -b foo # 跳转到父目录中名称以 foo 开头的那一级 +``` + +- [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) + +> 根据历史记录和完成情况在输入时建议命令。 +> 使用快捷键``接受当前建议,`<^ right>`只接受一个word。 + +- [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) + +> 让`Zsh`可以实现类似`Fish shell`的语法高亮。 + +- [fzf-tab](https://github.com/Aloxaf/fzf-tab) + +> 将`Zsh`的默认补全选择菜单替换为[fzf](https://github.com/junegunn/fzf)。 From 7e2e2e110881d174cea0ec8c394007d1ba9f70b2 Mon Sep 17 00:00:00 2001 From: SinclairLin Date: Mon, 16 Feb 2026 02:05:44 +0800 Subject: [PATCH 2/3] docs: update README content in Chinese and English --- README.md | 25 +------------------------ README.zh-CN.md | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index acb988a..afe638d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[中文](./README.zh-CN.md) | English +English | [中文](./README.zh-CN.md) ## Directory Structure ```text @@ -35,13 +35,7 @@ In theory this should work on most Linux distributions. Please test in your environment and **back up first** before running. ```bash -<<<<<<< HEAD -curl -fsSL https://raw.githubusercontent.com/SinclairLin/omz/main/scripts/install_zsh_config.sh -o install_zsh_config.sh -chmod +x install_zsh_config.sh -./install_zsh_config.sh -======= curl -fsSL https://raw.githubusercontent.com/SinclairLin/omz/main/scripts/install_zsh_config.sh | bash ->>>>>>> origin/main ``` > Note: The installer prefers your system package manager. On Debian stable/oldstable, some dependency versions may be old. @@ -50,11 +44,6 @@ curl -fsSL https://raw.githubusercontent.com/SinclairLin/omz/main/scripts/instal Quick checks: ```bash -<<<<<<< HEAD -zsh --version -lua -v -======= ->>>>>>> origin/main fzf --version fd --version || fdfind --version ``` @@ -95,23 +84,11 @@ git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install ``` -<<<<<<< HEAD -- Optional enhancements (upgrade manually if distro versions are too old): -`eza` / `bat` / `ueberzug` / `img2txt` / `lazygit` / `ranger` - -#### Source -Clone this config to `~/.config`: - -```bash -git clone https://github.com/SinclairLin/omz ~/.config/zsh && \ -echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc -======= #### Source Clone this config to `~/.config`: ```bash git clone https://github.com/SinclairLin/omz ~/.config/zsh && echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc ->>>>>>> origin/main ``` ## Plugins diff --git a/README.zh-CN.md b/README.zh-CN.md index 86a4254..0b93cfe 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,7 +1,7 @@ -中文 | [English](./README.md) +[English](./README.md) | 中文 ## 目录结构 -``` +```text ./ ├── cache/ ├── config/ @@ -32,19 +32,17 @@ ### 自动安装 理论上可以支持大多数发行版,请自行测试,**运行前务必备份!** -``` -curl -fsSL https://raw.githubusercontent.com/SinclairLin/omz/main/scripts/install_zsh_config.sh -o install_zsh_config.sh -chmod +x install_zsh_config.sh -./install_zsh_config.sh + +```bash +curl -fsSL https://raw.githubusercontent.com/SinclairLin/omz/main/scripts/install_zsh_config.sh | bash ``` > 注意:自动安装脚本会优先使用系统包管理器,Debian stable/oldstable 上部分依赖版本可能偏旧。 > 建议安装后手动检查版本,必要时再单独升级关键依赖。 快速检查: -``` -zsh --version -lua -v + +```bash fzf --version fd --version || fdfind --version ``` @@ -53,18 +51,21 @@ fd --version || fdfind --version #### Requires - `Zsh`,`lua`,`fd` in Arch Linux: -``` + +```bash sudo pacman -S zsh lua fd ``` in Debian: -``` + +```bash sudo apt install zsh lua5.4 fd-find command -v fd >/dev/null 2>&1 || sudo ln -s /usr/bin/fdfind /usr/local/bin/fd ``` in OpenWrt: -``` + +```bash opkg install zsh sed -i 's|:/bin/ash|:/usr/bin/zsh|g' /etc/passwd # 更换默认shell wget https://github.com/sharkdp/fd/releases/download/v10.3.0/fd-v10.3.0-aarch64-unknown-linux-musl.tar.gz @@ -75,19 +76,17 @@ fd --version ``` - fzf -``` + +```bash git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install ``` -- 可选增强工具(版本过旧时建议自行升级) -`eza`/`bat`/`ueberzug`/`img2txt`/`lazygit`/`ranger` - #### source clone 我的配置到`~/.config`: -``` -git clone https://github.com/SinclairLin/omz ~/.config/zsh && \ -echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc + +```bash +git clone https://github.com/SinclairLin/omz ~/.config/zsh && echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc ``` ## Plugins @@ -107,7 +106,8 @@ echo 'source ~/.config/zsh/omz.zsh' >> ~/.zshrc > 使用`z `会帮你跳转到所有的路径里 Frecent 值最高的那条路径去。 **EXAMPLES:** -``` + +```bash z foo # 跳转到包含 foo 并且权重(Frecent)最高的路径 z foo bar # 跳转到同时包含 foo 和 bar 并且权重最高的路径 z -r foo # 跳转到包含 foo 并且访问次数最高的路径 From 251875fad57d8adb8e05385953be92bb7ef94ee3 Mon Sep 17 00:00:00 2001 From: SinclairLin Date: Mon, 16 Feb 2026 02:10:00 +0800 Subject: [PATCH 3/3] ci: translate README.md from README.zh-CN.md in i18n workflow --- .github/workflows/a18n.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/a18n.yml b/.github/workflows/a18n.yml index 18133c3..be01d64 100644 --- a/.github/workflows/a18n.yml +++ b/.github/workflows/a18n.yml @@ -31,18 +31,13 @@ jobs: - name: Install dependencies run: pip install --upgrade openai - - name: Translate README.md to English + - name: Translate README.zh-CN.md to README.md (English) env: CHATGPT_API_KEY: ${{ secrets.CHATGPT_API_KEY }} CHATGPT_API_BASE: ${{ secrets.CHATGPT_API_BASE }} -<<<<<<< HEAD - I18N_TARGET_LANG: zh-CN - TRANSLATE_TARGET_LANG: zh-CN -======= I18N_TARGET_LANG: en TRANSLATE_TARGET_LANG: en I18N_MODEL: ${{ vars.I18N_MODEL }} ->>>>>>> origin/main run: | python - <<'PY' import os @@ -57,7 +52,7 @@ jobs: client = OpenAI(api_key=api_key, base_url=base_url or None) - with open("README.md", "r", encoding="utf-8") as f: + with open("README.zh-CN.md", "r", encoding="utf-8") as f: source = f.read() prompt = ( @@ -77,14 +72,14 @@ jobs: ) text = (resp.choices[0].message.content or "").strip() + "\n" - with open("README_EN.md", "w", encoding="utf-8") as f: + with open("README.md", "w", encoding="utf-8") as f: f.write(text) PY - name: Commit and push translated README run: | if git diff --quiet -- README.md; then - echo "README.md is up to date, nothing to commit." + echo "README.md is up to date after translating README.zh-CN.md, nothing to commit." exit 0 fi