Skip to content

Instantly share code, notes, and snippets.

@OverPoweredDev
Last active Dec 19, 2021
Embed
What would you like to do?

GSoC 2021 Report - Apertium Webext

Or more appropriately, a report of the work I've done on it. This gist is the Work Product Submission for the progress on my GSoC'21 Project, Apertium Webext. The project was completed in 3 months, from June to August of 2021 and mentored by Tino Didriksen.


Important Links


Progress Checklist

  • Create an extension
    • Extension has required elements: pop-up, background page, content scripts and the settings page
    • Extension must work across browsers (yay Chromium!)
  • Add Translation Features to the extension
    • Translate between an existing language pair in the extension pop-up
    • Translate a word or phrase that the user hovers on on a website
    • Add Contextual Translation as well for hover-on gists
    • Translate an entire webpage at a time
  • Enable settings for the user
    • Create a settings page accessible from the extension menu
    • Add an option to select the default translate-to language
    • Allow switching of the Apertium Source (Release/Beta/Local)
    • Allow Editing of the website list for default hover-on gists
  • Implement tests for the extension
  • Automate testing on any commit/push
  • Publish the Extension on Firefox's Add-On store
  • Enable support for Firefox Android/Safari

Summary of the Project

Apertium Webext is a browser extension designed as a front-end for the Apertium Apy Service. It's main tasks, as outlined in the initial Proposal are:

  1. Translation of Words/Phrases given in the extension Pop-up
  2. Translation of Words the user hovers on
  3. Translation of Words/Phrases hovered on, but also with context
  4. And finally, translation of the entire webpage

In the development of this project, I've used various tools such as jQuery and Bootstrap for front-end development and Puppeteer along with Mocha for testing. The details of the manifest, file structure and all can be found on the official repository.

Even with all these, my work isn't complete. A few goals that are yet to be complete are publishing the extension on the Firefox Add-On store as well as a version for Safari. Apart from these, there's a few minor upgrades I plan on doing soon.


My Experiences

From the initial proposal through the community bonding period and in these final few days, it's honestly been a pleasure working on this project. I was somewhat doubtful about some features when I was starting out, worried about not being able to finish it in time. Thankfully, it's all worked out great by the end.

The most challenging parts (at least for me) were the lack of tools dealing with extensions. Mozilla's webext-polyfill lacks a couple features, especially Context Menus, in making a completely cross-platform extension. Even when testing, Puppeteer is one of the few tools available for extensions (Selenium works too but Puppeteer works right out the box).

Another feature that I needed help with was extracting the right parts from the DOM without including their children, the inner html, certain tags and only the text nodes. My Apertium Mentor, Tino Didriksen helped out big time with this section.

A more detailed (and less flowery) version of my progress throughout these 10 weeks is available right here.

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