Skip to content

Commit 27a3780

Browse files
committed
ui: add language switcher
1 parent ce37ed6 commit 27a3780

7 files changed

Lines changed: 525 additions & 103 deletions

File tree

configs/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"language": "zh_CN",
23
"device": "cuda",
34
"sample_rate": 48000,
45
"hop_length": 160,
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# v1.2.1 Language Release Implementation Plan
2+
3+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4+
5+
**Goal:** Add a Chinese/English UI language selector and publish v1.2.1 from current local `master`.
6+
7+
**Architecture:** Reuse the existing `i18n/*.json` pattern and `ui.app:t()` lookup. Locale is read from `configs/config.json` during startup and saved through a Gradio dropdown with an explicit restart-required status.
8+
9+
**Tech Stack:** Python 3.10, Gradio 3.50.2, unittest/pytest-compatible tests, GitHub CLI, Hugging Face CLI.
10+
11+
---
12+
13+
### Task 1: Locale Configuration Tests
14+
15+
**Files:**
16+
- Create: `tests/test_ui_language.py`
17+
- Modify: `ui/app.py`
18+
- Create: `i18n/en_US.json`
19+
20+
- [ ] **Step 1: Write the failing tests**
21+
22+
Create tests that import `ui.app`, assert default locale selection, reject unsupported locales, save language to a temp config file, and require English translation keys.
23+
24+
- [ ] **Step 2: Run tests to verify they fail**
25+
26+
Run: `python -m pytest tests/test_ui_language.py -q`
27+
Expected: fail because helper functions and English pack are not implemented.
28+
29+
- [ ] **Step 3: Implement minimal locale support**
30+
31+
Add `SUPPORTED_LANGUAGES`, config-driven `get_configured_language`, `save_language_setting`, and load `i18n` from the configured language. Add `i18n/en_US.json`.
32+
33+
- [ ] **Step 4: Run tests to verify they pass**
34+
35+
Run: `python -m pytest tests/test_ui_language.py -q`
36+
Expected: pass.
37+
38+
### Task 2: Gradio UI Selector
39+
40+
**Files:**
41+
- Modify: `ui/app.py`
42+
- Modify: `i18n/zh_CN.json`
43+
- Modify: `i18n/en_US.json`
44+
45+
- [ ] **Step 1: Add selector labels to tests**
46+
47+
Extend `tests/test_ui_language.py` to assert both language packs include `language`, `save_language`, and `language_saved_restart` settings keys.
48+
49+
- [ ] **Step 2: Run tests to verify they fail**
50+
51+
Run: `python -m pytest tests/test_ui_language.py -q`
52+
Expected: fail until translation keys exist.
53+
54+
- [ ] **Step 3: Add selector UI**
55+
56+
Place a compact language dropdown near the top and a matching Settings control. Saving updates config and returns restart-required text.
57+
58+
- [ ] **Step 4: Run tests and import check**
59+
60+
Run: `python -m pytest tests/test_ui_language.py tests/test_quality_policy.py::SourceRegressionTests::test_ui_only_exposes_strict_sota_vc_preprocess_modes -q`
61+
Run: `python -c "import ui.app; print(ui.app.get_configured_language())"`
62+
Expected: both commands exit 0.
63+
64+
### Task 3: Release
65+
66+
**Files:**
67+
- Git metadata and remote release state.
68+
69+
- [ ] **Step 1: Inspect diff and status**
70+
71+
Run: `git status -sb` and `git diff --stat`.
72+
73+
- [ ] **Step 2: Commit language changes**
74+
75+
Run: `git add docs/superpowers/specs/2026-05-17-v1.2.1-language-release-design.md docs/superpowers/plans/2026-05-17-v1.2.1-language-release.md tests/test_ui_language.py i18n/en_US.json i18n/zh_CN.json ui/app.py configs/config.json`
76+
Run: `git commit -m "ui: add language switcher"`
77+
78+
- [ ] **Step 3: Push and release**
79+
80+
Run: `git push origin master`
81+
Run: `gh release create v1.2.1 --target master --title "AI-RVC v1.2.1" --notes-file <release-notes-file>`
82+
83+
- [ ] **Step 4: Sync Hugging Face Space**
84+
85+
Run: `hf upload mason369/AI-RVC . --repo-type space --commit-message "Release v1.2.1" --exclude ...`
86+
87+
- [ ] **Step 5: Check package workflow**
88+
89+
Run: `gh run list --workflow "Build Executables" --limit 5`
90+
Wait for the v1.2.1 workflow and report release assets status.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# v1.2.1 Language Release Design
2+
3+
## Goal
4+
5+
Release AI-RVC v1.2.1 from the current local `master` branch, adding a visible Chinese/English language selector and publishing matching GitHub and Hugging Face Space versions.
6+
7+
## Approach
8+
9+
The UI already centralizes most labels through `i18n/zh_CN.json` and `ui/app.py:t()`. Add `i18n/en_US.json`, store the selected locale in `configs/config.json`, and load that locale at startup. Because Gradio 3 builds component labels statically, changing the selector saves the preference and shows an explicit restart-required message instead of pretending to hot-swap all labels.
10+
11+
## UI Behavior
12+
13+
Add a language selector near the top of the app and in Settings. Choices are `中文` and `English`. Saving writes `language` to `configs/config.json`; unsupported locale values fail explicitly and do not silently fall back.
14+
15+
## Release Behavior
16+
17+
Publish from the current local `master`: run targeted tests, commit language changes, push `master`, create GitHub Release/tag `v1.2.1`, let the existing `Build Executables` workflow build portable packages, and sync the same source to Hugging Face Space `mason369/AI-RVC`.
18+
19+
## Verification
20+
21+
Use test-first coverage for locale config loading, language option validation, English pack existence, and save behavior. After implementation, run the targeted tests plus a `ui.app` import check before committing and publishing.

