schroeding 4 years ago

It passes the "Turkey" <=> "turkey" test: "In Turkey they sometimes eat turkey." => "In der Türkei essen sie manchmal Truthahn." :D

Super cool! Real-time translation, in the browser, running locally! And sure, not state of the art / on the level of deepl, but on the level of Google Translate, 2015ish, maybe? Amazing!

  • mahmutc 4 years ago
  • Erlangen 4 years ago

    However, "Turkey is not a common food in Turkey." != "Die Türkei ist kein gemeinsames Essen in der Türkei."

    • mathstuf 4 years ago

      Well, that's technically ambiguous in English too. I don't think many people are eating their own country ;) .

      • refulgentis 4 years ago

        Hmm, is it ambiguous then? Seems there's only one interpretation

        • mathstuf 4 years ago

          Well, there's what people would typically interpret it as. Then you have the translation here which is a correct interpretation, but not that informative.

    • Lukas_Skywalker 4 years ago

      Also, „common“ should be translated to „üblich“ instead of „gemeinsam“. „Gemeinsam“ is more like „collective“ as in „a collective effort“.

      • tralarpa 4 years ago

        As usual, deepl doesn't disappoint.

    • iggldiggl 4 years ago

      Interestingly, Google fails on both of these sentences and always translates "Turkey" as the country. DeepL on the other hand gets it right in both cases.

no_time 4 years ago

