TypeGlot VS Code Extension
The VS Code extension provides in-editor features for working with TypeGlot translations.
Installation
Direct Download
⬇️ Download TypeGlot v0.1.0 (.vsix)To install: Open VS Code → Command Palette (Cmd/Ctrl + Shift + P) → "Extensions: Install from VSIX..." → Select the downloaded file.
From VS Code Marketplace
Search for "TypeGlot" in the VS Code Extensions view (Cmd/Ctrl + Shift + X).
From Source
cd packages/vscode
pnpm install
pnpm run packageThen install the .vsix file from the command palette: "Extensions: Install from VSIX..."
Features
Inline Translation Decorations
See translation values directly in your code:
const greeting = m.welcome; // → "Welcome, {name}!"The translated value appears as a subtle annotation after the code.
Code Actions
Quick fixes appear when your cursor is on a translation key:
- Translate with AI — Generate translations for the key
- Go to Translation — Jump to the locale file
- Extract String — Convert a hardcoded string to a translation key
Commands
Access commands via the Command Palette (Cmd/Ctrl + Shift + P):
| Command | Description |
|---|---|
TypeGlot: Initialize Project | Set up TypeGlot in workspace |
TypeGlot: Translate Key with AI | Generate AI translation |
TypeGlot: Open Translation Dashboard | Launch local UI |
TypeGlot: Refresh Translation Decorations | Update inline previews |
Configuration
Settings
Configure the extension in VS Code settings:
{
"typeglot.showInlineTranslations": true,
"typeglot.previewLocale": "en",
"typeglot.aiProvider": "copilot"
}| Setting | Type | Default | Description |
|---|---|---|---|
showInlineTranslations | boolean | true | Show inline translation decorations |
previewLocale | string | "en" | Locale to preview in decorations |
aiProvider | string | "copilot" | AI provider for translations |
AI Providers
| Provider | Requirements |
|---|---|
copilot | GitHub Copilot extension installed |
openai | OPENAI_API_KEY in environment |
anthropic | ANTHROPIC_API_KEY in environment |
Activation
The extension activates when:
- A
typeglot.config.jsonfile exists in the workspace - A
.typeglotrcfile exists in the workspace
Usage
Viewing Translations
- Open a TypeScript/JavaScript file
- Hover over
m.key_nameto see the translation - Or view inline decorations (if enabled)
Translating a Key
- Place cursor on a translation key
- Press
Cmd/Ctrl + .to open Quick Fix menu - Select "TypeGlot: Translate with AI"
- Enter target locales when prompted
Opening the Dashboard
- Open Command Palette (
Cmd/Ctrl + Shift + P) - Type "TypeGlot: Open Translation Dashboard"
- The dashboard opens in your browser
Development
Building
cd packages/vscode
pnpm run buildWatch Mode
pnpm run watchDebugging
- Open the
packages/vscodefolder in VS Code - Press
F5to launch Extension Development Host - Test the extension in the new window
Packaging
pnpm run packageCreates typeglot-vscode-{version}.vsix.
Extension Manifest
Key contributions in package.json:
{
"contributes": {
"commands": [
{
"command": "typeglot.init",
"title": "TypeGlot: Initialize Project"
}
],
"configuration": {
"title": "TypeGlot",
"properties": {
"typeglot.showInlineTranslations": {
"type": "boolean",
"default": true
}
}
}
}
}Architecture
packages/vscode/
├── src/
│ ├── extension.ts # Entry point, activation
│ ├── decorations.ts # Inline translation previews
│ └── code-actions.ts # Quick fix provider
├── package.json # Extension manifest
└── tsconfig.jsonExtension Entry Point
// extension.ts
export function activate(context: vscode.ExtensionContext) {
// Register commands
// Set up decorations
// Initialize code actions
}
export function deactivate() {
// Cleanup
}Decoration Provider
// decorations.ts
export class TranslationDecorator {
updateDecorations(editor: vscode.TextEditor) {
// Find m.key patterns
// Load translation values
// Apply decorations
}
}Code Action Provider
// code-actions.ts
export class TranslationCodeActionProvider {
provideCodeActions(document, range) {
// Detect translation keys
// Offer quick fixes
}
}Dependencies
@typeglot/core— Shared logicvscode— VS Code API typesesbuild— Bundling