-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgtlang2.py
134 lines (122 loc) · 4.3 KB
/
gtlang2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
from ast import Try
import json
from re import I
tier = {
'Low': 'Düşük',
'Medium': 'Orta',
'High': 'Yüksek',
'Extreme': 'Ekstrem',
'Insane': 'Çılgın',
'Ludicruous': 'Absürt',
'ZPM': 'ZPM',
'Ultimate': 'Üstün',
'Highly Ultimate': 'Ziyadesiyle Üstün',
'Extremely Ultimate': 'Aşırı Üstün',
'Insanely Ultimate': 'Çılgınca Üstün',
'Mega Ultimate': 'Mega Üstün',
'Extended Mega Ultimate': 'Genişletilmiş Mega Üstün',
'Maximum': 'Maksimum'
}
trvword = {
'Transformer': 'Transformatör',
'Coil': 'Bobin',
'Power Transformer': 'Güç Transformatörü',
'Coil': 'Bobin',
'Solar Panel (Needs cleaning with right click)': 'Güneş Paneli (Sağ tık ile temizlenmesi gerekir)',
'Battery': 'Pil',
'Tesla Transceiver': 'Tesla Alıcısı-Vericisi',
'Buck Converter': 'Sıçrayan Dönüştürücü',
'Locker': 'Dolap',
'Energy Buffer': 'Enerji Tamponu',
'Turbo Charger': 'Turbo Şarj Cihazı',
'Battery Charger': 'Pil Şarj Cihazı',
'Battery Buffer': 'Pil Tamponu',
'Type Filter': 'Tip Filtresi',
'Super Buffer': 'Süper Tampon',
'Regulator': 'Regülatör',
'Recipe Filter': 'Tarif Filtresi',
'Item Distributor': 'Eşya Dağıtıcı',
'Item Filter': 'Eşya Filtresi',
'Chest Buffer': 'Sandık Tamponu',
'Hi-Amp Transformer': 'Y-Amp Transformatör'
}
def is_1d(item):
return not isinstance(item, list) or len(item) == 0
def main():
with open('GregTech.lang', 'r', encoding="utf-8") as f:
lines = f.read().splitlines()
properties = []
rest = []
in_languagefile_category = True
found_material = False
count = 0
for line in lines:
if not in_languagefile_category:
if line.startswith("languagefile {"):
in_languagefile_category = True
continue
# in_languagefile_category == True
if line.startswith("}"):
break
split = line.split("=", 1)
key = split[0]
s_key = f"gt-lang|{key}"
try:
value = split[1]
except:
value = "31haha"
fword = value.split(" Voltage", 1)
if fword[0] in tier and len(fword) > 1:
break
if fword[1].replace(" ","",1) in trvword:
count = count + 1
kelime = " "
if "Voltage" in value:
kelime = " Gerilim "
properties.append({
'key': s_key,
'original': value,
'translation': tier.get(fword[0], '') + kelime + trvword.get(fword[1].replace(" ","",1), ''),
'stage': 5,
'context': s_key + '=' + value,
})
found_material = True
else:
rest.append(s_key + '=' + value)
else:
rest.append(s_key + '=' + value)
for item in tier:
break
if item in value:
for machine in trvword:
if machine in value and "Voltage" not in value and item + " " + machine == value:
count = count + 1
properties.append({
'key': s_key,
'original': value,
'translation': item + " " + machine,
'stage': 5,
'context': s_key + '=' + value,
})
if key == " S:gt.blockores.16071.tooltip":
print(value)
if "tooltip" in key and len(value.split(" ")) == 1:
count = count + 1
properties.append({
'key': s_key,
'original': value,
'translation': value,
'stage': 5,
'context': s_key + '=' + value,
})
print(count)
with open('gtlang.txt', mode="wt", encoding="utf-8") as f:
for line in properties:
f.write(line['context'] + '\n')
with open('GregTech.lang.json', mode="wt", encoding="utf-8") as f:
json.dump(properties, f, ensure_ascii=False, indent=2)
with open('rest.txt', mode="wt", encoding="utf-8") as f:
for line in rest:
f.write(line + '\n')
if __name__ == '__main__':
main()