changed main

This commit is contained in:
bacon
2023-09-01 14:06:11 +03:00
parent 8ac3a092b7
commit 0039f9ff29
4 changed files with 49 additions and 44 deletions

24
lib/opener.py Normal file
View File

@@ -0,0 +1,24 @@
import json
import os
def scan_files(path) -> list:
"""
Scans dirs and subdirs in PATH to gind *.lua files
:param path: set path to scan
:return: list of files in dir and subdir
"""
list_files = []
for root, dirs, files in os.walk(path):
for file in files:
if '.lua' in file: list_files.append(f'{root}/{file}')
return list_files
def open_translate(lang='ru'):
with open(f'{lang}.po', 'r') as f:
_read = f.read()
return _read

View File

@@ -16,5 +16,3 @@ def translate(_input, lang='ru'):
)
return r.json()['translatedText']