This is incredible and super important. For all the blunders of Mozilla in the last decade, they still have some great projects. I am also grateful of them not scrapping common voice.

  • _trampeltier 4 years ago

    Also important, because now it seems at least in germany, on Google translate, there is the translate website button missing. From Switzerland I saw the button lately when I tryed. I don't know if it is because go to cencored (russian) sites. My company blocks google translate anyway, probably because of the same reason.

    • croes 4 years ago

      Are you sure?

      Under Google Übersetzer I see three button: Text, Dokumente, Websites

      • _trampeltier 4 years ago

        Yes, at least last week. The Internet from work is routed to Germany (Paderborn). Last week the third button "Websites" was missing. From home in switzerland the button was there.

        Also if you entered "translate website" Google sugested Yandex on second place ..

    • no_time 4 years ago

      Try copying the url into the translator's text field. It's how I've been using it for years.

  • Shadonototra 4 years ago

    it's not their project, all they did was to write a form in JS

    the whole project is a EU funded one, all done in the university of Edinburgh

    https://cordis.europa.eu/project/id/825303

    you giving full credit to Mozilla is dishonest, to say the least

    it aligns to their past projects, including using Mullvad and slapping a Mozilla sticker on top of it to claim it as their own

    also it is super funny to read this:

    > H2020-EU.2.1.1. - INDUSTRIAL LEADERSHIP - Leadership in enabling and industrial technologies - Information and Communication Technologies (ICT) MAIN PROGRAMME

    little do they know, EU never learn

    • stuartd 4 years ago

      All they did was ‘write a form in JS’???

      > Our solution to that was to develop a high-level API around the machine translation engine, port it to WebAssembly, and optimize the operations for matrix multiplication to run efficiently on CPUs.

  • coding123 4 years ago

    In the long run, I am a super huge fan of Mozilla and Firefox. I am using it right now. After a 10 year stint of using Chrome exclusively I now use Firefox as my main driver. Unfortunately I still need to keep chrome around for weird situations where the website developer only tested in Chrome (Yes this still exists. A shopping cart in a popular website - cough Home Depot cough cough - that recently failed me in Firefox worked in Chrome. I haven't tried in a couple weeks hopefully that is fixed.)

andrenatal1 4 years ago

Hi, I am part of the team who developed this and the author of the article. You can ask me anything about it if you have questions.

  • dnc 4 years ago

    Hi,

    This is an awesome project, congratulations!

    Could you share details about the machine translation engine that is used (or where to find out more about it)? Are there any plans to open source the extension code (with the WebAssembly optmizations that are mentioned in the article)?

    Thanks.

  • jarrell_mark 4 years ago

    really great stuff! any plans for this on firefox mobile?

    • andrenatal1 4 years ago

      Yes, we are investigating how to support Firefox for Android.

  • ainar-g 4 years ago

    Thanks for the extension!

    Are you planning on adding a “select some text → right click → Translate in a tooltip” feature? It'd be extremely useful for language learners.

  • coder543 4 years ago

    Is this open source? I don't see a github link anywhere, and I'm not sure if the models are freely usable.

    EDIT: maybe this is it: https://github.com/mozilla/firefox-translations-models

    also some info here: https://github.com/mozilla/firefox-translations-training

    • toastal 4 years ago

      Did you mean link to the source code? GitHub shouldn't be equated with open source—especially considering the core product, GitHub, is closed source.

      • coder543 4 years ago

        Mozilla heavily uses GitHub to host repositories for basically all of their projects (with possibly just the exception of Firefox itself). Anyone familiar with Mozilla’s open source efforts knows they use GitHub heavily, so stating that I didn’t see the source on their preferred platform is perfectly reasonable.

        Your comment is pedantic and unhelpful. It is effectively the same as overhearing someone asking another person for a Kleenex, then choosing to interject and lecture that person on the difference between Kleenex and tissue paper when the other person does have actual Kleenex-brand tissue. Yes, I know what open source is. Yes, Mozilla uses GitHub. I even provided links to relevant GitHub repositories by Mozilla once I found what I was looking for.

  • ashkhn 4 years ago

    Hi! This is an amazing project and will be really useful! Thank you! I understand that the project is funded by EU so the focus is on European languages but are there any plans to add CJK or other languages ?

  • msdrigg 4 years ago

    Chinese language is what I most commonly want to translate. Is there any planned support for this?

  • unicornporn 4 years ago

    Google Translate code is present on many web sites to provide automatic translations of text. Could your translate code be uploaded to a server and embedded in web page to provide the same functionality?

    • jelmervdl 4 years ago

      I'm not aware of any actively maintained projects that give you this out of the box, but these two could be starting points for such a project.

      Mozilla implemented a REST service based on (an earlier version of) bergamot-translator [1]. You could use that as a replacement for the WASM component in the addon's code.

      I also know of some full-page translation demo code that uses the python bindings of bergamot-translator [2]. That's basically a web proxy a la Goole Translate.

      Lastly, marian, the translation software that's being used, has a web server as well [3]. It does not support HTML though.

      EDIT: see also my earlier comment for using it with Node or Python [4], which you could use to implement a simple web API.

      [1] https://github.com/mozilla/translation-service

      [2] https://github.com/jerinphilip/tagtransfer

      [3] https://marian-nmt.github.io/docs/#web-server

      [4] https://news.ycombinator.com/item?id=31599231

    • andrenatal1 4 years ago

      Sure, like I mentioned in the article, you can embed the engine and the models in any web page to be run in a browser with proper WebAssembly and SIMD support.

      You can have an example on how we did here [1] and test it here (I recommend using Firefox) [2]

      That way you don't need a server and everything is processed in the browser, so no need of google translate, or any cloud service to have translations embedded in any website anymore.

      [1] https://github.com/mozilla/translate [2] https://mozilla.github.io/translate

  • joveian 4 years ago

    Thanks, really wonderful project!

    I tried it quick and a few comments:

    It looks like both the web page version and browser extension download from storage.googleapis.com, which is not ideal (obviously much better than the text to be translated being sent). IMO, this should be clarified in the extension description. Are there any plans for Mozilla to host this data? (Well, Amazon I guess to match addons.mozilla.org)

    https://mozilla.github.io/translate/

    I noticed the web page has Polish but not the extension. Is it not considered sufficiently high quality yet? (Looks like that might be the case from a quick test.)

    As with others, I first tried to translate a bit of text not the whole page. Another super helpful feature likely already on a todo list is the ability to see alternative translation options.

    Thanks again, this is great and I'm surprised it isn't a larger download. I am curious about any size/quality tradeoffs being made.

    Also, playing with the web page a bit English->Spanish I see it does a whole text translation such that adding new sentences affects the translation of earlier ones, sometimes in very odd ways (with one combination of words it translated "Spanish->English" to "español-esplén"). It seems to sometimes produce "Spanish" words that don't seem to be actual words in Spanish as best I can tell and even accoding to its own Spanish->English. It seems like a way to indicate a section to be translated as a unit might be helpful.

    • andrenatal1 4 years ago

      > Are there any plans for Mozilla to host this data? (Well, Amazon I guess to match addons.mozilla.org)

      I'll bring this internally for discussion.

      > I noticed the web page has Polish but not the extension. Is it not considered sufficiently high quality yet? (Looks like that might be the case from a quick test.)

      The Polish model finished training after we had the extension reviewed and signed for distribution, so that's why we could already integrate it in the website, which is controlled just by my team, and not in the extension yet, but we'll ship it in the next version which might come next week.

      This feature you requested is something that I consider interesting and important, would you mind filing an issue in the repo so we could track it [1]?

      We did not find any large quality issues after quantizing the models.

      In regards to the neologism in Spanish, that is yes a condition that the consortium is aware and working to remediate it.

      [1] https://github.com/mozilla/firefox-translations/issues

      • joveian 4 years ago

        Thanks! Looks like I picked a bad test case for Polish, I tried a few more and some look perfect (boring corporate text) and others around the same as Google Translate (I don't know Polish or Spanish and mostly looked at song lyrics). I don't know if specific examples are helpful, but it looks like it particularly has a tough time with "W poprzek wpław" and I think a few more issues in:

        https://www.musixmatch.com/lyrics/Teskno/Woda-t%C4%99skno-gr...

        I'll add a few feature requests to the issue tracker (if not there already) hopefully later today. Including a request to put that web page in the extension :).

  • Jourdelune 4 years ago

    Hello, your tool is great! I have questions about the future of the project, is it planned to add languages in the future? The European Union grant ends in June and will the project continue to develop and add more languages in the future?

obert 4 years ago

The sooner we move AI to 127.0.0.1 the better, enough with The Cloud powerhouses.

Yes there’s work to be done, resilience, power efficiency, responsiveness, but it’s the right direction for everything that involves private computing.

  • ShamelessC 4 years ago

    Also the right direction if we intend to put this stuff into actual robots.

Vinnl 4 years ago

I've been using the extension [1] for a bit and, while it doesn't support too many languages, for the ones it does it's pretty cool to have it all running locally.

[1] https://addons.mozilla.org/firefox/addon/firefox-translation...

  • clairity 4 years ago

    neat, but it looks like it was just released, so how were you using it before?

    as an aside, pretty sad to see the project page, https://browser.mt/ , requiring not just javascript but specifically google connections to work. to 5 different google properties, no less.

    • 0des 4 years ago

      .mt huh thats a new one for me

    • Vinnl 4 years ago

      I work at Mozilla, so got a sneak preview (and also the first bugs) :)

      (Of course technically the work was out there in the open already, since it's Mozilla.)

      Agreed about the Bergamot website. I suspect it's not by Mozilla, but I'll see if I can ask someone to take a look, as I don't think all those connections should be necessary.

      • clairity 4 years ago

        awesome, thanks! i also suspect it's by the EU coalition behind bergamot, so probably beyond mozilla's jurisdiction, but it doesn't hurt to ask.

      • 2Gkashmiri 4 years ago

        is there a way to opt websites/URLS/ url roots in to automatic translations? currently the "auto translate this tab" works but you have to select it manually and for me at least on linux it makes the window more than 100% so i cannot use the right side of browser in this tab.

        you know a simple setting "always translate this website" and an option to hide the bar

  • baobob 4 years ago

    Do you know what the pipeline looks like for new language pairs being added? This is really, really, really awesome

    I'm also immediately curious about using it headless outside the browser

jeroenhd 4 years ago

Looks lovely! Offline translations are very welcome in a world where the most important translation engines are also run by the world's biggest data hoarders.

Sadly, the extension either doesn't work on mobile or Mozilla couldn't be bothered to add it to the whitelist.

guerrilla 4 years ago

What I need from this is to be able to select text and just have it translated in a tooltip (or whatever.) This is what I'm using the Simple Translate Firefox add-on for but unfortunately it sends data to Google.

  • filoleg 4 years ago

    It would be nice to have something like that for desktop, but on mobile, iOS handles it amazingly.

    You can select text almost anywhere (from browser to even from a screenshot/image; literally anywhere you are able to select text), and in a tooltip above the word, one of the few options is translate. I love the UX of it, as it is super intuitive and unobtrusive, and works pretty much instantaneously It runs fully locally, no connection required. Slides a native OS pane over the page to show possible translations along with pronunciations and other extra info.

    Sidenote: other features in that tooltip are pretty nifty too. Aside from the obvious copy/cut/paste/share, i found "look up" to be quite useful when i see a word I've not encountered before. It pulls another native OS pane that shows dictionary definitions and extra info like the wikipedia link. And the actual dictionary definitions are local too afaik.

    • guerrilla 4 years ago

      Yeah, Android has the same.

    • jeroenhd 4 years ago

      Android had the same feature, assuming apps don't disable the tooltip. Selecting text on my phone brings a nice context menu for cut/copy/paste/search/translate/encrypt (that last one was added by OpenKeychain, a PGP app).

      It doesn't come with a dictionary built in, but the search button becomes an online dictionary in a pinch. Any dictionary app could extend the menu to add a local dictionary, of course.

    • rahimnathwani 4 years ago

      Android has this too. BUT:

      When my phone is on portrait mode (almost always), I don't see the translate option until I tap on the three dots.

      The translation isn't instant. It takes a second to show up, and then takes up the top of the screen.

      I'd much prefer a UI similar to the Zhongwen Chrome extension.

      • guerrilla 4 years ago

        > It takes a second to show up, and then takes up the top of the screen.

        I think this could have to do with it not being local...

bogwog 4 years ago

This is awesome, but...

> This set of requirements posed a number of technological challenges to the team: the translation engine was entirely written in programming languages that compile to native code. We needed a way to streamline the distribution of the project in order to avoid the overhead involved in providing builds compatible with all platforms supported by Firefox — that would be impracticable to scale and maintain.

Does Firefox really support so many different platforms and archs that CI builds are unrealistic?

  • dblohm7 4 years ago

    (Former Mozilla employee, here)

    I'm completely speculating, but it's probably a matter of not wanting to complicate iterating on the translation engine by introducing a bunch of cruft from the Firefox build system (which, though it uses GNU make under the hood, is very much bespoke and complicated).

    Since the translation engine is intended to run on a product that hosts WASM, they might as well just build to that.

  • jelmervdl 4 years ago

    The upside of using WASM is that the extension itself can be easily ported to other browsers and platforms. The UI uses Firefox specific APIs but the parts that take the HTML from a page and push it through the translation engine would also work in any Chrome-based browser.

    (Edit: also free sandboxing of a blob of C++ code that needs to handle arbitrary input from the web!)

  • andrenatal1 4 years ago

    The point here is that it simpler to have just one NMT engine in WebAssembly shipped bundled in the extension than runs in all platforms for free, instead of having to support and distribute multiple native builds of the engine that would be sideloaded and communicate with the extension via native messaging.

    When the project started for example, the engine has incompatible with ARM, which we could just get for free with WebAssembly. The performance penalty of doing that was minimal for the user eyes, and so far we received less than a handful of complains about it.

    Bundling the entire engine on Firefox was never an option for many obvious reasons.

  • seba_dos1 4 years ago

    Only Debian alone builds Firefox for 7 different CPU architectures (12 if you count outdated packages too).

nyanpasu64 4 years ago

It's unfortunate that it doesn't translate Japanese, and reading Japanese-only resources is a common hurdle in the retro game modding/development community.

  • Mindless2112 4 years ago

    Not to mention the icon for the extension is "あ⇆a".

unhammer 4 years ago

This is awesome. I've been using https://translatelocally.com/ a bit, which is the same backend, and been amazed at how they managed to squeeze those neural net models, the Norwegian–English one that's downloaded by translateLocally is just 15M! That's less than Chrome transferred to Google about you while you were reading this comment.[citation needed]

Apparantly Kenneth Heafield https://neural.mt/ of kenlm fame has been coordinating the project, also doing good work like organizing shared tasks on Efficient MT https://statmt.org/wmt21/efficiency-task.html

boberoni 4 years ago

For i18n in my own projects, I typically use tools like gettext and involves lots of volunteers to do the translations. I might try out these neural machine translation tools to see how they fare. I also wonder if these machine translation tools are trained on a corpus of gettext datasets.

pabs3 4 years ago

Would be nice if desktop environments like GNOME/KDE and email clients like evolution/kmail could integrate this too.

lovelearning 4 years ago

Stuck at "Loading translation engine..." from a long time. Tried German and Spanish. Can't tell if it's downloading some model data or something's failed. I suggest some kind of progress indicator.

baobob 4 years ago

Awesome, tested the German model on dw.com, surprisingly fast and accurate.

simlevesque 4 years ago

I wonder why French is absent.

Meanwhile they have Persian which is not even in the EU.

  • cassepipe 4 years ago

    Should the EU languages get preferential treatment ?

    • Mizza 4 years ago

      "This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 825303 ."

  • geraltofrivia 4 years ago

    I wouldn't comment on the absence of French vis-a-vis other languages. It's just slightly surprising because English <-> French is honestly a very widely studied translation sub-task, with an enormous amount of parallel corpora available for training these models.

    • simlevesque 4 years ago

      Well, there's this and the fact that it is the second most popular language in the european union, which sponsor the project.

  • andrenatal1 4 years ago

    French is being trained by the consortium and is part of the scope of the grant, so we should have it at some point in June and we'll ship and update as soon we have it.

jordemort 4 years ago

I love it. I wish it could translate Chinese to English.

simonmales 4 years ago

Great that you contribute your own language pairs.

whinvik 4 years ago

Can we use this on mobile?

  • jeroenhd 4 years ago

    The demo site works on mobile if you let it load the necessary content so if you're speaking from a web dev point of view: definitely.

    As for the addon, on Android you'll need to install an unstable version of Firefox and configures a custom addon list in an addons.mozilla.org account that includes it so you can download it.

    On iOS there isn't any option to download addons as far as I'm aware. On mobile Linux environments everything should work like on desktop.

    • djvdq 4 years ago

      You can't download any addon for Firefox on iOS because it's almost Safari, only looking a bit different. All browsers on iOS has to use WebKit so FF is not really FF here on iOS.

      • jeroenhd 4 years ago

        I know, but I don't know what iOS webkit does and doesn't allow. Injecting code and responding to events in a way that makes the most important webextension APIs work _sounds_ like it should be possible (though it would take lots of work).

        Sad to hear there's no such feature on iOS. At least Android gets uBlock Origin in the stable channels. Hopefully this will change when Apple will eventually be forced to permit other browsers into the iOS app store.

        • djvdq 4 years ago

          EU is after Apple in terms of Appstore - they want to force Apple to allow different stores. Then FF for iOS (the "real" one) could be distributed this way.

    • jelmervdl 4 years ago

      I think the Firefox extension might not work on mobile because it hooks into some undocumented addon apis to draw that translation bar UI. Those might not be available on mobile.

      The translation code itself should work on mobile. It's just some javascript & wasm (albeit with SIMD instructions not implemented in Safari's WASM vm…)

      • Vinnl 4 years ago

        I just installed the extension on Fenix Nightly and indeed, it does not work.

mikevm 4 years ago

That's funny. I've just tried to translate "fuck you" to Russian and I got "трахать тебя" while Google Translate gives the more accurate "пошел на хуй".

  • spitfire 4 years ago

    Try “Russian warship, go fuck yourself!” instead. It should work better.

  • ainar-g 4 years ago

    In my experience, DeepL is still the undefeated leader when it comes to translating Russian obscenity, heh.

  • numpad0 4 years ago

    Machine translations are accurate as a trebuchet past 300 yards, just a better than nothings. But they’re great tool so long user is aware.

option 4 years ago

What’s wrong with using cloud without sending any user id with the request?

  • chungy 4 years ago

    There's likely far more identifiable information in the actual text than a user ID provides.

  • drewzero1 4 years ago

    Cloud assumes a constant, reliable internet connection, which is not the reality in most of the world. (Nor is it always desirable.)

  • toper-centage 4 years ago

    What if what I'm trying to translate is sensitive information in itself?

  • kevin_thibedeau 4 years ago

    "The telescreen received and transmitted simultaneously. Any sound that Winston made, above the level of a very low whisper, would be picked up by it; moreover, so long as he remained within the field of vision which the metal plaque commanded, he could be seen as well as heard. There was of course no way of knowing whether you were being watched at any given moment."

    • 0des 4 years ago

      "How often, or on what system, the Thought Police plugged in on any individual wire was guesswork. It was even conceivable that they watched everybody all the time."

  • no_time 4 years ago

    In the current status quo you either make use of an api by indentifying yourself with a key or a browser session that is fingerprintable in a gazillion ways. There is no such thing as "not sending user ID" or if there is, it has a totally negligible reach.

  • jffry 4 years ago

    If the data never leaves your device, then a third-party service never gets the opportunity to leak or misuse it. This is far more private.

    How many stories have you heard about breaches due to accidentally mis-configured logging in web services? Also in the news lately was Twitter misusing 2fa phone numbers for advertising purposes.

  • vanilla_nut 4 years ago

    If local translation can help me use a website without a query to some cloud server... who needs the cloud? No backend that will experience downtime, and someday be decommissioned. No money sink of cloud processing pressuring the product to advertise or monetise in unscrupulous ways.

    I'm sure cloud processing is better in many ways. But if this is "good enough" I'd rather just do it all locally.