LibreTranslate website translation widget

I currently maintain a website, straight HTML, that is using the old method of Google Translate embedded in the site, which allows for live translation on the fly through JavaScript. The Google Translate code still works, but it is outdated, slow, and no longer officially support so I’m looking for something similar but locally hosted.

I’ve looked through your documentation and discussions, but there is nothing I can find that allows for this. I would appreciate someone pointing me in the right direction, if this is even possible.

Thank you in advance.

1 Like

You can translate HTML with the LibreTranslate API.


const res = await fetch("", {
	method: "POST",
	body: JSON.stringify({
		q: '<p class="green">Hello!</p>',
		source: "en",
		target: "es",
		format: "html"
	headers: { "Content-Type": "application/json" }

console.log(await res.json());


    "translatedText": "<p class=\"green\">¡Hola!</p>"

I saw that as an example before, but that doesn’t explain how to send it an entire page to translate. Understand, I’m looking for a replacement for an embedded Google Translate setup.

LibreTranslate or argos-translate will not allow you to directly replace the Google Translate widget without additional code

1 Like

That is understood. But, by the responses so far, it seems that the code doesn’t exist for what I want to do at this point.

Thank you.

Is this a JavaScript widget that goes in the webpage and translates content? I don’t think this currently exists for LibreTranslate but it could be a valuable thing to have if anyone wants to build it.

1 Like

Yes, it’s embedded in the HTML code through JavaScript as already described. And yes it would be powerful, which is why I’m looking for a solution to it.

Thanks for everyone’s time on this.

1 Like