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:
Ftps
2023-04-15 20:44:24 +09:00
committed by GitHub
parent aaa893c4b1
commit c8261b2ccc
45 changed files with 4878 additions and 2456 deletions

View File

@@ -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)