ogclone-engine/client/lib/engine/bin/ogGlobals.py

35 lines
899 B
Python

#!/usr/bin/python3
import sys
import locale
import importlib
def load_lang (name):
global lang
if name in sys.modules:
return True
elif (spec := importlib.util.find_spec (name)) is not None:
lang = importlib.util.module_from_spec (spec)
sys.modules[name] = lang
spec.loader.exec_module (lang)
return True
else:
#print(f"can't find the {name!r} module")
return False
l = locale.getlocale()[0]
if not l: print (f"couldn't set locale")
if not l or not load_lang (f'lang_{l}'):
if not load_lang ('lang_en_GB'):
raise ModuleNotFoundError (f"can't find the default language module", name=name)
#OPENGNSYS='/opt/opengnsys'
OPENGNSYS='/tmp/opengnsys'
OGLOG=f'{OPENGNSYS}/log'
OGLOGFILE=f'{OGLOG}/192.168.42.42' ## TODO
OGLOGCOMMAND='/tmp/command.log'
OGLOGSESSION='/tmp/session.log'
DEBUG='yes'
TZ='Europe/Madrid'