Open-source project
xnx3/translate avatar
xnx3/translate

translate.js: the documented snippet pins a version a year behind, and a version bump pushes on its own

AI i18n, Two lines of js realize automatic html translation. No need to change the page, no language configuration file, no API key, SEO friendly!

3,131 stars487 forksJavaScriptMIT

At a glance

What is it?
A JavaScript library that translates a web page in the browser by scanning its own document and rewriting text nodes, sold on the idea that you add a script tag and change nothing else: no page rework, no per-language files, no key. The MIT licence covers the library and the author explicitly invites you to sell what you build with it, while the hosted translation service behind it carries a separate commercial channel.
Who is it for?
translate.js is worth a look if you need a multilingual version of a static site quickly and can accept that the translation happens in each visitor's browser rather than at build time, because the zero-configuration path is genuinely two lines and the directive list is unusually deep for anything free. Three things to check.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • xnx3/translate3,131 ★ · +45
Star history
Repository2026-09-282026-11-25
xnx3/translate3.1k3.1k

45 Stars in the last 58 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The snippet everyone copies loads a build a year behind

The integration example is a script tag plus an inline block, and the script tag points at a content delivery network path with a version baked into it:

html
<script src="https://cdn.staticfile.net/translate.js/3.18.66/translate.js"></script>

The manifest in the repository declares a different version, four point one point zero, and the newest release tag in the repository's history is four point zero point zero, published in February. The pinned build in the documentation is from the three point eighteen series, and that series itself ran to at least build ninety-eight before the project moved to four. So the one piece of code a reader is told to paste is not the current code, and there is no note saying which build is intended or why that one was chosen. A second detail compounds it: the project is published to a package registry under a name that does not contain the word translate, so someone who follows the package documentation and someone who follows the page documentation are installing two different things.

The indexing claim is about page source, not about what a browser renders

The search-engine bullet makes a precise claim: the tool does not affect how a site is indexed, because the page source a crawler fetches is never modified. That follows directly from the architecture, since everything happens in the browser after the document arrives. What the claim does not cover is a crawler that executes scripts, which would see a document object model that has already been rewritten, and a visitor whose browser fails to load the script sees only the original. The documentation index also lists a page about opening a new page showing the original text for one second before the translation appears, which is an acknowledgement that the swap is visible and can be tuned. So the honest version of the claim is about non-executing crawlers, and the library is candid enough elsewhere to offer the opposite behaviour as a setting.

The library is free and the service behind it is not

Two lines in the feature list point in opposite directions and are worth reading together. One says the project is permanently open source and free under the MIT licence, and then adds that you can also use it to build third-party and browser plugins and sell them for profit. The other is a directive described as enabling enterprise-grade stable translation, which the file says runs independently of the open-source version's channel, is opened to a small number of users, and provides more stable service, higher speed and more distribution nodes. So the split is not code against service, it is service against service: the library stays free and the network of translation nodes behind it has a paid tier. That is worth knowing before you promise a page will keep translating, because the default path runs on nodes the project operates.

The cache is three layers deep and the first one is yours to replace

The speed claims rest on a specific set of mechanisms rather than on the model: multiple threads, three layers of cache, a preload step, and text cleaning before translation. The directive list exposes the top of that stack directly. One rewrites the first-level cache, which the file identifies as browser-side and says defaults to local storage, so you can substitute your own storage. Another clears the remembered target language so a visitor moving between pages is not carried over from the previous one. And the network claims come with their own cadence: the tool describes picking the lowest-latency node and re-fetching that choice every minute. Taken together, the performance story is mostly caching and node selection rather than anything about translation quality, which is the part you have to test on your own content.

Bumping the version pushes to the remote by itself

The manifest wires two hooks to the version lifecycle. The version step runs a script from the development directory, and the step after it runs two commands: one pushes the commit and one pushes the tags. There is no branch protection mentioned, no pull request and no review step between a version bump and the remote receiving both a commit and a tag. For a project whose releases are the thing a consumer pins to, that means the release cadence is a property of whoever holds the credentials rather than of a reviewable process. The development directory holding the update script is not part of what gets published to the registry, which is at least tidier than the opposite arrangement.

Trying it on another site means injecting a script into a page you do not own

The demonstration section suggests opening any page, opening the developer inspector and pasting a small snippet that creates a script element pointing at a file on the project's own asset host, then pressing enter, at which point a large language switcher appears in the corner. That is a reasonable way to let someone evaluate the library on a real page, and it is also a third-party script injected into a document the user does not control. The online demo is served over plain http in the file, and the same section links a separate integration tool described as automatically wiring the library into your project so that you need not read the documentation or write code, which is currently adapted for two Windows versions and distributed as a zip archive from a different domain, alongside a quick video.

The directive list includes translating JavaScript itself

The bulk of the readme is a list of fine-tuning directives, and it is the most detailed part of the project. The ignore family covers element identifiers, class attributes, tag names, literal strings and regular expressions, each excluding the matching element and its children. There are directives to translate only a chosen set of elements, to translate images as well as text, to show a translation when the visitor selects a passage, to take the language from a query parameter, and to translate whole node contents as one string rather than word by word, which the file recommends for readability. Several are about integration rather than translation: starting a listener so dynamically rendered content is picked up, triggering translation when an ajax request completes, translating specific HTML attributes, rewriting the cache, appending custom parameters to backend requests, and translating JavaScript objects and code. The last of those is the one to think hardest about.

Editorial conclusion

translate.js is worth a look if you need a multilingual version of a static site quickly and can accept that the translation happens in each visitor's browser rather than at build time, because the zero-configuration path is genuinely two lines and the directive list is unusually deep for anything free. Three things to check. The snippet in the documentation pins a specific older build on a content delivery network, so following it verbatim is not the same as using the current release. The search-engine claim is about page source, which is true and also narrower than it sounds. And the library is free while the translation service is not, so read which channel your visitors will be hitting before you promise a page will keep working.

Frequently asked questions

What is translate.js?

A JavaScript library that translates a web page in the browser by scanning its document and rewriting text nodes, so a site gets language switching from a script tag with no page rework, no per-language configuration files and no API key. The library is MIT licensed and the author explicitly invites you to sell products built with it.

How do I add translate.js to a page?

Paste a script tag before the closing html tag pointing at a build on a content delivery network, then call four methods in an inline block: set the page's local language, choose the translation service channel, start the listener that watches for content changing after load, and execute the initial translation.

Which version of translate.js does the readme's snippet load?

The content delivery network path in the example pins build three point eighteen point six six, while the package manifest declares four point one point zero and the newest release tag is four point zero point zero from February. No note explains the choice of build, and the package is published under a name that does not include the word translate.

Is translate.js really friendly to search engines?

The claim is that indexing is unaffected because the page source a crawler fetches is never modified, which follows from translating in the browser rather than on the server. The documentation also offers a setting to show the original text for a moment before the translation appears, so the swap is visible and tunable.

Can I use my own translation service with translate.js?

Yes. One directive sets the service interface for people who do not want to use the project's free service, and another explains the two options, their own server or no server of your own. Private deployment is offered for organisations with strict data privacy needs or no external network, and a separate directive builds a custom glossary.

What can translate.js be told to ignore or to translate?

There are directives to skip matching element identifiers, class attributes, tag names, literal strings and regular expressions, each excluding the element and its children, and one to translate only a chosen set of elements instead of the whole page. Others translate images as well as text, add a translation popup on text selection, take the language from a query parameter, and trigger translation when an ajax request finishes.

Official sources

  1. Issues
  2. License: MIT
  3. README
  4. Releases
  5. xnx3/translate on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/xnx3-translate.svg)](https://hysenlabs.com/projects/xnx3-translate)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/xnx3-translate.svg)](https://hysenlabs.com/projects/xnx3-translate)

Was this useful?