mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-07 23:27:45 +00:00
update reading dictionaries available for download
This commit is contained in:
parent
0e86978df3
commit
f0d4aaa9c3
1 changed files with 8 additions and 12 deletions
|
@ -65,25 +65,21 @@ def update_dict_list():
|
|||
for line in lines:
|
||||
line = line.strip()
|
||||
if line.startswith("#"):
|
||||
if line == "# Dictionaries":
|
||||
mode = 1
|
||||
elif line == "# Experimental dictionaries":
|
||||
mode = 2
|
||||
else:
|
||||
mode = 0
|
||||
if mode == 0 or not line.startswith("*"):
|
||||
mode = 0
|
||||
if line.startswith("# Dictionaries"):
|
||||
mode = 1
|
||||
if mode == 0 or not line.startswith("|") or line.startswith("| Language |") or line.startswith("| --- |"):
|
||||
continue
|
||||
dict_name = line.split("]")[1].split("(")[1].split(")")[0].split("/")[-1].split(".dict")[0]
|
||||
split = line.split("|")
|
||||
dict_name = split[2].split("]")[1].split("(")[1].split(")")[0].split("/")[-1].split(".dict")[0]
|
||||
(dict_type, locale) = dict_name.split("_", 1)
|
||||
if "_" in locale:
|
||||
sp = locale.split("_")
|
||||
locale = sp[0]
|
||||
for s in sp[1:]:
|
||||
locale = locale + "_" + s.upper()
|
||||
if mode == 2:
|
||||
dicts.append(f"{dict_type},{locale},exp\n")
|
||||
else:
|
||||
dicts.append(f"{dict_type},{locale},\n")
|
||||
exp = "exp" if split[3].strip() == "yes" else ""
|
||||
dicts.append(f"{dict_type},{locale},{exp}\n")
|
||||
target_file = "app/src/main/assets/dictionaries_in_dict_repo.csv"
|
||||
with open(target_file, 'w') as f:
|
||||
f.writelines(dicts)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue