mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-15 08:53:53 +08:00
28 lines
746 B
Python
28 lines
746 B
Python
from translator.basetranslator import basetrans
|
|
from myutils.utils import checkmd5reloadmodule
|
|
|
|
|
|
class TS(basetrans):
|
|
def mayreinit(self):
|
|
isnew, module = checkmd5reloadmodule("./userconfig/selfbuild.py", "selfbuild")
|
|
if (not isnew) and self.internal:
|
|
return
|
|
if module:
|
|
self.internal = module.TS("selfbuild")
|
|
|
|
def inittranslator(self):
|
|
self.internal = None
|
|
self.mayreinit()
|
|
|
|
def langmap(self):
|
|
self.mayreinit()
|
|
if not self.internal:
|
|
return {}
|
|
return self.internal.langmap()
|
|
|
|
def translate(self, content):
|
|
self.mayreinit()
|
|
if not self.internal:
|
|
return ""
|
|
return self.internal.translate(content)
|