From 16cbc7a1fa77235040c388b6c35778b319961817 Mon Sep 17 00:00:00 2001 From: SinclairLin Date: Mon, 16 Feb 2026 01:39:04 +0800 Subject: [PATCH 1/2] docs: add bilingual README and keep i18n target as English --- .github/workflows/a18n.yml | 4 +- README.md | 144 +++++++++++++++++++------------------ README.zh-CN.md | 134 ++++++++++++++++++++++++++++++++++ 3 files changed, 211 insertions(+), 71 deletions(-) create mode 100644 README.zh-CN.md diff --git a/.github/workflows/a18n.yml b/.github/workflows/a18n.yml index f0ddc1c..f15c83f 100644 --- a/.github/workflows/a18n.yml +++ b/.github/workflows/a18n.yml @@ -29,13 +29,15 @@ jobs: # 设置环境变量 CHATGPT_API_KEY: ${{ secrets.CHATGPT_API_KEY }} CHATGPT_API_BASE: ${{ secrets.CHATGPT_API_BASE }} + I18N_TARGET_LANG: en + TRANSLATE_TARGET_LANG: en run: | pip install -r requirements.txt python auto-translater.py || true - name: Commit translated run: | git config --global user.email ${{ secrets.GIT_EMAIL }} - git config --global user.name ${{ secrets.GIT_USERNAME }} + git config --global user.name ${{ github.actor }} git add . git commit -m "Commit translated" || true - name: Push changes diff --git a/README.md b/README.md index 7d40981..e571c3b 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,75 @@ -## 目录结构 -``` +[中文](./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 -### 自动安装 -理论上可以支持大多数发行版,请自行测试,**运行前务必备份!** -``` -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 +### 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 | bash ``` -> 注意:自动安装脚本会优先使用系统包管理器,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. -快速检查: -``` -zsh --version -lua -v +Quick checks: + +```bash 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,60 +78,59 @@ 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 this config to `~/.config`: -#### 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 - [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 1baa5eed6cf82bd2984d85fd564f1d0012db1b66 Mon Sep 17 00:00:00 2001 From: SinclairLin Date: Mon, 16 Feb 2026 01:47:36 +0800 Subject: [PATCH 2/2] ci: fix i18n workflow to update README.md instead of README_EN.md --- .github/workflows/a18n.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/a18n.yml b/.github/workflows/a18n.yml index f15c83f..dad8ccb 100644 --- a/.github/workflows/a18n.yml +++ b/.github/workflows/a18n.yml @@ -31,19 +31,22 @@ jobs: CHATGPT_API_BASE: ${{ secrets.CHATGPT_API_BASE }} I18N_TARGET_LANG: en TRANSLATE_TARGET_LANG: en + I18N_MODEL: ${{ vars.I18N_MODEL }} run: | pip install -r requirements.txt python auto-translater.py || true - name: Commit translated run: | - git config --global user.email ${{ secrets.GIT_EMAIL }} - git config --global user.name ${{ github.actor }} - git add . - git commit -m "Commit translated" || true - - name: Push changes - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + if git diff --quiet -- README.md; then + echo "README.md is up to date, nothing to commit." + exit 0 + fi + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add README.md + git commit -m "chore(i18n): auto-translate README to English [skip ci]" + git push origin HEAD:main - name: Install MkDocs dependencies run: pip install -r requirements.txt - name: Deploy with MkDocs