Skip to content

feat: localize style pack defaults and migration#455

Closed
rackliu wants to merge 10 commits into
Open-Less:betafrom
rackliu:feature/windows-ime-current-work
Closed

feat: localize style pack defaults and migration#455
rackliu wants to merge 10 commits into
Open-Less:betafrom
rackliu:feature/windows-ime-current-work

Conversation

@rackliu
Copy link
Copy Markdown

@rackliu rackliu commented May 16, 2026

User description

變更摘要

  • 新增語系化 style pack 預設資源(zh-CN / zh-TW / en)
  • 後端改為依 outputLanguagePreference 產生 builtin style pack
  • migration / reset 路徑改為語系感知,保留舊資料相容
  • 串接前端對應流程與 i18n 文案調整

驗證

  • npm run build 通過
  • cargo check --manifest-path src-tauri/Cargo.toml(前次檢查)通過

影響範圍

  • style pack 預設內容與重置行為
  • 舊版 style pack migration 行為

PR Type

Enhancement, Bug fix, Documentation


Description

  • Localize builtin style pack resources

    • Embed zh-CN, zh-TW, and en defaults
    • Convert fallback prompts for Traditional Chinese
  • Make migration and reset language-aware

    • Preserve legacy builtin copies during migration
    • Reset builtins using current preference
  • Improve Windows IME locale handling

    • Try simplified/traditional TSF candidates
    • Detect active profiles across both locales
  • Refresh style pack UI and docs

    • Add style pack strings in locales
    • Update qwen-asr workflow notes

Diagram Walkthrough

flowchart LR
  Pref["Output language preference"]
  Builtins["Localized builtin style packs"]
  Migration["Migration & reset logic"]
  StyleUI["Style pack UI translations"]
  IME["Windows IME TSF selection"]
  ForkDocs["qwen-asr fork docs"]

  Pref -- "build" --> Builtins
  Builtins -- "seed / reset" --> Migration
  Pref -- "localize labels" --> StyleUI
  Pref -- "pick lang id" --> IME
  ForkDocs -- "document" --> Migration
Loading

File Walkthrough

Relevant files
Bug fix
1 files
windows_ime_profile.rs
Add locale-aware TSF profile selection                                     
+85/-21 
Enhancement
13 files
persistence.rs
Localize builtin style migrations and reset                           
+103/-10
types.rs
Generate localized builtin packs from JSON                             
+119/-7 
style_pack_resources.rs
Load embedded style pack defaults                                               
+119/-0 
commands.rs
Use localized defaults in commands                                             
+10/-7   
zh-CN.json
Add simplified Chinese pack defaults                                         
+54/-0   
zh-TW.json
Add traditional Chinese pack defaults                                       
+54/-0   
en.json
Add English pack defaults                                                               
+54/-0   
Style.tsx
Use translated pack names and labels                                         
+118/-130
zh-TW.ts
Refresh Taiwanese style pack translations                               
+256/-157
ja.ts
Add Japanese style pack translations                                         
+98/-0   
en.ts
Add English style pack translations                                           
+98/-0   
zh-CN.ts
Add simplified Chinese style pack translations                     
+98/-0   
ko.ts
Add Korean style pack translations                                             
+98/-0   
Miscellaneous
2 files
lib.rs
Register style pack resources module                                         
+1/-0     
index.ts
Export updated locale bundles                                                       
+3/-3     
Configuration changes
1 files
.gitmodules
Point qwen-asr submodule to fork                                                 
+1/-1     
Documentation
3 files
qwen-asr-submodule-upgrade-checklist.md
Add submodule upgrade review checklist                                     
+49/-0   
windows-upstream-pr-workflow.md
Document upstream Windows PR workflow                                       
+15/-10 
README.md
Update repository docs for fork                                                   
+2/-2     
Additional files
18 files
release-tauri.yml +1/-1     
README.zh.md +2/-2     
git-branching-workflow.md +131/-0 
README.md +1/-1     
windows-ime-install-smoke.ps1 +11/-2   
windows-package-msvc.test.mjs +70/-69 
Cargo.toml +2/-2     
build.rs +2/-2     
mod.rs +1/-1     
qwen_engine.rs +2/-2     
qwen_ffi.rs +1/-1     
ipc.ts +11/-11 
localAsr.ts +1/-1     
guids.h +2/-1     
registry.cpp +28/-5   
audit-system-level.sh +348/-348
bump-version.sh +18/-18 
finding-helper.sh +139/-139

