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

Use translators #42

Closed
avram opened this Issue Oct 10, 2011 · 10 comments

Comments

Projects
None yet
2 participants
@avram
Owner

avram commented Oct 10, 2011

If we wanted, we could embed Rhino to use the existing translators on pages, which would be pretty cool. It looks like most of the work has been done for us, as Simon has done a lot to make translators a pretty self-contained part of Zotero.

@avram

This comment has been minimized.

Owner

avram commented Nov 8, 2011

It looks like getting access to the DOM of pages is going to be messy; we may want to implement this as a Fennec add-on that can send cites to zotero.org or Zandy, as appropriate.

@judeibe

This comment has been minimized.

Contributor

judeibe commented Dec 12, 2011

I have been researching this point. It may be better to just rewrite all the tranlastors into pure java. Jsoup.org could help in reading the dom.

@avram

This comment has been minimized.

Owner

avram commented Dec 12, 2011

Rewriting all the translators in Java is a huge project, and I certainly have no interest in taking it on, mainly because it's a never-ending commitment (there are 349 translators in the repository at present, and they're always being updated).

If we can get the DOM of the page the user is viewing, we can definitely process it using the existing translators and something like Rhino. Even a pure Java solution wouldn't have access to the current DOM-- so that's the critical moment. We can get the URL of the current page (as the current iteration of saving webpages does)-- so we could just do a new request, but we that will fail whenever cookies are needed too, which is a lot of the time.

@judeibe

This comment has been minimized.

Contributor

judeibe commented Dec 12, 2011

I see, besides using an internal browser. There is no real way to do this on the default android browser besides writing a plugin, which is undocumented and requires ndk.

@avram

This comment has been minimized.

Owner

avram commented Dec 12, 2011

Right. The first attempt at doing this might well mean loading the page by URL in a hidden WebView within Zandy, which we can use as our JavaScript execution environment for the translators; we can model the translator execution off of the existing Chrome extension code. Then, if we find that cookie issues are particularly common, we can try to turn that into a full-fledged browser. But I'd rather avoid writing a new browser unless it's really vital to make this work.

@judeibe

This comment has been minimized.

Contributor

judeibe commented Dec 12, 2011

On the phone app a full browser seems much. But say a Android Tablet app, it makes more sense to include one.

@avram

This comment has been minimized.

Owner

avram commented Dec 12, 2011

I can see that, but it's a little early to worry about whether a browser should be embedded -- we have to see if we can get translators running with even a basic WebView first!

@judeibe

This comment has been minimized.

Contributor

judeibe commented Dec 12, 2011

Actually I was thinking if a plugin was made, Dolphin Browser would be where to use it. Firefox is getting rid of the xul based browser in a rewrite and wont support plugins in the new release. A new plugin system for mobile will be made, but know one knows what that would entail.

@judeibe

This comment has been minimized.

Contributor

judeibe commented Dec 14, 2011

After some thought on the best way to bring this to the default browser and keep the use of the java script. I was thinking you can either do something like Read it later, which takes the share intent. Sends it to a server process any login's then sends the data back to the phone. I was thinking a java script bookmarklet that captures the dom sends it to a google app account we could process it there or push the dom to the phone and let the phone do it. Using a server to process the dom would lessen the amount of updates to the app for translators. Since all translating is done server side.

@avram

This comment has been minimized.

Owner

avram commented Dec 14, 2011

Cool! If we do this with a real bookmarklet, we may be able to use the Zotero bookmarklet code without modifications, which would be pretty cool. The code is here: https://github.com/zotero/zotero-connectors/tree/master/bookmarklet

I have never used the bookmarklet, but it's supposed to save the item to the Zotero server via the API.

@avram avram closed this Oct 10, 2017

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