44 lines
860 B
Python
44 lines
860 B
Python
#!/usr/bin/pyhton3
|
|
import os
|
|
|
|
from lib.translate import translate
|
|
|
|
|
|
name = "weapongenerator.lua"
|
|
|
|
|
|
def _lister(path) -> list:
|
|
_list: list = []
|
|
try:
|
|
for f in os.walk(path):
|
|
_list.extend(f)
|
|
break
|
|
return sorted(_list[2])
|
|
except TypeError:
|
|
pass
|
|
|
|
|
|
def parsing_file(f):
|
|
with open(f) as _f:
|
|
_cached = _f.read()
|
|
|
|
_list = _cached.split('\n')
|
|
_to_translate = []
|
|
|
|
_list = [i for i in _list if i != '']
|
|
for _str in _list:
|
|
if _str.find('%_t') != -1 or _str.find('%_T') != -1:
|
|
_to_translate.append(_str)
|
|
|
|
return _to_translate
|
|
|
|
|
|
test_en = parsing_file(name)[0].split('\"')[1].split(' /*')[0]
|
|
test = translate(test_en)
|
|
translate_entity = ("\n#: %s\nmsgid: \"%s\"\nmsgstr: \"%s\"" % (name, test_en, test))
|
|
print(translate_entity)
|
|
|
|
|
|
def all_to_translate():
|
|
pass
|