-
Notifications
You must be signed in to change notification settings - Fork 27
Port to new WebExtension format #66
Comments
It's really nice to finally see progress towards a standard way of building addons! I'm all for it, let's see if the API is complete enough to reproduce the current state of the addon. I don't see any mention of a contextual menu API here, not sure if it's supported yet? https://blog.mozilla.org/addons/2016/04/29/webextensions-in-firefox-48/ |
As far I could see, all the API are here:
Those API work for Firfox (since version 45), Chrome and Opera (since version 33). I checked the development tutorials. It seems we just need to repack and use the right API but it should not be so hard. |
I checked the |
I think you just have to add a parentId in the createProperties object. |
Ah, I didn’t see that, cool! |
Yep, everything should be here to start a port 😉 |
Please increase (with an option) the font size of tooltip translation. |
Should we postpone adding new features until gtranslate is ported to WebExtension? Has anyone started working on that yet? |
@fluks Not me. I didn't had time to look at it. |
@fluks @PerfectSlayer Same, I haven’t tried yet. |
Hello! Are you able to create a webextension with the actual build tools? thankee :) |
Starting from Firefox 57, WebExtensions will be the only supported extension type. Desktop Firefox and Firefox for Android will not load other extension types. |
Hi @nemoload, |
i'm looking into it today. |
@PerfectSlayer I have no problem in working myself on this add-on. I use it on a daily basis and my web browsing experience depends on it. |
ok i did some work, but it looks like there's some problems: Next is there are no events available to notify us the context menu gtranslate item is being expanded, so best we can do is make a translate request to google every time some text is selected and the context menu is opened. This also requires a context-script that will always be watching for these things. I'd like to know what you guys think about this. It also blocks lazy loading the to and from language lists, meaning that for performance reasons it will be 2 lists of languages, one for the "from" and one for the "to" language. Less important, no way to not show "translate page" on single images by looking at the mimetype, see https://bugzilla.mozilla.org/show_bug.cgi?id=1361447 There's a branch on my profile, but it's very much work in progress. |
@nemoload @mote0230 Thanks for your prototype! But it's sad to see the API are still not polished...
For me, I will clearly be a no-go! I won't use an extension that will send to an external service provider any text I'm trying to copy through the context menu. But may be other are okay with this behavior… 😫 |
Not working on it at the moment, if anyone wants to start, no problem for me! I started some time ago to experiment with it, and the things I noted are:
|
And another issue that mozilla need to fix first: display the full text in a tooltip. |
@mote0230 Is that possible? I thought there was a length limitation. |
I opened a bug for the “onMenuOpen” event: https://bugzilla.mozilla.org/show_bug.cgi?id=1390061 |
Yeah i put in a string split function for the max length and \n and then a loop to create the entries. I don't really understand why you need the onMenuOpen. I think all we need is in https://bugzilla.mozilla.org/show_bug.cgi?id=1215376 ? |
There is no need, I missed this link. Closed 👍 |
I created a basic port at https://github.com/marczellm/gtranslate/tree/webextension. If someone is reading this, maybe you could check it out, look for bugs and missing functionality before I do a pull request. What it cannot do because of missing APIs:
What it does differently:
|
You can test it on latest Firefox Nightly. Features to the menus.onShown API are still being added. |
@marczellm how to install it? |
- Clone the GitHub repo locally
- Install Firefox Nightly
- In Firefox Nightly, open about:debugging
- Click „Load temporary Add-on”
- Select any file from the add-on’s directory
|
Does it work on Firefox 58.0.2? |
No
|
Ah.. |
Works. @mote0230 mentioned a way to show a longer text, maybe that could be integrated? Now if the selected text is long, it only shows "Fetching translation...". |
For a long text, Google Translate seems to return no translation in the JSON response, only nulls and empty strings.
Edit: It works in the old version of the addon so there's something I messed up.
|
Starting from @marczellm 's code, i fixed the multiline as in the screenshot in #66 (comment) , and enabled alternative translation and dictionary stuff for single words by default, since i couldn't quickly figure out the options and i have to go outside now. |
I fixed the long text problem |
Dear @bpierre, Firefox 60 launches on 09 May. Would you like us to create a pull request so that you can release the WebExtension version as an update to the existing addon, or should we release it separately, named gtranslateWE or similar? (as happened to some other addons) |
(@mote0230, I intend to pull your changes into my fork and polish its relations to the options screen, but only after 09 May) |
Concerning to comment of @mote0230:
I have just added my comment to the pull request #86, probably it will be more correct to add it here:
|
@achernyakevich Correct me if I'm wrong, but I think if you click any menu item, the menu is dismissed |
I have just tested in my FF 56.0.2 and in FF 59.0 - in both cases if menu item contained submenu then click caused no collapsing but opening of a submenu. I can't perform more reliable checking for case when menu item does not contain submenu items and by clicking it will build submenu and will prevent collapsing of menu in general. But I can expect that In any case, gTranslate already has some submenu. So if we will be able to catch click/press Enter then we could try to rebuild submenu. Having "..." or "(click this item)" text in menu item we could inform user to make a click/press Enter. |
|
The WebExtensions APIs triage for https://bugzilla.mozilla.org/show_bug.cgi?id=1440635 was today , they approved it, and I think they said it shouldn't be too difficult to implement since it's a variation of what is already there. This should mean gtranslate will be able to run in nightly soonish. |
is this project definitely dead or still waiting for some APIs to be implemented? |
The port already works, (I am using it daily,) but with current APIs, every time you select text and right-click, it is sent to Google Translate. This is seen as a privacy risk and so we are waiting for a WebExtension API to be able to defer the request to when our submenu is opened.
|
Please don't let this die |
I don't know the state of dev's on this, but as a user I'm still waiting, thinking of how great gTranslate used to be every time I translate something. As an IT guy I get periodically asked "Is the new version out yet?" |
@marczellm Doesn't latest versions of Firefox it with API improvement? |
@PerfectSlayer Ah no I didn’t know… it’s marked as “incomplete”: So I imagine it will be relisted whenever a new version will be published. I was checking again:
The tooltip issue is not strictly required to make it work: it just means that we’ll have to click in order to see the full translation of long sentences. But I agree with @mote0230 that sending every selected text to Google servers is not acceptable. @marczellm do you know more about the current status of the WebExtensions API? |
confirm, depends on https://bugzilla.mozilla.org/show_bug.cgi?id=1440635 https://github.com/marczellm/gtranslate/tree/webextension here's also a working version minus the privacy thing with selected text + rightclick. |
Maybe someone of us should go and do the needed improvements in Firefox. It's an open source project after all. |
Thank you very much, a question: How do I install this version in Firefox non-developer? |
Hi all,
Mozilla introduce a new way to develop add-on (again). Here comes the WebExtensions.
The main advantages of WebExtension for gTranslate are the following:
But we need to repackage and use the new common API.
There is already some issues that could be fixed with:
And some that could be easier with:
Moreover, this new extension format seems to be largely adopted by browser in the coming month.
It could be a good way to gTranstale to become even more popular throw the other browser.
So what do you think about porting the current add-on ?
The text was updated successfully, but these errors were encountered: