Firefox Translations is a webextension that enables client side translations for web browsers.
Перейти к файлу
Andre Natal 22182183e9
Sanitize text (#630)
* Sanitize text

* Update extension/view/popup/js/index.js

Co-authored-by: Rob Wu <rob@robwu.nl>

* Update extension/view/popup/js/index.js

Co-authored-by: Rob Wu <rob@robwu.nl>

* Update extension/view/popup/index.html

Co-authored-by: Rob Wu <rob@robwu.nl>

Co-authored-by: Rob Wu <rob@robwu.nl>
2023-01-13 14:08:44 -08:00
.github Fix tests (#545) 2022-11-02 15:56:09 -07:00
docs Update sequence diagram (#345) 2022-05-24 11:02:42 -07:00
extension Sanitize text (#630) 2023-01-13 14:08:44 -08:00
scripts Replaces Cu.reportError by console.error (#619) 2022-12-16 18:33:22 -08:00
.eslintrc.js Removed bergamot translator's wormhole artifacts (#353) 2022-06-07 12:03:54 +02:00
.gitignore Iframe support (#148) 2022-03-24 11:33:59 -07:00
.gitmodules More taskcluster implementations (#248) 2022-04-12 14:14:28 -07:00
.taskcluster.yml Update .taskcluster.yml 2022-04-12 10:06:56 -07:00
CHANGELOG.md Release 1.2 (#558) 2022-11-08 14:39:35 -08:00
CODE_OF_CONDUCT.md Tooling for signing (#244) 2022-04-11 17:27:25 -07:00
LICENSE Initial commit 2021-09-07 12:56:03 -07:00
README.md Update README.md with Android instructions (#608) 2022-12-04 20:56:53 -08:00
package-lock.json Bump eslint from 8.30.0 to 8.31.0 (#626) 2023-01-13 13:40:29 -08:00
package.json Bump eslint from 8.30.0 to 8.31.0 (#626) 2023-01-13 13:40:29 -08:00
update.json Fix tests and clear update.json (#317) 2022-05-06 14:39:06 -07:00

README.md

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 Unions 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

https://user-images.githubusercontent.com/973388/205549475-8036df98-d5b5-4baa-af8f-350f7962f18e.mov

Android

This repository contains experimental Android support for the purpose of test and evaluation in the branch android. Only the in-page translation functionality is present and the user interface is more limited compared to the desktop version. You can test it by following the steps below:

  1. Clone this repo, execute npm install and switch to the branch android
  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.

https://user-images.githubusercontent.com/973388/205548906-e6eaf82e-e4cd-4a78-8910-9823f1e82d71.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