![]() |
#1 |
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Sony PRS-T1
|
offline translator
Hello,
I was using koreader on my android and the first time I was looking to translate a sentence, this message pop-up: "Do you want to turn on Wi-Fi?" So my initial response was to press "turn on" and I was pleasantly surprised to see how quick and well integrated was the online translator with the koreader and how nice it looked on the eink screen. Then, when I was not able to connect to the internet, I tried to use the offline google translator app I have installed, so this time I pressed "cancel" instead of "turn on" and... nothing happened. I realized that there is not a direct option for bringing up an offline translator, so after some exploration I managed to bring it up by choosing the "share" option instead of the "translate" one...but it wasn't the same, it did not pop up but opened a whole new window, load relatively slowly and didn't look sharp on the eink screen. The offline translator worked fine but I miss the overall speed, look and integration from the koreader's default (online only) translator. I know I can just keep the wifi on but more than less I find myself unable to connect to the internet. So my question is: what can I do/modify in order to get the default translator working offline? and/or what can I do/modify in order to get my offline google translator integrated/working similarly to the default one? Any help is much appreciated. |
![]() |
![]() |
![]() |
#2 | ||
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,400
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
Quote:
KOReader supports offline dictionaries with stardict format. You can get a bilingual dict from the program itself but the offered dictionaries are not as good as google translate. KOReader in android can also do queries in 3rd party apps. There're a few supported by default (Colordict and goldendict support overlays, so they won't switch you to a different activity but display an overlay on top of KOReader activity) but if you like the look&feel of KOReader UI is better to use the built-in dictionary. If you manage to find a good offline translator apk you can add support yourself following https://github.com/koreader/koreader...ictionary-list but that won't replace the "translate option" but the "dictionary option". |
||
![]() |
![]() |
![]() |
#3 | |||
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Sony PRS-T1
|
Thanks for the reply.
Quote:
Quote:
Quote:
As a side note, I used the "Customize dictionary list" tutorial to modify the Fora dict query. I have Fora dict installed but when I wanted to use the external dictionary the "Fora" box was disable (grey out), so after an inquiry I found that the dictionaries.lua reads "com.ngc.fora", but in my android the folder's name is "com.ngc.fora.android". So I created a notepad with only this inside: Code:
return { { "Fora", "Fora Dict", false, "com.ngc.fora.android", "search" }, } |
|||
![]() |
![]() |
![]() |
#4 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,400
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Yup, you're confusing a few things.
When you use the "share text" button or the dictionary lookup you're opening other activities. These activities did enable certain filters to let other activities notice they can do things with them (like share, process text or open a document). That's why when you click "share text" you'll be prompted with activities that can handle text sharing (from Whatsapp to Twitter, note taking apps, dictionaries... whatever) All activities have their own UI, because that's what they are (see https://developer.android.com/guide/...tro-activities) What you want needs an application that provides a service, not an activity. That service needs to be available for other activities. If you find an offline translator that provides an service that can be bounded by 3rd party apps (using AIDL, for instance) then we can use its API like we use the API of google translate. |
![]() |
![]() |
![]() |
#5 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,400
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Microsoft Translation Android app has an Api: see https://github.com/MicrosoftTranslat...ster/Readme.md
(Description inin https://github.com/MicrosoftTranslat...or/service/app) With that kind of services is possible to retrieve content and show it inside KOReader. Last edited by pazos; 07-03-2020 at 09:01 AM. |
![]() |
![]() |
![]() |
#6 | ||
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Sony PRS-T1
|
Quote:
Quote:
![]() Well, it was nice while it lasted. Nevertheless, I found that the offline google translator has the feature "tap to translate" where you highlight text in your app (koreader) then press copy and a bubble will appear on the right side of the screen to bring the offline translator as an overlay, so at least it will not need to switch to a different activity. Another thing I found was that there is this app: Translate On Screen/Screen Translate that brings an overlay to any app and can use the offline google translator (no needed so far thanks to google translator "tap to translate" feature). There is also this other app that works as a dictionary and as a translator: U-Dictionary Oxford that also has the overlay display and can do offline translations. That's all from me now, thanks for your help, really appreciated ![]() |
||
![]() |
![]() |
![]() |
#7 |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,400
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Hey aldazo, nice tips with the google translate app!. I didn't know about the "tap to translate" feature. It works well.
I see you have your workflow solved but maybe it is interesting for others: it turns out that you can open Google Translate on top of KOReader activity. That doesn't happen using the SHARE intent but works fine with PROCESS_TEXT intent. Happily KOReader supports these kind of intents too (because it is what Kiwix use and being both opensource we shall not forget Kiwix!). So it is relatively easy to extend the "translate button" behaviour like we extended the "dictionary button" behaviour (ie: providing integration with 3rd party apps). In fact if I create a dictionaries.lua with: Code:
return { { "GTranslate", "Google Translate", true, "com.google.android.apps.translate", "text" }, } I don't plan to implement it myself but I will be happy to help ![]() |
![]() |
![]() |
![]() |
#8 | ||||
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Sony PRS-T1
|
Hello again.
Quote:
Quote:
![]() Quote:
Quote:
In that case one should not use the dictionaries.lua to bring up translators because a dictionary pops up when you select one word, and the main function of a translator is to translate phrases or sentences. It would be better to create a translators.lua that acts as a dictionary.lua but only when you select more than one word and hold the last word for about a second. I cannot imagine how much work would be needed but would be interesting. ![]() Last edited by aldazo; 07-05-2020 at 01:47 AM. |
||||
![]() |
![]() |
![]() |
#9 | |
cosiñeiro
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,400
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
|
Quote:
2. Nope 3. Yes. That's exactly what needs to be implemented. Basically a copy of https://github.com/koreader/koreader/pull/5108/files. The example I gave on the previous post is to show that the platform code is there and works without modifications, but the frontend code to manage third party translators needs to be implemented. |
|
![]() |
![]() |
![]() |
#10 | |
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Sony PRS-T1
|
Well, there go my hopes.
![]() Quote:
![]() |
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,742
Karma: 730681
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
@aldazo That's Lua.
|
![]() |
![]() |
![]() |
#12 |
Enthusiast
![]() Posts: 27
Karma: 10
Join Date: Dec 2011
Device: Sony PRS-T1
|
|
![]() |
![]() |
![]() |
Tags |
translator |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
DeepL.com translator. (ACX) | dtp | Kindle Developer's Corner | 6 | 05-08-2018 02:00 PM |
Ebook reader with translator | Saido | Apple Devices | 0 | 01-23-2015 04:30 AM |
Glo Automatic translator | acex | Kobo Reader | 0 | 08-23-2013 03:43 PM |
PW Bilingual Dictionary / Translator | apeiron75 | Amazon Kindle | 1 | 05-14-2013 05:35 PM |