Add a script to automatically convert locale properties to enum value

This commit is contained in:
Ben Woo committed 2025-04-08 13:30:39 +08:00
1 parent 8b530854f6
commit 67f5e47dc9
2 files changed
+21

No files matched your search

+1
View File
@@ -0,0 +1 @@
out.txt
+20
View File
@@ -0,0 +1,20 @@
filepath = "../src/main/resources/multiverse-core_en.properties"
enumList = []
with open(filepath) as f:
for line in f:
line = line.strip()
if len(line) == 0:
enumList.append("")
elif line.startswith("#"):
enumList.append(line.replace("#", "//"))
else:
parts = line.split("=")
if (len(parts) < 2):
continue
parts = parts[0].split(".")[1:]
enumList.append("_".join([p.upper() for p in parts]) + ",")
with open("out.txt", "w") as f:
f.write("\n".join(enumList))