mirror of
https://github.com/illian64/llm-translate.git
synced 2026-04-28 11:49:54 +00:00
* book translate * files processing * files processing * files processing * files processing --------- Co-authored-by: APodoinikov <APodoynikov@detmir.ru>
36 lines
923 B
Python
36 lines
923 B
Python
# No Translate dummy plugin, for test / debug
|
|
# author: Vladislav Janvarev
|
|
|
|
import os
|
|
|
|
from tqdm import tqdm
|
|
|
|
from app import params
|
|
from app.app_core import AppCore
|
|
from app.dto import TranslatePluginInitInfo, TranslateStruct
|
|
|
|
plugin_name = os.path.basename(__file__)[:-3] # calculating modname
|
|
|
|
|
|
def start(core: AppCore):
|
|
manifest = { # plugin settings
|
|
"name": "No Translate dummy plugin", # name
|
|
"version": "1.0", # version
|
|
|
|
"translate": {
|
|
"no_translate": (init, translate) # 1 function - init, 2 - translate
|
|
}
|
|
}
|
|
|
|
return manifest
|
|
|
|
|
|
def init(core: AppCore) -> TranslatePluginInitInfo:
|
|
return TranslatePluginInitInfo(plugin_name=plugin_name, model_name="")
|
|
|
|
|
|
def translate(core: AppCore, ts: TranslateStruct):
|
|
for part in tqdm(ts.parts, unit=params.tp.unit, ascii=params.tp.ascii, desc=params.tp.desc):
|
|
part.translate = part.text
|
|
|
|
return ts
|