mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2026-03-02 08:11:11 +00:00
fix: i18n导致无法启动 & 增加 --noautoopen 参数 (#39)
* optimize: 精简未用到的配置项并在特征提取初步引入mps * add cmd argument: --noautoopen * fix: i18n * fix * fix * add genlocale workflow * add unitest * fix * fix * fix
This commit is contained in:
@@ -2,26 +2,26 @@ import json
|
||||
import re
|
||||
|
||||
# Define regular expression patterns
|
||||
pattern = r'i18n\([^)]*\)'
|
||||
pattern = r"""i18n\((["'][^"']+["'])\)"""
|
||||
|
||||
# Initialize the dictionary to store key-value pairs
|
||||
data = {}
|
||||
|
||||
# Extract labels from infer-webui.py
|
||||
with open('infer-web.py', 'r', encoding='utf-8') as f:
|
||||
contents = f.read()
|
||||
matches = re.findall(pattern, contents)
|
||||
for match in matches:
|
||||
key = match.strip('()"')
|
||||
data[key] = key
|
||||
def process(fn: str):
|
||||
global data
|
||||
with open(fn, 'r', encoding='utf-8') as f:
|
||||
contents = f.read()
|
||||
matches = re.findall(pattern, contents)
|
||||
for key in matches:
|
||||
key = eval(key)
|
||||
print("extract:", key)
|
||||
data[key] = key
|
||||
|
||||
# Extract labels from gui.py
|
||||
with open('gui.py', 'r', encoding='utf-8') as f:
|
||||
contents = f.read()
|
||||
matches = re.findall(pattern, contents)
|
||||
for match in matches:
|
||||
key = match.strip('()"')
|
||||
data[key] = key
|
||||
print("processing infer-web.py")
|
||||
process('infer-web.py')
|
||||
|
||||
print("processing gui.py")
|
||||
process('gui.py')
|
||||
|
||||
# Save as a JSON file
|
||||
with open('./locale/zh_CN.json', 'w', encoding='utf-8') as f:
|
||||
|
||||
Reference in New Issue
Block a user