appergb and others added 10 commits May 7, 2026 22:02
…ss#333)

release-sync: workflow rollout + soaked beta features → main
PR Open-Less#330 在 jobs.build 顶层多加了一个 env: 块来定义 OPENLESS_RELEASE_CHANNEL,
但下面 strategy/runs-on 之后已经有一个 env: 块(TAURI_SIGNING_PRIVATE_KEY 等)。
YAML map 不允许重复 key——GitHub Actions 解析直接 fail,整条 release-tauri.yml
工作流变成 "workflow file issue" 启动失败。

修复:把 OPENLESS_RELEASE_CHANNEL 并到下面那个唯一的 env: 块里,保留完整注释。

校验:
- python -c "yaml.safe_load(...)" 解析成功
- jobs.build.env 现在有 3 个 key: OPENLESS_RELEASE_CHANNEL, TAURI_SIGNING_PRIVATE_KEY,
  TAURI_SIGNING_PRIVATE_KEY_PASSWORD

Co-authored-by: baiqing <lbx12309@icloud.com>
Keep the submodule pinned to the reviewed commit while moving the fetch URL to Open-Less/qwen-asr, then document the review checklist future upgrades must follow.\n\nConstraint: Open-Less#301 identified the personal upstream submodule URL as a supply-chain risk.\nRejected: Updating the submodule commit together with the URL change | would mix provenance hardening with unreviewed upstream code changes.\nConfidence: high\nScope-risk: narrow\nDirective: Do not point .gitmodules back to antirez/qwen-asr; sync upstream into the organization fork and review the diff first.\nTested: gh repo view Open-Less/qwen-asr; git submodule update --init --recursive openless-all/app/src-tauri/vendor/qwen-asr; git diff --check; npm run build; cargo check --manifest-path src-tauri/Cargo.toml\nNot-tested: macOS INSTALL=0 ./scripts/build-mac.sh C-link verification.
…sr-fork

Route qwen-asr submodule through organization fork
Copilot AI review requested due to automatic review settings May 16, 2026 06:24
@rackliu rackliu closed this May 16, 2026
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Partial migration overwrite

This migration helper updates individual fields whenever they still match an old builtin default, even if the pack has already been customized. On upgrade, a builtin pack with a user-edited name but default prompt/tags/examples can still have those remaining fields silently replaced, so part of the user's edits are lost instead of preserving the existing copy.

let legacy_builtin_cn =
    builtin_style_pack_for_mode_with_output_language(pack.base_mode, OutputLanguagePreference::ZhCn);
let legacy_builtin_tw =
    builtin_style_pack_for_mode_with_output_language(pack.base_mode, OutputLanguagePreference::ZhTw);

if (pack.name == legacy_builtin_cn.name || pack.name == legacy_builtin_tw.name)
    && pack.name != builtin.name
{
    pack.name = builtin.name.clone();
    changed = true;
}

if (pack.description == legacy_builtin_cn.description
    || pack.description == legacy_builtin_tw.description)
    && pack.description != builtin.description
{
    pack.description = builtin.description.clone();
    changed = true;
}

if (pack.tags == legacy_builtin_cn.tags || pack.tags == legacy_builtin_tw.tags)
    && pack.tags != builtin.tags
{
    pack.tags = builtin.tags.clone();
    changed = true;
}

let legacy_default_prompt = default_style_system_prompt_for_mode(pack.base_mode);
if (pack.prompt == legacy_default_prompt
    || pack.prompt == legacy_builtin_cn.prompt
    || pack.prompt == legacy_builtin_tw.prompt)
    && pack.prompt != builtin.prompt
{
    pack.prompt = builtin.prompt.clone();
    changed = true;
}

