Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Add custom URL with search term as dictionary #8744

Open
costis-t opened this issue Jan 29, 2022 · 7 comments
Open

FR: Add custom URL with search term as dictionary #8744

costis-t opened this issue Jan 29, 2022 · 7 comments

Comments

@costis-t
Copy link

A while ago I discovered KOReader and it seems nearly fantastic for language learning. I would like to have support for various online dictionaries. Is this possible?

For instance, I would like to look up a word in WordReference. Say the word is "test", then I would like to have the option with one click to view the results of https://www.wordreference.com/enis/test, in essense, https://www.wordreference.com/enis/ + search_term
Ideally, I would like to view the result within KOReader, but KOReader could also open a browser pointing at a specific URL.

Is there a quick work-around for this feature?

@costis-t costis-t changed the title FR: [Add custom URL with search term as dictionary] FR: Add custom URL with search term as dictionary Jan 29, 2022
@Frenzie
Copy link
Member

Frenzie commented Jan 29, 2022

The ideal is generally if there's an API, which someone would have to implement.

There are some other inferior options, like grabbing the content of a page and displaying it in a ScrollHTMLWidget. It occurs to me that with @zwim's new terminal emulator, you can also use console browsers like Lynx or Links2.

Screenshot_2022-01-29_10-30-37

@pazos
Copy link
Member

pazos commented Jan 29, 2022

There's another workaround for devices that support 3rd party apps (android & desktop): just define an app that uses an url. Pretty much like https://github.com/koreader/koreader/blob/master/frontend/device/sdl/device.lua#L29

I remember that I played with wordreference when I implemented the url handling. Keeping with the example that would be something like:

{ "WordReference", "WordReference", false, "https://www.wordreference.com/enis/" }

Then that url will be joined with the search term and the url opened in the browser. It should work as is in linux and mac. It should be easy to do the same on android.

@Frenzie
Copy link
Member

Frenzie commented Jan 29, 2022

I figure the question's not about those platforms, but that's nevertheless an interesting suggestion for Android in particular. 👍

@costis-t
Copy link
Author

costis-t commented Jan 29, 2022

Too many unknown words in the responses. :)

It seems too complicated at the moment.

Right now, I click on a word and a window within KOReader opens with the dictionary definition (having google-translate or bing translate as a further option would also be nice for missing words). Minimizing clicks/swipes for finding the meaning of a word is critical for language learning and KOReader is very good with that already, but it could easily be perfect, I reckon!

I thought there was a workaround (inferior solution) for words not existing in the dictionaries -- and these are a lot!
It would work as one of those:

  • A. Long click on a word and insert a custom option along with the "Translate", "View HTML", "Share Text", etc...
  • B1. This option is connected to a command like "google-chrome https://www.wordreference.com/enis/test" which opens the browser in my android e-reader OR
  • B2. connected to a command which opens a window within KOReader and shows me:
    • perhaps a custom regex/sed output of the online dictionary's web page source code OR
    • perhaps scrape the web page with lua --- for wordreference show the elements with the 'FrWrd' class OR
    • perhaps I could just have a mini-browser or a mini text-viewer and have it get and show a file from a custom web-server (I could for instance do the parsing there and have it just return a .txt with the meaning(s) of the word - I don't know how real-time this solution can be, but it's just a thought)

@Frenzie
Copy link
Member

Frenzie commented Jan 29, 2022

Well, what I was saying is that thanks to @zwim you can now do this (that's tweakers.net in Elinks on my H2O):
Reader_2022-01-29_184437

@poire-z
Copy link
Contributor

poire-z commented Jan 29, 2022

Hope we won't be shipping lynx or curl and now solve all fancies issues with terminal commands, just because we can :)

To original poster: try Translate among the highlight buttons, it can give some definitions (dunno for which languages this is supported, but it works with English and French):

image

@Frenzie
Copy link
Member

Frenzie commented Jan 29, 2022

Hope we won't be shipping lynx or curl and now solve all fancies issues with terminal commands, just because we can :)

Certainly not! 🤣 Still, I enjoy it. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants