Live data from Hacker News

Web Translator API

developer.mozilla.org

41–50 of 71 posts

Re: Web Translator API

#41
As maintainer of https://linguister.io/, should I start work on polyfill for that API?

If this API will be implemented in next few years, there will be browsers who hold up the world in progress.

Linguist have enough many users, so we could expose this API for client side code, and users with browsers where Translation API is not implemented yet, could install Linguist and sites who uses Translation API would works fine. Translation API calls would proxy by Linguist and preferred translator module would be used.

Any thoughts about it?

Re: Web Translator API

#42
post #35
post #11

https://developer.chrome.com/docs/ai/translator-api const translator = await Translator.create({ sourceLanguage: 'en', targetLanguage: 'fr', }); await translator.translate('Where is the next bus stop, please?');

So, this is Google Translate built running locally in Chrome? I wonder if it is a small/degraded model or limited languages? Otherwise, how is it not a simple way around the paid Google API?

The article explains that this feature uses a small (up to 22 GB) language model that runs on-device.

That said, the "simple way around the paid API" problem is something Google has to deal with anyway, because there are a bunch of ways to use Google Translate without paying for it (e.g., the translate.google.com web UI, or the non-JavaScript-exposed "Translate to [language]" feature built into Chrome), and any action that can be taken by a human can in principle also be taken by a script. The only thing to do about it is use secret-sauce server-side abuse detection to block as much of this activity as they can; they can't get all of it but they can get enough to push enough people onto the paid API that the economics pencil out.

Re: Web Translator API

#45
post #43

With js being a garbage collected language, what is the benefit of the destroy method here and why is it necessary?

The is no guarantee when it will be garbage collected. For large local models that use a lot of resources they should be unloaded as soon as possible to allow other programs on the computer to use the resources.

Re: Web Translator API

#46
post #35

Earlier quoted context omitted.

So, this is Google Translate built running locally in Chrome? I wonder if it is a small/degraded model or limited languages? Otherwise, how is it not a simple way around the paid Google API?

The article explains that this feature uses a small (up to 22 GB) language model that runs on-device. That said, the "simple way around the paid API" problem is something Google has to deal with anyway, because there are a bunch of ways to use Google Translate without paying for it (e.g., the translate.google.com web UI, or the non-JavaScript-exposed "Translate to [language]" feature built into Chrome), and any actio…

So installing Chrome is going to require 22 GB of disk space now?

Re: Web Translator API

#47
post #46

Earlier quoted context omitted.

The article explains that this feature uses a small (up to 22 GB) language model that runs on-device. That said, the "simple way around the paid API" problem is something Google has to deal with anyway, because there are a bunch of ways to use Google Translate without paying for it (e.g., the translate.google.com web UI, or the non-JavaScript-exposed "Translate to [language]" feature built into Chrome), and any actio…

So installing Chrome is going to require 22 GB of disk space now?

It only installs models that explicitly downloaded via this API, it seems.

Also, it says to have 22 GB free, but below (under "Note"...), it says the model takes "around a couple of GB".

Re: Web Translator API

#48
post #47
post #46

Earlier quoted context omitted.

So installing Chrome is going to require 22 GB of disk space now?

It only installs models that explicitly downloaded via this API, it seems. Also, it says to have 22 GB free, but below (under "Note"...), it says the model takes "around a couple of GB".

Does the API trigger the download automatically, or does it ask for user permission?

(Answered my own question): Doesn't look like it requires the user's permission. Upon first use, the model will start downloading. The user has to wait for the download to finish before the API will work. That could take hours for 22gb.

I presume this can't work on mobile?

https://developer.mozilla.org/en-US/docs/Web/API/Translator_...

Re: Web Translator API

#49
post #48
post #47

Earlier quoted context omitted.

It only installs models that explicitly downloaded via this API, it seems. Also, it says to have 22 GB free, but below (under "Note"...), it says the model takes "around a couple of GB".

Does the API trigger the download automatically, or does it ask for user permission? (Answered my own question): Doesn't look like it requires the user's permission. Upon first use, the model will start downloading. The user has to wait for the download to finish before the API will work. That could take hours for 22gb. I presume this can't work on mobile? https://developer.mozilla.org/en-US/docs/Web/API/Translator_.…

The article indicates that it will only download the model over an unmetered connection, e.g., while the phone is connected to wifi.

Re: Web Translator API

#50

This would be very useful. Basically, the 'translate this' button you see on Twitter or Instagram next to comments in foreign languages. This API would make it trivial for all developers to add that to their web apps.

Except that it is the user that will pay with his own llm tokens
Post reply on HN