1 Star 0 Fork 1

chawuNG/Retrieval-based-Voice-Conversion-WebUI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
extract_locale.py 725 Bytes
一键复制 编辑 原始数据 按行查看 历史
camenduru 提交于 2年前 . thanks to RVC-Project ❤
import json
import re
# Define regular expression patterns
pattern = r"""i18n\([\s\n\t]*(["'][^"']+["'])[\s\n\t]*\)"""
# Initialize the dictionary to store key-value pairs
data = {}
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
print("processing infer-web.py")
process("infer-web.py")
print("processing gui.py")
process("gui.py")
# Save as a JSON file
with open("./i18n/zh_CN.json", "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=4)
f.write("\n")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chawung/Retrieval-based-Voice-Conversion-WebUI.git
git@gitee.com:chawung/Retrieval-based-Voice-Conversion-WebUI.git
chawung
Retrieval-based-Voice-Conversion-WebUI
Retrieval-based-Voice-Conversion-WebUI
main

搜索帮助