Translate Me
Visual Studio Marketplace Version Visual Studio Marketplace Downloads
Automatically detects hardcoded strings in Flutter projects to facilitate internationalization (i18n).
🔗 Links
⚡ Features
- 🔍 Smart Detection: Automatically scans .dart files for hardcoded strings in 40+ Flutter widgets
- 🎯 Hybrid System: Fast known widget patterns + custom widget detection
- 🚫 Flexible Ignoring: Three types of ignore comments for different scenarios
- ⚡ Real-time Updates: Automatic scanning on save with debounced performance
- 🎨 Visual Diagnostics: Clear yellow underlines in the editor
- 🔄 Toggle Control: Enable/disable detection on demand
⚡ Commands
Access from the Command Palette (⇧⌘P
/ Ctrl+Shift+P
):
Translate Me: Scan
Manually scans the entire workspace for hardcoded strings.
- Note: Only works when detection is enabled
- Use case: Force a complete workspace scan
Translate Me: Toggle Detection
Enable or disable hardcoded string detection globally.
💡 Quick Actions
Ignore Strings: Right-click a hardcoded string (or quick fix it with ⌘.
/ Ctrl+.
) and select from three ignore options:
Available Actions:
Ignore this string (add comment on line above) - Most common approach
// translate-me-ignore-next-line
Text('Hello World')
Ignore this string (add comment at end of line) - Inline approach
Text('Hello World'), // translate-me-ignore
Ignore ALL strings in this file - File-level approach
// translate-me-ignore-all-file
class MyWidget extends StatelessWidget {
// All strings from this point onwards are ignored
}
🚀 Getting Started
- Install the extension from the VS Code Marketplace
- Open a Flutter project with
.dart
files
- Write Flutter code with hardcoded strings:
Text('Hello World')
AppBar(title: Text('My App'))
- See yellow underlines appear on hardcoded strings
- Choose your approach:
- Use Quick Actions (
⌘.
/ Ctrl+.
) to ignore specific strings
- Use
Translate Me: Toggle Detection
to disable all warnings globally
🔧 Automatic Detection
The extension automatically scans for hardcoded strings in 40+ known Flutter widgets plus any custom widgets:
- Text widgets:
Text
, RichText
- Buttons:
ElevatedButton
, TextButton
, OutlinedButton
, IconButton
, CupertinoButton
- Navigation:
AppBar
, BottomNavigationBarItem
, Tab
, Drawer
, CupertinoNavigationBar
- Dialogs:
AlertDialog
, SimpleDialog
, SnackBar
, CupertinoAlertDialog
- Forms:
TextField
, TextFormField
, InputDecoration
, DropdownButton
- Lists:
ListTile
, Card
, Chip
, Badge
- Custom widgets: Automatically detected using intelligent pattern matching
No Configuration Required
- Works out of the box
- No setup needed
- Automatically detects custom widgets
The extension uses a two-tier hybrid detection system for optimal performance:
- Tier 1: Fast patterns for 40+ known widgets (~90% faster)
- Tier 2: Smart custom widget detection (fallback)
- Debounced scanning: Prevents excessive processing
- Toggle control: Disable detection entirely when not needed
Key Benefits
- ✅ Reduced CPU usage with optimized patterns
- ✅ Scalable for projects with hundreds of custom widgets
- ✅ Memory efficient processing
- ✅ Real-time updates without lag
🚫 Ignore System
The extension supports three types of ignore comments:
1. Single Line Ignore
Text('Hello'), // translate-me-ignore
2. Next Line Ignore
// translate-me-ignore-next-line
Text('World')
3. File-Level Ignore
// translate-me-ignore-all-file
Column(
children: [
Text('Debug info'),
Text('Version 1.0.0'),
],
)
// All strings from this point onwards are ignored automatically
📋 Workflow
- Write Flutter code with hardcoded strings
- Yellow underlines appear automatically
- Choose your approach:
- Option A: Use Quick Actions (
⌘.
/ Ctrl+.
) for specific strings
- Option B: Use
Toggle Detection
to disable all warnings globally
- Continue coding without distractions
💡 Pro Tips
- Toggle Detection is perfect for:
- 🎯 Focusing on other tasks
- 📊 Presentations or demos
- 🚀 When ready to work on i18n later
🔧 Technical Details
Architecture
- Clean Code: Meaningful names, small functions, single responsibility
- SOLID Principles: Proper separation of concerns and dependency management
- Modular Architecture: Each module has a specific responsibility
- Error Handling: Comprehensive error handling throughout
- Performance: Optimized for large codebases with debounced scanning
🛠️ Development
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Run extension in development
F5 in VS Code
🤝 Contributing
- Follow the existing modular architecture
- Maintain Clean Code principles and SOLID design
- Add comprehensive error handling
- Update documentation and tests
- Open issues and pull requests on GitHub
☕ Support
If you find this extension helpful, consider ⭐ starring the GitHub repository!