i18n/en_US.json

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{
2+
"app_title": "RVC AI Cover",
3+
"app_description": "AI song cover system based on RVC v2",
4+
"tabs": {
5+
"models": "Model Management",
6+
"cover": "Song Cover",
7+
"settings": "Settings"
8+
},
9+
"ui": {
10+
"cover_usage": "**One-click AI Cover**: upload a song → separate vocals → convert the voice → mix the accompaniment → export the cover\n\n**Steps:**\n1. Download a character model first (open \"Download Character Model\" below)\n2. Upload a song file (MP3/WAV/FLAC)\n3. Choose a downloaded character\n4. Adjust parameters and click \"Start Cover\"\n\n> ⚠️ First launch downloads the Mel-Band Roformer vocal separation model automatically (about 200 MB). Please wait patiently.",
11+
"series_filter": "Series / Category",
12+
"keyword_search": "Keyword Search",
13+
"keyword_placeholder": "Character or series name",
14+
"character_choice_info": "The list shows version tags, character ownership, and model source. In versions, epochs means training epochs, while 40k/48k means sample rate.",
15+
"download_character_info": "The list shows version tags, character ownership, and source repositories so you can distinguish different models for the same character.",
16+
"refresh_models": "Refresh Model List",
17+
"download_selected_character": "Download Selected Character",
18+
"download_series_all": "Download This Category",
19+
"download_all_characters": "Download All Character Models",
20+
"download_status": "Download Status",
21+
"model_name": "Model Name",
22+
"model_path": "Model Path",
23+
"index_path": "Index Path",
24+
"no_models": "(No models)",
25+
"positive_pitch_info": "Positive raises pitch, negative lowers it",
26+
"normal_volume_info": "100% keeps original volume",
27+
"reverb_info": "Adds reverb to the vocals"
28+
},
29+
"conversion": {
30+
"model_settings": "Model Settings",
31+
"select_model": "Select Model",
32+
"refresh": "Refresh",
33+
"load_model": "Load Model",
34+
"status": "Status",
35+
"audio_input": "Audio Input",
36+
"upload_audio": "Upload Audio",
37+
"conversion_params": "Conversion Parameters",
38+
"pitch_shift": "Pitch Shift (semitones)",
39+
"pitch_shift_info": "Positive raises pitch, negative lowers it. Male to female often uses +12; female to male often uses -12",
40+
"f0_method": "F0 Extraction Method",
41+
"f0_method_info": "rmvpe gives the highest quality (recommended)",
42+
"index_rate": "Index Rate",
43+
"index_rate_info": "Higher values sound closer to the training voice, but may reduce clarity",
44+
"filter_radius": "Median Filter Radius",
45+
"filter_radius_info": "Helps reduce breath noise",
46+
"rms_mix_rate": "Loudness Envelope Mix",
47+
"rms_mix_rate_info": "Closer to 1 uses more of the output loudness envelope",
48+
"protect": "Unvoiced Protection",
49+
"protect_info": "Protects consonants and breath sounds; 0.5 means no protection",
50+
"start_conversion": "Start Conversion",
51+
"conversion_result": "Conversion Result",
52+
"conversion_status": "Conversion Status"
53+
},
54+
"cover": {
55+
"song_cover": "AI Song Cover",
56+
"cover_description": "Upload a song, choose a character, and generate an AI cover. The pipeline separates vocals, converts the voice, and mixes the accompaniment automatically.",
57+
"upload_song": "Upload Song",
58+
"input_song": "Input Song (MP3/WAV/FLAC)",
59+
"select_character": "Select Character",
60+
"character": "Character",
61+
"conversion_settings": "Conversion Settings",
62+
"pitch_shift": "Pitch Shift (semitones)",
63+
"index_rate": "Index Rate (%)",
64+
"index_rate_info": "Recommended: 30-45%; too low sounds more synthetic, too high may blur articulation",
65+
"speaker_id": "Speaker ID",
66+
"speaker_id_info": "Single-character models usually use 0; try other IDs for multi-speaker models",
67+
"mix_settings": "Mix Settings",
68+
"mix_preset": "Mix Preset",
69+
"mix_preset_info": "Apply a mix profile suitable for most songs",
70+
"mix_preset_universal": "Universal (recommended)",
71+
"mix_preset_vocal": "Vocal Focus",
72+
"mix_preset_accompaniment": "Accompaniment Focus",
73+
"mix_preset_live": "Live Feel (more reverb)",
74+
"vocals_volume": "Vocal Volume (%)",
75+
"accompaniment_volume": "Accompaniment Volume (%)",
76+
"vocals_reverb": "Vocal Reverb (%)",
77+
"rms_mix_rate": "Loudness Envelope Match (%)",
78+
"rms_mix_rate_info": "Moderately follows the original vocal loudness contour; recommended: 10-30%",
79+
"backing_mix": "Original Lead Vocal Blend (%)",
80+
"backing_mix_info": "Blend a small amount of original lead vocal to restore thickness and articulation; too high leaks the source timbre",
81+
"karaoke_separation": "Harmony Separation",
82+
"karaoke_separation_info": "Separate lead and backing vocals, convert only the lead, and preserve original harmonies. Useful for songs with backing vocals",
83+
"karaoke_merge_backing": "Blend Backing Vocals Into Accompaniment",
84+
"karaoke_merge_backing_info": "Mix separated original backing vocals back into the accompaniment. Enabled by default to preserve harmony layers",
85+
"start_cover": "Start Cover",
86+
"progress": "Progress",
87+
"results": "Cover Results",
88+
"final_cover": "Final Cover",
89+
"converted_vocals": "Converted Vocals",
90+
"original_vocals": "Original Vocals (Separated)",
91+
"lead_vocals": "Lead Vocals",
92+
"backing_vocals": "Backing Vocals",
93+
"accompaniment": "Accompaniment",
94+
"download_character": "Download Character Model",
95+
"select_to_download": "Select Character to Download",
96+
"download": "Download",
97+
"vc_preprocess_mode": "VC Preprocess Strategy",
98+
"vc_preprocess_mode_info": "Strictly uses RoFormer De-Reverb SOTA; if unavailable, processing stops instead of degrading",
99+
"vc_preprocess_auto": "Auto (recommended)",
100+
"vc_preprocess_uvr_deecho": "Strict RoFormer De-Reverb",
101+
"source_constraint_mode": "Source Constraint Strategy",
102+
"source_constraint_mode_info": "Auto (recommended) enables this only for strict RoFormer De-Reverb preprocessing; if unavailable, processing stops instead of degrading",
103+
"source_constraint_auto": "Auto (recommended)",
104+
"source_constraint_off": "Off",
105+
"source_constraint_on": "Always On",
106+
"vc_preprocess_status": "Current VC Preprocess Route",
107+
"vc_preprocess_status_info": "Shows the actual route this machine will use in auto mode",
108+
"vc_pipeline_mode": "VC Pipeline Mode",
109+
"vc_pipeline_mode_info": "Current implementation keeps this project's existing path; official mode calls the bundled official RVC directly and skips custom VC pre/post-processing",
110+
"vc_pipeline_mode_current": "Current Implementation (recommended)",
111+
"vc_pipeline_mode_official": "Official Implementation (1:1)",
112+
"singing_repair": "Singing Repair",
113+
"singing_repair_info": "For high-note dropouts, tearing, metallic artifacts, and sibilance. When enabled, this exits strict 1:1 mode and uses the official-compatible repair path (FP32 + hybrid F0 + F0 stabilization/rate limiting)"
114+
},
115+
"models": {
116+
"base_models": "Base Models",
117+
"base_models_desc": "These models are required to run RVC and must be downloaded before first use.",
118+
"check_status": "Check Model Status",
119+
"download_required": "Download Required Models",
120+
"model_status": "Model Status",
121+
"voice_models": "Voice Models",
122+
"voice_models_desc": "Put .pth model files into assets/weights/, then refresh the model list.",
123+
"mature_deecho_models": "Mature DeEcho Models",
124+
"mature_deecho_models_desc": "Current covers strictly use RoFormer De-Reverb SOTA; if unavailable, processing stops instead of degrading to older models or algorithm chains.",
125+
"download_mature_deecho": "Download Mature DeEcho Model",
126+
"mature_deecho_status": "Mature DeEcho Status",
127+
"mature_deecho_check": "Check Mature DeEcho Status"
128+
},
129+
"settings": {
130+
"language_settings": "Language Settings",
131+
"language": "Interface Language",
132+
"save_language": "Save Language",
133+
"language_saved_restart": "✅ Interface language saved: {language}. Please restart the app for it to take effect.",
134+
"language_restart_info": "The language choice is saved to the config file. Because Gradio 3 builds UI labels at startup, restart the app to apply it.",
135+
"runtime_settings": "Runtime Settings",
136+
"compute_device": "Compute Device",
137+
"save_settings": "Save Settings",
138+
"settings_saved_restart": "✅ Settings saved. Restart the app for changes to take effect.",
139+
"status": "Status",
140+
"cpu_slow": "CPU (slow)",
141+
"about_body": "**RVC AI Cover System**\n\n- Built on RVC v2 + Mel-Band Roformer\n- Uses RMVPE for high-quality F0 extraction\n- Supports CUDA GPU acceleration\n\n[GitHub](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)",
142+
"model_sources": "### 📥 Character Model Sources\n\nThese are the Hugging Face repositories used by the built-in character model list. You can also download models manually and place them under `assets/weights/characters/<character_name>/`:\n\n**Love Live! Series**\n- [trioskosmos/rvc_models](https://huggingface.co/trioskosmos/rvc_models) — μ's / Aqours / Nijigasaki / Liella! characters\n- [Icchan/LoveLive](https://huggingface.co/Icchan/LoveLive) — Chika, Riko, Eli, You\n- [0xMifune/LoveLive](https://huggingface.co/0xMifune/LoveLive) — Nijigasaki / Liella! / Hasunosora\n- [Swordsmagus/Love-Live-RVC](https://huggingface.co/Swordsmagus/Love-Live-RVC) — Hanamaru, Setsuna, Kotori, A-RISE, and more\n- [Zurakichi/RVC](https://huggingface.co/Zurakichi/RVC) — Nico, Kanata, Setsuna, Hanamaru\n- [Phos252/RVCmodels](https://huggingface.co/Phos252/RVCmodels) — Shibuya Kanon\n- [ChocoKat/Mari_Ohara](https://huggingface.co/ChocoKat/Mari_Ohara) — Mari Ohara\n- [HarunaKasuga/YoshikoTsushima](https://huggingface.co/HarunaKasuga/YoshikoTsushima) — Yoshiko Tsushima\n- [thebuddyadrian/RVC_Models](https://huggingface.co/thebuddyadrian/RVC_Models) — Kazuno sisters\n\n**Genshin / Honkai / Zenless Zone Zero (HoYoverse)**\n- [makiligon/RVC-Models](https://huggingface.co/makiligon/RVC-Models) — Furina, Ayaka, Focalors\n- [kohaku12/RVC-MODELS](https://huggingface.co/kohaku12/RVC-MODELS) — Nahida, Herta, Firefly, Tingyun, Hoshimi Miyabi, and more\n- [jarari/RVC-v2](https://huggingface.co/jarari/RVC-v2) — Furina (Korean), Silver Wolf (Korean)\n- [mrmocciai/genshin-impact](https://huggingface.co/mrmocciai/genshin-impact) — 50+ Genshin characters (manual download)\n\n**VOCALOID**\n- [javinfamous/infamous_miku_v2](https://huggingface.co/javinfamous/infamous_miku_v2) — Hatsune Miku (1000 epochs)\n\n**Hololive / VTuber**\n- [megaaziib/my-rvc-models-collection](https://huggingface.co/megaaziib/my-rvc-models-collection) — Pekora, Sakura Miko, Subaru, Kobo, Kaela, and more\n- [Kit-Lemonfoot/kitlemonfoot_rvc_models](https://huggingface.co/Kit-Lemonfoot/kitlemonfoot_rvc_models) — Hololive JP/EN characters\n\n**THE IDOLM@STER / Uma Musume**\n- [trioskosmos/rvc_models](https://huggingface.co/trioskosmos/rvc_models) — Ranko Kanzaki, Riamu Yumemi\n- [makiligon/RVC-Models](https://huggingface.co/makiligon/RVC-Models) — Takane Shijou, Rice Shower\n\n**Project SEKAI**\n- [kohaku12/RVC-MODELS](https://huggingface.co/kohaku12/RVC-MODELS) — Nene Kusanagi\n\n> 💡 After manual download, put `.pth` and `.index` files under `assets/weights/characters/<character_name>/`, then refresh the list.",
143+
"device_info": "Device Information",
144+
"current_device": "Current Device",
145+
"refresh_device": "Refresh Device Information",
146+
"about": "About"
147+
},
148+
"messages": {
149+
"model_loaded": "Model loaded",
150+
"model_not_found": "Model not found",
151+
"load_failed": "Load failed",
152+
"please_select_model": "Please select a model",
153+
"please_load_model": "Please load a model first",
154+
"please_upload_audio": "Please upload an audio file",
155+
"conversion_complete": "Conversion complete",
156+
"conversion_failed": "Conversion failed",
157+
"download_complete": "Download complete",
158+
"download_failed": "Download failed",
159+
"cover_complete": "Cover complete",
160+
"cover_failed": "Cover failed",
161+
"separating_vocals": "Separating vocals...",
162+
"converting_vocals": "Converting vocals...",
163+
"mixing_audio": "Mixing audio..."
164+
}
165+
}

0 commit comments

Comments
 (0)