- it's experimental
- the "specification" is nowhere near a standards track: https://webmachinelearning.github.io/translation-api/
Of course it's already shipped in Chrome, and now Chrome pretends that its own Chrome-only API is somehow standard. Expect people on HN to blame other browsers for not shipping this.
The W3C is not a prescriptive standardization body. It doesn't have any regulatory power giving it any teeth to go after vendors acting in bad faith. So the W3C process is descriptive and encourages a period of competitive divergence in implementations. It is only after the early adopters have hammered on the features and figured out which parts they like best that a Web API can then start to get standardized.
Worst case scenario a user-script/extension could monkey patch it out, but probably clients will let you disable it.
Rather, it's an API developers can use to add inline translation to web apps.
For example, under a comment in your app, you can (a) detect the language, and (b) if it's different from the current users/browsers language, offer to translate it with a small link (c) if the user clicks the link, the content is translated to their language.
Safari/webkit is positive (though no official stance yet):
https://github.com/WebKit/standards-positions/issues/339#iss...
> The spec assumes a certain form of translation backend, exposing information about model availability, download progress, quotas, and usage prediction. We'd like to minimize the information exposure so that the implementation can be more flexible.
reads to me as Chrome once again trying to export itself verbatim as a "standard" and Mozilla pointing out that that's not really applicable to others.
Also the WebKit post seems to raise somewhat similar arguments but on the basis of fingerprinting/privacy problems.
const translator = await Translator.create({ sourceLanguage: 'en', targetLanguage: 'fr', });
await translator.translate('Where is the next bus stop, please?');
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.
right?
Why not just use the lang= attribute as it was intended, then let the user select text to translate as they wish?
Instead, a JS API gives more flexibility and control.
Besides, I think the "lang" attribute is supposed to signal what the language of the text inside that element is, not what it could/should be. So even if going with attributes would be the way forward, a new one would need to be created.
rhabarba•4h ago
Raed667•4h ago
I assume every browser will do the same as on-device models start becoming more useful.
rhabarba•4h ago
its-summertime•4h ago
Asraelite•3h ago
Last time I looked I wasn't able to find any easy to run models that supported more than a handful of languages.
ukuina•2h ago
https://ollama.com/library/gemma3
> support for over 140 languages
diggan•1h ago
_1•2h ago
JimDabell•2h ago
You can use llm for this fairly easily:
https://llm.datasette.iousagisushi•1h ago
ref: https://github.com/simonw/llm/issues/575
JimDabell•1h ago
wittjeff•2h ago
tempodox•6m ago