Code Illusion
Make your code speak Chinese — or Japanese, Korean, Pirate, Leet, Emoji, Klingon…
One click to translate, one click to get everything back. Exactly as it was.

Français
Code Illusion is a visual illusion, not a refactoring tool. Your program keeps
running exactly the same, because by default nothing in your file changes — the
translation is painted over the editor with decorations.
// before // after (preview mode)
export async function getUserConfig() { 导出 异步 函数 获取用户配置() {
const response = await fetchData(); 常量 响应 = 等待 拉取数据();
if (!response) return null; 如果 (!响应) 返回 空;
} }
Features
- Instant. Translating a 10 000-line file takes a few milliseconds; only the
visible part of the file is ever decorated.
- Perfectly reversible. Preview mode never touches the buffer. Write mode keeps
a verbatim snapshot plus a per-replacement undo log, and a local history that
survives a window reload.
- 13 languages built in: Chinese, Japanese, Korean, Pirate, Leet, Emoji,
Latin, Hieroglyphs, Alien, Binary, Morse, Matrix, Klingon.
- Works everywhere: JavaScript, TypeScript, React, Vue, Svelte, Python, Go,
Rust, PHP, Java, C#, C/C++, HTML, CSS, SCSS, JSON, YAML, Markdown, SQL, Ruby,
Lua, shell… and anything else, thanks to a generic fallback.
- Selection support. Translate (or restore) just the lines you highlighted.
- One panel for everything. A native side panel in the activity bar — plain
monochrome icons, no emoji anywhere in the interface.
- Extensible by design. A new language is one file exporting a dictionary.
Usage
Open the Code Illusion icon in the activity bar. Everything lives in one
panel: translate or restore, pick a language, switch mode, and toggle what gets
translated — one click per row, no dialog, no configuration file to edit.

You can also use the status bar item, the keyboard (Ctrl/Cmd+Alt+T to toggle,
Ctrl/Cmd+Alt+L for the language menu) or the command palette.

| Command |
Default keybinding |
| Code Illusion: Translate Current File |
|
| Code Illusion: Restore Current File |
|
| Code Illusion: Toggle Translation |
Ctrl/Cmd+Alt+T |
| Code Illusion: Choose Language |
Ctrl/Cmd+Alt+L |
| Code Illusion: Translate Selection |
|
| Code Illusion: Restore Selection |
|
| Code Illusion: Restore All Open Files |
|
| Code Illusion: Open Menu |
Ctrl/Cmd+Alt+L |
The two modes
|
Preview (default) |
Write |
| File on disk |
never modified |
actually rewritten |
| Undo |
instantaneous, nothing to undo |
Restore, Ctrl+Z, or the local history |
| Git diff |
empty |
shows the translation |
| Use it for |
screenshots, demos, fun, live coding |
pranks that need to survive a save |
Write mode always snapshots the original before changing anything. If the file
changed since it was translated, restoring asks for confirmation instead of silently
overwriting your work.
Settings
| Setting |
Default |
Description |
codeIllusion.defaultLanguage |
zh |
Language pack used when translating |
codeIllusion.mode |
preview |
preview (visual only) or write (real edits) |
codeIllusion.animations |
true |
Short reveal animation |
codeIllusion.notifications |
true |
Toast notifications instead of status bar messages |
codeIllusion.statusBar.show |
true |
Show the status bar item |
codeIllusion.history.keep |
true |
Keep write-mode snapshots |
codeIllusion.history.maxEntries |
50 |
Size of the local history |
codeIllusion.translate.keywords |
true |
Translate if, return, function… |
codeIllusion.translate.identifiers |
true |
Translate variables, functions, classes |
codeIllusion.translate.comments |
true |
Translate words inside comments |
codeIllusion.translate.strings |
false |
Translate words inside string literals |
codeIllusion.preview.color |
"" |
Force a color for the overlay (empty = theme colors) |
codeIllusion.maxFileSize |
2000000 |
Skip files larger than this (characters) |
Installation
From the Marketplace: search for Code Illusion in the Extensions view, or
code --install-extension devcraft.code-illusion
From a local build:
npm install
npm run package # produces code-illusion-1.0.0.vsix
code --install-extension code-illusion-1.0.0.vsix
Adding a language
Create src/translator/languages/yourLanguage.ts:
import type { LanguagePack } from '../types';
export const yourLanguage: LanguagePack = {
id: 'yours',
label: 'Your language',
icon: '🎈',
description: 'What it does',
keywords: { if: '…', return: '…' },
identifiers: { user: '…', data: '…' }, // keys must be lowercase
words: { hello: '…' }, // used inside comments
joiner: 'concat', // or 'preserve' to keep _ and camelCase
transform: (word) => undefined // optional algorithmic fallback
};
Register it in src/translator/registry.ts and add its id to the
codeIllusion.defaultLanguage enum in package.json. Nothing else changes — the
engine, the UI and the commands are language-agnostic.
Known limitations
- In preview mode the real text is still under the overlay: selecting, searching
and moving the caret work on the original characters. That is deliberate — it is
what keeps the illusion perfectly safe.
- The translation is word-based and intentionally naive. It is an illusion, not
a translator.
Contributing
See docs/DEVELOPMENT.md.
License
MIT
| |