41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
if "LibreTranslatePlus" not in globals():
|
|
class LibreTranslatePlus:pass
|
|
if not hasattr(LibreTranslatePlus, "Abstracts"):
|
|
class Subanonymous:pass
|
|
LibreTranslatePlus.Abstracts = Subanonymous
|
|
del globals()["Subanonymous"]
|
|
|
|
class Anonymous(LibreTranslatePlus.Abstracts.Base): # LibreTranslatePlus.Abstracts.Drivers
|
|
|
|
__unknown_driver = None
|
|
|
|
def __init__(self, ltp, _input):
|
|
super().__init__(ltp)
|
|
|
|
if LibreTranslatePlus.Abstracts.Drivers.__unknown_driver == None:
|
|
LibreTranslatePlus.Abstracts.Drivers.__unknown_driver = self.settings("connections_unknown_driver")
|
|
|
|
self.__driver = self.settings("type", _input) or LibreTranslatePlus.Abstracts.Drivers.__unknown_driver
|
|
self.__key = self.settings("key", _input)
|
|
self._print_variables = {
|
|
"key" : self.__key,
|
|
"driver" : self.__driver
|
|
}
|
|
|
|
def languages(self):
|
|
self._print("warn", "ltp_connections_drivers_not_implemented", {
|
|
**self._print_variables,
|
|
"method" : "languages"
|
|
})
|
|
|
|
def translate(self, text, _from, to, format = None):
|
|
self._print("warn", "ltp_connections_drivers_not_implemented", {
|
|
**self._print_variables,
|
|
"method" : "translate"
|
|
})
|
|
|
|
LibreTranslatePlus.Abstracts.Drivers = Anonymous
|
|
del globals()["Anonymous"] |