i18n Translation Finder
A VS Code extension that provides bidirectional navigation and unused key detection for i18next translations in the gestao-contratadas-full-stack
codebase.
Features
🔄 Bidirectional Navigation
- Go to Definition: Ctrl+click on
i18n.t('key.path')
to navigate to the translation definition
- Find All References: Ctrl+click on translation keys to see all usage locations
🔍 Unused Key Detection
- Red squiggly lines under translation keys that aren't used anywhere in the codebase
- Real-time validation as files are edited
- Hover over translation keys to see their values and usage statistics
- Hover over
i18n.t()
calls to see the translated text
Usage
- Open the
gestao-contratadas-full-stack
project in VS Code
- The extension will automatically scan for translation files and usage patterns
- Use Ctrl+click on translation keys or
i18n.t()
calls to navigate
- Unused translation keys will be highlighted with red squiggly lines
Configuration
The extension can be configured via VS Code settings:
{
"i18nTranslationFinder.translationPaths": [
"src/translate/languages/**/*.ts",
"src/translate/languages/**/*.js"
],
"i18nTranslationFinder.usageFilePatterns": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx"
],
"i18nTranslationFinder.excludePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/out/**",
"**/.git/**"
]
}
Development
This extension is specifically designed for the gestao-contratadas-full-stack
codebase structure and may not work with other i18n setups.
Running the Extension
- Press
F5
to open a new Extension Development Host window
- Open the
gestao-contratadas-full-stack
folder
- Test the navigation and unused key detection features
Architecture
The extension consists of several key components:
- TranslationRegistry: Central registry that maps translation keys to their definitions and usages
- TranslationFileScanner: Parses translation files using AST analysis
- UsageScanner: Finds
i18n.t()
calls using regex patterns
- Language Providers: Implement VS Code's definition, reference, hover, and diagnostic features
Supported Patterns
The extension recognizes these i18n usage patterns:
i18n.t('key.path')
i18n.t("key.path")
i18n.t(\
key.path`)`
t('key.path')
(destructured import)
Limitations
- Designed specifically for the current codebase structure
- Does not support dynamic key construction (e.g.,
i18n.t(\
${prefix}.${suffix}`)`)
- Only supports Portuguese translations currently
Version History
0.0.1
- Initial release with bidirectional navigation and unused key detection