Giter Site home page Giter Site logo

andrenatal / firefox-translations Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozilla/firefox-translations

0.0 3.0 0.0 35.36 MB

Firefox Translations is a webextension that enables client side translations for web browsers.

License: Mozilla Public License 2.0

JavaScript 98.16% CSS 0.25% HTML 0.86% Shell 0.08% Python 0.63% Smarty 0.03%

firefox-translations's Introduction

Build CodeQL End-to-End Tests Firefox Translations - Install Nightly CODE OF CONDUCT LICENSE Mozilla Add-on

Firefox Translations

Firefox Translations is a WebExtension that enables client side in-page translations for web browsers.

Firefox Translations was developed with The Bergamot Project Consortium, coordinated by the University of Edinburgh with partners Charles University in Prague, the University of Sheffield, University of Tartu, and Mozilla. This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 825303. 🇪🇺

Release version

The current release version is available for installation on Mozilla Add-ons

AMO

Supported languages

Production

  • Spanish
  • Estonian
  • English
  • German
  • Czech
  • Bulgarian
  • Portuguese
  • Italian
  • French
  • Polish

Development

  • Russian
  • Persian (Farsi)
  • Icelandic
  • Norwegian Nynorsk
  • Norwegian Bokmål
  • Ukrainian
  • Dutch

Testing

Nightly builds

Desktop

You can test nightly builds of the extension in Firefox Nightly or Developer Edition in one of the supported languages by following the steps below:

  • Type about:config in the navigation bar and set the following preferences:
    xpinstall.signatures.required to false
    extensions.experiments.enabled to true
  • Then install the extension by clicking here Firefox Translations - Install Nightly
  • You may need to restart your browser and Firefox Translations will be ready to use. Just browse to a website in one of the supported languages and the option to translate should be displayed.
Demo
Firefox.Translations.v2.mov

Android

You can test the addon on Android by following the steps below:

  1. Clone this repo and execute npm install
  2. Install Firefox Nightly for Android in your phone
  3. Connect your phone to your computer via USB
  4. Follow these steps in order to setup your phone and browser to install the addon
  5. You might need to execute adb shell pm grant org.mozilla.fenix android.permission.READ_EXTERNAL_STORAGE in your terminal so the addon could be pushed to your phone
  6. Execute adb devices in your terminal, copy the device id, and replace the string <device id from adb devices> on package.json by it
  7. Execute npm run android in your terminal to install the addon in your phone and have the browser automatically started

That should be enough to have the addon installed on Firefox in your Android. Folow the steps in the video below to learn how to use it.

Firefox.Translations.on.Android.mp4

Development

3rd party dependencies

The extension does not utilize any npm modules, and the only vendored dependencies within are:

  • Bergamot Translator

    • A WebAssembly wrapper around the actual Neural Machine Translator, Marian. The code to build the WASM module can be found on its repository
  • Fasttext

    • We bundle the WebAssembly port of fasttext along its compressed model in order to detect the page's language. Instructions to build the WebAssembly module can be found here
  • Sentry

  • serialize-error

    • code of serialize-error npm package is bundled for serialization of exceptions to report errors from content scripts to background script

How to run

  • Install Firefox Nightly
  • Clone this repo and run npm install
  • Run npm run once and wait until Nightly starts
  • Go to about:config and set extensions.experiments.enabled to true
  • Browse to a page in any of the supported languages to have the translation option to appear

Updating telemetry schema

After adding new metrics to extension/model/telemetry/metrics.yaml or pings to extension/model/telemetry/pings.yaml, run

bash scripts/update-telemetry-schema.sh

to regenerate JS telemetry schema.

Updating bergamot-translator WASM module

Replace

  • extension/controller/translation/bergamot-translation-worker.js
  • extension/model/static/translation/bergamot-translator-worker.wasm

with the new artifacts and then execute:

bash scripts/update-bergamot-translator.sh

to regenerate JS version file. This version is reported in telemetry.

Discussions

Firefox translations channel on Matrix

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.