Userscript that adds in-place translation for posts and replies on X (Twitter) — without leaving the feed.
Compatible with Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat, and other managers that support the // ==UserScript== metadata block.
Status: stable (
1.2.6) — translate posts & comments in place, multiple providers, cache, filters, UI matched to X light / dim / lights-out. Note: Not affiliated with X Corp. or Twitter.
Install URL (GitHub — newest):
https://raw.githubusercontent.com/NemoKing1210/x-translator/main/x-translator.user.js
| Manager | Path |
|---|---|
| Tampermonkey | Dashboard → Utilities → Install from URL |
| Violentmonkey | Dashboard → + → Install from URL |
| Greasemonkey | Add-on menu → New User Script → paste the raw URL |
| ScriptCat | Install the extension, then use the GitHub raw URL |
git clone https://github.com/NemoKing1210/x-translator.git
cd x-translator
npm install
npm run build
Then open the built x-translator.user.js in your manager (or copy its contents into a new script).
For hot reload during development, run npm run dev and install the Vite-served script (name prefix dev:).
x.com / twitter.com)Open Translator in the left nav, or the manager menu → X Translator — Settings.
| Tab | What you can change | Default |
|---|---|---|
| General | Interface language; target language; mode (button / auto); auto scope + allowlist; replace reveal; skip X auto-translated posts; account blocklist; source language allow/block lists; display mode (panel / replace) | Auto / button / all / button / on / panel |
| Providers | Provider + API credentials / URL fields | |
| Cache | Usage meter; cache hours (0 = off); clear cache |
24 |
| About | Description, repository link, author card | — |
Saving closes the panel and applies immediately (nav labels and tweet buttons refresh).
https://x.com/* and https://twitter.com/* at document-idle.[data-testid="tweetText"] inside article[data-testid="tweet"] (posts and replies share this id) — adjustable in src/constants.js if X’s DOM changes.GM_xmlhttpRequest / @connect).GM storage (xt_cache_v1) until TTL expires or you clear the cache.X’s web client updates often — if buttons stop appearing, selectors in POST_TEXT_SELECTORS are the first place to look.
The built script ships with @updateURL / @downloadURL pointing at GitHub main. Supported managers check for updates automatically.
To ship a new version:
version in package.json (source of truth for @version and SCRIPT_VERSION).npm run build (regenerates root x-translator.user.js / .meta.js).CHANGELOG.md.main.For local setup, contributing, and repository layout see DEVELOPMENT.md, CONTRIBUTING.md, and AGENTS.md.
Does this need a Google API key?
No for the default Google provider. DeepL, Microsoft, OpenAI, Yandex, and LibreTranslate need credentials under Settings → Providers.
Will my X password be shared?
No. The script only reads post text from the page DOM and sends that text to the chosen translate provider. It does not touch X auth tokens for translation. API keys you enter are stored in userscript GM storage on your device.
Does it work on twitter.com?
Yes — @match includes both x.com and twitter.com.
Buttons missing on some tweets?
Empty tweets (media-only) are skipped. If text tweets also lack buttons after an X UI update, report an issue or adjust POST_TEXT_SELECTORS in src/constants.js.
Cache growing large?
Lower Cache hours, clear it in Settings, or watch the usage meter (soft ~2 MB budget with LRU eviction).
| NemoKing | @NemoKing1210 |
| [email protected] | |
| Repo | github.com/NemoKing1210/x-translator |
Issues and ideas: GitHub Issues.
MIT — Copyright (c) 2026 NemoKing