VS Code Extension
The LRM VS Code extension brings powerful localization tools directly into your IDE with real-time diagnostics, IntelliSense, and translation capabilities.
Installation
Install from the VS Code Marketplace:
- Open VS Code
- Press Ctrl+Shift+X to open Extensions
- Search for "LRM - .NET Localization"
- Click Install
Or install via command:
code --install-extension nickprotop.lrm
The extension supports .resx files, JSON resources, and i18next format. It auto-detects the format based on file naming patterns.
Quick Start
- Open a folder containing resource files (.resx or JSON)
- The extension automatically detects your resources
- Look for the LRM icon in the sidebar
- Click to open the Resource Tree View
Auto-Detection
The extension finds resources by looking for:
- .resx files:
Resources.resx,Resources.fr.resx - JSON (standard):
strings.json,strings.fr.json - i18next:
en.json,fr.jsoninlocales/folder
Features
Real-time Diagnostics
As you code, the extension scans for localization issues:
- Missing keys - Keys used in code but not in resources
- Unused keys - Keys in resources but not used in code
- Empty translations - Keys without values
- Duplicate keys - Same key defined multiple times
IntelliSense Autocomplete
Get autocomplete suggestions as you type localization keys:
// Type "Resources." to see suggestions
var text = Resources.Welcome_Title;
// Also works with indexers
var text = Resources["Welcome_Title"];
// And IStringLocalizer
_localizer["Welcome_Title"]
CodeLens
See key metadata directly in your resource files:
- Reference count - "12 references" shows how many times a key is used
- Language coverage - "3/5 languages" shows translation status
- Quick translate - Click to translate missing languages
- Warnings - Unused or duplicate key indicators
Go to Definition
Press F12 on a localization key to jump to its definition in the resource file.
Find References
Press Shift+F12 to find all usages of a key across your codebase.
Quick Fix Actions
When the extension detects issues, it offers quick fixes:
- Add missing key - Create the key in your resources
- Translate key - Translate to missing languages
- Remove unused key - Delete keys not used in code
Resource Editor
The built-in resource editor provides a visual interface for editing translations.
Opening the Editor
- Click the LRM icon in the sidebar
- Right-click a resource file → "Open in LRM Editor"
- Use Command Palette: "LRM: Open Resource Editor"
Editor Features
- Multi-language view - See all translations side by side
- Inline editing - Click any cell to edit
- Search - Filter by key name or value
- Status filters - Show only missing, empty, or all keys
- Bulk operations - Translate or delete multiple keys
Translation
Translation Providers
The extension supports multiple translation providers:
| Provider | API Key Required | Notes |
|---|---|---|
| MyMemory | No (default) | Free, good for small projects |
| Lingva | No | Free Google Translate frontend |
| Google Translate | Yes | High quality, fast |
| DeepL | Yes | Excellent for European languages |
| Azure Translator | Yes | Enterprise-grade |
| OpenAI | Yes | Context-aware AI translation |
| Claude | Yes | High quality AI translation |
| Ollama | No (local) | Private, runs locally |
Configuring API Keys
- Open VS Code Settings (Ctrl+,)
- Search for "LRM"
- Find "Translation Provider" and select your provider
- Enter your API key in the corresponding setting
Or use environment variables:
export LRM_GOOGLE_API_KEY="your-key"
export LRM_DEEPL_API_KEY="your-key"
export LRM_OPENAI_API_KEY="your-key"
Translating Keys
- Open a resource file or the Resource Editor
- Select one or more keys
- Right-click → "Translate" (or use CodeLens)
- Choose target languages
- Click "Translate"
Settings
Extension Settings
| Setting | Default | Description |
|---|---|---|
lrm.resourcePath |
Auto-detect | Path to resource files |
lrm.enableRealtimeScan |
true | Enable live diagnostics |
lrm.scanOnSave |
true | Scan files when saved |
lrm.translationProvider |
mymemory | Default translation provider |
lrm.enableCodeLens |
true | Show CodeLens in resource files |
lrm.scanCSharp |
true | Scan .cs files |
lrm.scanRazor |
true | Scan .cshtml/.razor files |
lrm.scanXaml |
true | Scan .xaml files |
Project Configuration
Create an lrm.json file in your project root:
{
"resourcePath": "./Resources",
"defaultLanguage": "en",
"translation": {
"provider": "deepl",
"preservePlaceholders": true
},
"scanning": {
"include": ["**/*.cs", "**/*.cshtml"],
"exclude": ["**/bin/**", "**/obj/**"]
}
}
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
| F12 | Go to Definition |
| Shift+F12 | Find All References |
| Ctrl+. | Quick Fix (add key, translate, etc.) |
| Ctrl+Shift+P | Command Palette (search "LRM") |
Commands
Available commands (via Command Palette):
LRM: Open Resource EditorLRM: Open DashboardLRM: Open SettingsLRM: Validate ResourcesLRM: Scan CodeLRM: Translate Selected KeysLRM: Add LanguageLRM: Export to CSVLRM: Import from CSV