Why does it need to be a JavaScript API?
Why not just use the lang= attribute as it was intended, then let the user select text to translate as they wish?
replies(2):
Why not just use the lang= attribute as it was intended, then let the user select text to translate as they wish?
I get that this is one more brick in the wall that teams like LadyBird will have to maintain, but as a web developer I do think more Web API features is generally a good thing, as it makes it easier for smaller shops to implement richer functionality.