|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Reborn Dev
![]() Posts: 5
Karma: 10
Join Date: Aug 2026
Device: Boox Page
|
Offline Translate - translate selected phrases with an NMT engine on the device
I have released a plugin that translates a selected phrase without sending it anywhere.
Select two or more words and the translation appears in a bubble over the selection. Single words are left alone - they go to the StarDict dictionaries, which do that job better. It adds one entry to the selection menu, next to the built-in "Translate", and changes nothing else. The catch, up front: the plugin only ever talks to 127.0.0.1, so something has to answer there, and today that means an Android reader. Translator from F-Droid serves the LibreTranslate API on the device, which is what I use on a Boox. On Kobo and Kindle there is no practical on-device server that I know of - you can point the plugin at a machine on your network, but then the text leaves the reader and the plugin warns you once when you set that up. If anyone knows of something that would run locally on those, I would like to hear it. There is also an optional mode where finishing a selection translates it straight away, skipping the menu. Off by default, and it defers to your own long-press setting if you have changed it. AGPL-3.0, pure Lua, no dependencies beyond what KOReader already ships. Tested on an Onyx Boox Page and the desktop emulator, English and Polish both ways. https://github.com/fundacja-reborn/o...slate-koplugin Bug reports welcome, especially from language pairs I have not tried. Last edited by reapps_eu; Yesterday at 07:54 AM. |
|
|
|
|
|
#2 |
|
Reborn Dev
![]() Posts: 5
Karma: 10
Join Date: Aug 2026
Device: Boox Page
|
I wanted to add some screenshots, but they aren’t displaying in the post, so you can view them in the GitHub repository.
Last edited by reapps_eu; Yesterday at 08:00 AM. |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,829
Karma: 731691
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O, Kobo Libra 2
|
If you click on "Go Advanced" you can upload attachments to a post.
|
|
|
|
|
|
#4 |
|
Reborn Dev
![]() Posts: 5
Karma: 10
Join Date: Aug 2026
Device: Boox Page
|
Update: the part that is meant for learning a language by reading
Thanks Frenzie - "Go Advanced" was exactly what I was missing. Screenshots attached this time, and there is something new to show.
Since the first post the plugin has grown the feature I actually wanted it for. Translate a phrase once and it is remembered. From then on that phrase carries a faint dotted underline wherever it turns up again - in that book and in the next one, because what is stored is a phrase, not a position in a file. A tap on an underlined phrase brings its translation straight back, with nothing to select first. That recurrence is the whole point. Meeting an expression again, recognising that you have met it before, and eventually finding you no longer need the translation is what learning by reading actually looks like, and it is the part a translation window cannot do for you, because it happens between the lookups rather than during one. The bubble carries a Learned button, which forgets the phrase and takes its underline out of every book at once. Deliberately not called "delete": forgetting is what the plugin does, while what you are doing is saying you are done with this one. Tools -> Offline translate -> Remembered translations is the same collection away from the page - what is kept for the language pair you are reading, in alphabetical order, one tap to see a translation and one more to drop it. Both of these are off until you switch them on. Underlining changes what a page looks like, which is the definition of a regression for someone who never asked for it. With it off, nothing about tapping, selecting or turning pages changes. With it on, a tap anywhere that is not an underlined phrase turns the page exactly as before, and a highlight you made yourself still opens KOReader's own menu. Since "it scans your book" is the kind of sentence that would worry me in someone else's post: it does not. There is no background scanning and no per-book state. On a page turn the plugin takes the text of that page, matches it in Lua against the phrases it knows, and only then asks the document to locate the ones actually present, bounded by the number of occurrences it counted - so a search cannot wander off the page. On a Boox Page that costs 1-2 ms per page turn, independent of how many phrases are stored, with the worst case I could build coming in around 10 ms. Measured on the device rather than assumed. Limits worth stating up front: matching is literal, so "the old man" is not recognised in "the old men", and a heavily inflected language will hide more of these than English does. What survives that are short fixed expressions, which is where a phrase translation earns its keep anyway. Underlining works in EPUB and other reflowable formats, not in PDF. Also, thanks to a bug report: when nothing is listening, the failure message now says what to check instead of only naming the address. Attachments, in order: a page with several phrases underlined and one of them tapped; the list of remembered translations; the settings, with both of these switched on. Latest release: https://github.com/fundacja-reborn/o...eleases/latest Still AGPL-3.0, still pure Lua, still nothing on the wire but loopback. |
|
|
|
|
|
#5 |
|
Reborn Dev
![]() Posts: 5
Karma: 10
Join Date: Aug 2026
Device: Boox Page
|
and two more screenshots
|
|
|
|
| Advert | |
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Forma Translate Entire Phrases to English? | enuddleyarbl | Kobo Reader | 17 | 02-02-2025 07:50 AM |
| Is it possible to translate the text? | edcn | Calibre | 2 | 06-13-2019 11:46 PM |
| Translate? | Alpha o | Calibre | 3 | 06-18-2016 08:46 AM |
| help with spanish translate | Alpinador | General Discussions | 2 | 02-28-2014 11:44 AM |
| how to translate Sigil ? | bionet | Sigil | 9 | 06-02-2011 04:07 PM |