mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-12-23 06:59:40 +01:00
Reformat and rewrite _get_name_params (#57)
* Reformat
* rewrite _get_name_params
* Add workflow for automatic formatting
* Revert "Add workflow for automatic formatting"
This reverts commit 9111c5dbc1.
* revert Retrieval_based_Voice_Conversion_WebUI.ipynb
---------
Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
This commit is contained in:
@@ -7,9 +7,10 @@ pattern = r"""i18n\((["'][^"']+["'])\)"""
|
||||
# Initialize the dictionary to store key-value pairs
|
||||
data = {}
|
||||
|
||||
|
||||
def process(fn: str):
|
||||
global data
|
||||
with open(fn, 'r', encoding='utf-8') as f:
|
||||
with open(fn, "r", encoding="utf-8") as f:
|
||||
contents = f.read()
|
||||
matches = re.findall(pattern, contents)
|
||||
for key in matches:
|
||||
@@ -17,12 +18,13 @@ def process(fn: str):
|
||||
print("extract:", key)
|
||||
data[key] = key
|
||||
|
||||
|
||||
print("processing infer-web.py")
|
||||
process('infer-web.py')
|
||||
process("infer-web.py")
|
||||
|
||||
print("processing gui.py")
|
||||
process('gui.py')
|
||||
process("gui.py")
|
||||
|
||||
# Save as a JSON file
|
||||
with open('./locale/zh_CN.json', 'w', encoding='utf-8') as f:
|
||||
with open("./locale/zh_CN.json", "w", encoding="utf-8") as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||
|
||||
Reference in New Issue
Block a user