#!/usr/bin/env python # -*- coding: utf-8 -*- from os.path import dirname as directory_name from os.path import abspath as path_absolute from os.path import exists as path_exists from re import compile as re_compile from traceback import print_exc as print_trace_exception from json import loads as json_decode root = directory_name(path_absolute(__file__)) is_dos = "\\" in root slash = "\\" if is_dos else "/" root += slash re_slashes = re_compile(r'[\\\\\/]+') texts_file = "LibreTranslatePlus.py.i18n.espanol.json" texts_path = root + "../JSON/I18N/" + texts_file ltp_basic_texts = None if path_exists(texts_path): with open(texts_path, "r") as opened: try: ltp_basic_texts = json_decode(opened.read()) print("[ OK ] " + texts_file) except: print("[EXCE] " + texts_file) else: print("[FAIL] " + texts_file) for file_name in ( "Application/LibreTranslatePlus.py", "Abstracts/LibreTranslatePlus.Abstracts.Base.py", "Abstracts/LibreTranslatePlus.Abstracts.Models.py", "Abstracts/LibreTranslatePlus.Abstracts.Drivers.py", "Application/LibreTranslatePlus.Settings.py", "Application/LibreTranslatePlus.I18N.py", "Application/LibreTranslatePlus.Threads.py", "Application/LibreTranslatePlus.Terminal.py", "Application/LibreTranslatePlus.Connections.py", "Application/LibreTranslatePlus.Models.py", "Drivers/LibreTranslatePlus.Drivers.LibreTranslate.py", "Drivers/LibreTranslatePlus.Drivers.Googletrans.py", "Drivers/LibreTranslatePlus.Drivers.TGWUI.py", "Models/LibreTranslatePlus.Models.KJSON.py", ): path = root + re_slashes.sub(slash, file_name) if path_exists(path): try: with open(path, "rb") as data: exec(compile(data.read(), file_name, "exec"), globals()) print("[ OK ] " + file_name) except: print("[ERRO] " + file_name) print_trace_exception() else: print("[FAIL] " + file_name)