diff --git a/.idea/modules.xml b/.idea/modules.xml
index ad7f243..b9bfbef 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -3,6 +3,7 @@
+
\ No newline at end of file
diff --git a/.idea/translation-generator.iml b/.idea/translation-generator.iml
index cf567bb..0469a70 100644
--- a/.idea/translation-generator.iml
+++ b/.idea/translation-generator.iml
@@ -6,5 +6,6 @@
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1dd..099d66c 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/lib/translate.py b/lib/translate.py
index 7119772..36503a5 100644
--- a/lib/translate.py
+++ b/lib/translate.py
@@ -3,30 +3,30 @@ import requests
import time
-def translate(_input):
+def translate(_input, lang='RU'):
url = "https://www2.deepl.com/jsonrpc"
r = requests.post(
url,
- json = {
- "jsonrpc":"2.0",
+ json={
+ "jsonrpc": "2.0",
"method": "LMT_handle_jobs",
"params": {
- "jobs":[{
- "kind":"default",
+ "jobs": [{
+ "kind": "default",
"raw_en_sentence": _input,
- "raw_en_context_before":[],
- "raw_en_context_after":[],
- "preferred_num_beams":4,
- "quality":"fast"
+ "raw_en_context_before": [],
+ "raw_en_context_after": [],
+ "preferred_num_beams": 4,
+ "quality": "fast"
}],
- "lang":{
- "user_preferred_langs":["EN"],
- "source_lang_user_selected":"auto",
- "target_lang":"RU"
+ "lang": {
+ "user_preferred_langs": [lang],
+ "source_lang_user_selected": "auto",
+ "target_lang": "RU"
},
- "priority":-1,
- "commonJobParams":{},
+ "priority": -1,
+ "commonJobParams": {},
"timestamp": int(round(time.time() * 1000))
},
"id": 40890008
diff --git a/main.py b/main.py
index a86736b..0c087b8 100644
--- a/main.py
+++ b/main.py
@@ -1,8 +1,22 @@
#!/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()
@@ -18,6 +32,11 @@ def parsing_file(f):
return _to_translate
-trans_list = parsing_file('weapongenerator.lua')
-print(trans_list)
+test_en = parsing_file(name)[0].split('\"')[1].split(' /*')[0]
+test = translate(test_en)
+print("msgid: \"%s\"" % test_en)
+print("msgstr: \"%s\"" % test)
+
+def all_to_translate():
+ pass