changed main
This commit is contained in:
24
lib/opener.py
Normal file
24
lib/opener.py
Normal 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
|
||||
|
||||
|
||||
@@ -16,5 +16,3 @@ def translate(_input, lang='ru'):
|
||||
|
||||
)
|
||||
return r.json()['translatedText']
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user