if (pack.examples == legacy_builtin_cn.examples || pack.examples == legacy_builtin_tw.examples)
    && pack.examples != builtin.examples
{
    pack.examples = builtin.examples.clone();
    changed = true;

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

The PR title and description state that this change localizes style pack defaults and migration (zh-CN / zh-TW / en builtin style packs, locale-aware reset/migration, and corresponding frontend i18n wiring). However, the diffs actually shipped only contain bulk Simplified→Traditional Chinese conversions of comments and echo strings inside three helper shell scripts under scripts/. None of the described style-pack, migration, or i18n source changes appear in the diff.

The mechanical S→T conversion also introduced a number of well-known auto-conversion artifacts (e.g., 权限許可權, 扩展擴充套件, 二进制二進位制, 循环迴圈, 子进程子程序, 回归迴歸, 质量質量, 绑定繫結) that are either incorrect or nonstandard in Taiwan-style Traditional Chinese. The confusion-word example list in finding-helper.sh (homophone test data) is also semantically broken by the conversion.

Changes:

  • scripts/finding-helper.sh: comments/echo strings translated to Traditional Chinese
  • scripts/bump-version.sh: comments/echo strings translated to Traditional Chinese
  • scripts/audit-system-level.sh: large architectural-audit report template translated to Traditional Chinese

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 11 comments.

File Description
scripts/finding-helper.sh S→T translation of comments, echo messages, and embedded report template; introduces several mis-conversions and semantically alters the ASR confusion-word example list
scripts/bump-version.sh S→T translation of comments and echo/error messages only; no functional changes
scripts/audit-system-level.sh S→T translation of a large heredoc-embedded markdown audit report; introduces multiple TW-locale terminology issues
Comments suppressed due to low confidence (3)

scripts/finding-helper.sh:201

  • "子程序" is an incorrect S→T conversion for "子进程". In Traditional Chinese, "进程" (process) should be "行程" or kept as "程序" only when meaning "program". The auto-converter rendered "进程" as "程序" producing "子程序", which in Traditional Chinese means "subroutine/subprogram", not "subprocess/child process". The intended meaning here is OS child process; consider "子行程" (TW convention) or "子進程".
    scripts/finding-helper.sh:184
  • Mechanical S→T conversions of confusion-word examples have changed the actual content meaning and broken the test data. The list is meant to enumerate ASR mis-recognitions (e.g., "merge" being misheard as "摸鸡", "release" as "瑞丽丝"). After conversion to "摸雞" / "瑞麗絲" / "西愛" / "批閱", the strings no longer match the real homophones produced by Mandarin ASR for these English terms — they are now phonetically and lexically different from the ASR outputs they're supposed to model. If this list is consumed anywhere as actual confusion-word data, it should not be auto-translated; either keep the original Simplified examples or rewrite the table for a Traditional-Chinese ASR baseline.
    scripts/audit-system-level.sh:226
  • "複製" is acceptable for "拷贝", but consider that this script is documentation only — these mechanical translations of internal architecture-audit notes provide little user-facing value while introducing many subtle terminology errors (覆蓋率 vs 覆蓋率, 實現/實作, 執行時, 擴充套件性, 許可權, 迴圈, 二進位制 etc.). If the goal is to standardise on Traditional Chinese for the project, recommend running the output through a TW-locale review (or the OpenCC s2twp.json profile, which uses Taiwan phrase mappings) rather than the default s2t table that produced these artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/finding-helper.sh
@@ -1,5 +1,5 @@
#!/bin/bash
# Finding 辅助脚本 - 自动收集项目信息用于 EPIC 规划
# Finding 輔助指令碼 - 自動收集專案資訊用於 EPIC 規劃
Comment thread scripts/finding-helper.sh
- [ ] permissions.rs - 权限检查
### 低優先順序(平臺特定
- [ ] hotkey.rs - 熱鍵監聽
- [ ] permissions.rs - 許可權檢查
Comment thread scripts/finding-helper.sh
- [ ] coordinator.rs - 狀態機、會話管理
- [ ] asr/volcengine.rs - WebSocket ASR
- [ ] asr/frame.rs - 二进制帧编解码
- [ ] asr/frame.rs - 二進位制幀編解碼
Comment thread scripts/finding-helper.sh
1. Rust crate 直接绑定(推荐
2. 子进程 + HTTP(备选
### 整合方式
1. Rust crate 直接繫結(推薦
@@ -1,5 +1,5 @@
#!/bin/bash
# 系统级审计脚本 - 发现架构、安全、扩展性问题
# 系統級審計指令碼 - 發現架構、安全、擴充套件性問題
- ⚠️ **cpal 0.15**: 音频库,跨平台兼容性需关注
### 技術棧風險
- ✅ **Tauri 2**: 成熟穩定,社群活躍
- ✅ **Tokio**: 非同步執行時,效能優秀
- ⚠️ **Coordinator 依赖过多**:依赖 8+ 个模块
### 依賴健康度
- ✅ **單向依賴**:所有模組依賴 types,types 不依賴任何模組
- ✅ **無迴圈依賴**:模組間無迴圈依賴
- 新功能质量无保障
- 技术债务累积
**影響**:
- 重構風險高(容易引入迴歸 bug)
- 技术债务累积
**影響**:
- 重構風險高(容易引入迴歸 bug)
- 新功能質量無保障
Comment thread scripts/bump-version.sh
Comment on lines 26 to +99
@@ -38,25 +38,25 @@ CARGO_LOCK="$APP/src-tauri/Cargo.lock"

for f in "$PKG_JSON" "$PKG_LOCK" "$TAURI_CONF" "$CARGO_TOML" "$CARGO_LOCK"; do
if [ ! -f "$f" ]; then
echo "错误:找不到 $f" >&2
echo "錯誤:找不到 $f" >&2
exit 1
fi
done

# package.json + package-lock.json:npm version 一行同步两个,且不打 git tag。
# --allow-same-version 让脚本可重复运行(实际 release flow 不会,但 dry-run 友好)。
# package.json + package-lock.json:npm version 一行同步兩個,且不打 git tag。
# --allow-same-version 讓指令碼可重複執行(實際 release flow 不會,但 dry-run 友好)。
echo "▶ 升 package.json + package-lock.json → $NEW"
( cd "$APP" && npm version "$NEW" --no-git-tag-version --allow-same-version > /dev/null )

# tauri.conf.json:BSD sed GNU sed 都支持 -E + -i.bak 后缀;不用行号范围地址
# tauri.conf.json:BSD sed GNU sed 都支援 -E + -i.bak 字尾;不用行號範圍地址
echo "▶ 升 tauri.conf.json → $NEW"
sed -E -i.bak \
"s/\"version\":[[:space:]]*\"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$NEW\"/" \
"$TAURI_CONF"
rm "$TAURI_CONF.bak"

# Cargo.toml:用 awk 替换文件里第一个 version = "X.Y.Z" 行(顶层 [package].version)。
# 不用 GNU sed 的 `0,/.../` 行号范围地址(macOS BSD sed 不支持)。
# Cargo.toml:用 awk 替換檔案裡第一個 version = "X.Y.Z" 行(頂層 [package].version)。
# 不用 GNU sed 的 `0,/.../` 行號範圍地址(macOS BSD sed 不支援)。
echo "▶ 升 Cargo.toml → $NEW"
awk -v new="$NEW" '
!done && /^version = "[0-9]+\.[0-9]+\.[0-9]+"$/ {
@@ -67,13 +67,13 @@ awk -v new="$NEW" '
' "$CARGO_TOML" > "$CARGO_TOML.tmp"
mv "$CARGO_TOML.tmp" "$CARGO_TOML"

# Cargo.lock:cargo update 显式同步 openless package;失败要立刻退出,不能吞错
# Cargo.lock:cargo update 顯式同步 openless package;失敗要立刻退出,不能吞錯
echo "▶ 同步 Cargo.lock"
( cd "$APP/src-tauri" && cargo update -p openless 2>&1 | tail -5 )

# 校验五处一致(package.json / package-lock.json / tauri.conf.json / Cargo.toml / Cargo.lock)
# 校驗五處一致(package.json / package-lock.json / tauri.conf.json / Cargo.toml / Cargo.lock)
echo
echo "===== 验证版本一致性 ====="
echo "===== 驗證版本一致性 ====="
PKG=$(node -p "require('$PKG_JSON').version")
LOCK_ROOT=$(node -p "require('$PKG_LOCK').version")
LOCK_NESTED=$(node -p "require('$PKG_LOCK').packages[''].version")
@@ -96,14 +96,14 @@ done

if [ "$mismatch" -ne 0 ] || [ "$PKG" != "$NEW" ]; then
echo
echo "::error::版本号未对齐请检查脚本输出" >&2
echo "::error::版本號未對齊請檢查指令碼輸出" >&2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants