API Documentation

Main module.

offline_translator.entrypoint(argv=None)[source]

Entrypoint for command line interface.

Parameters:

argv (Sequence[str] | None) –

Return type:

None

class offline_translator.ModelWorker(callback)[source]

Bases: object

Parameters:

callback (Callable[[str], None]) –

__init__(callback)[source]

Nothing to do here.

Parameters:

callback (Callable[[str], None]) –

Return type:

None

load(_ModelWorker__from, _ModelWorker__to, /)[source]

Load language model.

Parameters:
  • _ModelWorker__from (str) –

  • _ModelWorker__to (str) –

Return type:

None

static model_name(_ModelWorker__from, _ModelWorker__to, /)[source]

Get model name from destination and source language.

Parameters:
  • _ModelWorker__from (str) –

  • _ModelWorker__to (str) –

Return type:

str

submit(text)[source]

Translate text.

Parameters:

text (str) –

Return type:

None

update()[source]

Call all callback with the current text.

Return type:

None

close()[source]

Close the worker.

Return type:

None

__del__()[source]

Cleanup object.

Return type:

None

class offline_translator.OfflineTranslator[source]

Bases: Tk

Main view.

__init__()[source]

Instantiate View.

Return type:

None

ask_shortcut()[source]

Create shortcut.

Return type:

None

on_closing()[source]

Handle window closure.

Return type:

None

update_translation(text)[source]

Update the translation.

Parameters:

text (str) –

Return type:

None

loop()[source]

Main loop event.

Return type:

None

set_icon(path)[source]

Set icon on windows.

Parameters:

path (Path) –

Return type:

None

__del__()[source]

Delete the current obtect.

Return type:

None

mainloop(n=0)[source]

Call the mainloop of Tk.

Parameters:

n (int) –

Return type:

None