https://github.com/hsayed21/json-i18n-key
Json I18n Key is a VSCode extension for managing i18n translation keys with features like key navigation, renaming, auto-completion, and AI translation suggestions
https://github.com/hsayed21/json-i18n-key
vscode vscode-extension
Last synced: about 1 month ago
JSON representation
Json I18n Key is a VSCode extension for managing i18n translation keys with features like key navigation, renaming, auto-completion, and AI translation suggestions
- Host: GitHub
- URL: https://github.com/hsayed21/json-i18n-key
- Owner: hsayed21
- License: mit
- Created: 2024-09-14T20:29:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-02T11:09:11.000Z (about 1 year ago)
- Last Synced: 2025-05-02T12:19:43.884Z (about 1 year ago)
- Topics: vscode, vscode-extension
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=hsayed.json-i18n-key
- Size: 1.58 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Json I18n Key | Download
**Json I18n Key** is a Visual Studio Code extension designed to streamline internationalization (i18n) workflows in JSON files. It provides efficient key-path translations, hover tooltips, auto-completion, renaming keys, and AI-powered translation suggestions using GitHub Copilot. The extension helps developers easily manage translation keys across multiple language files.
> This project was inspired by [jsonyamlkeynavigator](https://github.com/shanmuganathan-balaraman/jsonyamlkeynavigator), and some of its code has been adapted to suit the needs of this extension.
## Features
- **Find Translation Key**: Quickly locate and navigate to a translation key in your JSON translation files.
- **Add Translation Key**: Add new translation keys seamlessly across multiple language files (e.g., English, Arabic).
- **Rename Translation Key**: Rename translation keys in all translation files where they exist.
- **Hover to View Translation**: See the translation of a key while hovering over it in the editor.
- **Auto-completion**: Get suggestions for translation keys while typing, making it easier to use and manage your i18n keys.
- **Multi-language Support**: Supports various languages like `en`, `ar`, or any other language files configured.
- **Copilot AI Auto-Translate**: Automatically generate translation suggestions for new keys using GitHub Copilot AI, enhancing the translation workflow.
- **Translation Path Configuration**: Customize your translation file paths and define the default language in your project’s settings.
- **Search Keys and Values**: Search for keys or values that contain a specific string.
- **Suggest Existing Keys for Reuse**: When adding a new translation key, the extension will suggest existing keys for reuse to avoid redundancy.
- **Cleanup Unused Translation Keys**: Detect and clean up unused translation keys.
- **Diagnostics and Quick Fixes**: Automatically detect missing translation keys in your code and provide quick fixes to add them.
- **Copy Existing Translation Key**: Copy values from existing translation keys to new or updated keys, ensuring consistency and saving time.
- **Auto Reference Updates**: Automatically updates all references to translation keys when renamed.
## How to Use
1. **Configure Translation Files**:
- Create a `.vscode/settings.json` file in your project and add the following configuration, adjusting the paths as needed:
```json
{
"json-i18n-key.translationFiles": [
{
"lang": "en",
"filePath": "C:\\Projects\\Project\\src\\assets\\i18n\\en.json",
"isDefault": true
},
{
"lang": "ar",
"filePath": "C:\\Projects\\Project\\src\\assets\\i18n\\ar.json",
"isDefault": false
}
]
}
```
> This configuration can be set per project or globally in your VSCode settings.
2. **Keybindings**:
- Use default keybindings or customize them in your VSCode keybindings settings.
## Extension Features in Action
- **Find Translation Key**: Instantly navigate to the key in all translation files and highlight its position.

- **Add Translation Key with Copilot AI Auto-Translate**: Automatically generate translations when adding keys.

- **Rename Translation Key**: Rename keys consistently across all translation files.

- **Hover to View Translation**: See translation details by hovering over keys in the editor.

- **Auto-completion Suggestions**: Get intelligent key suggestions as you type.

## Future TODO
- [x] Cache keys and refresh caching when files change "Optimize Search".
- [ ] Support multiple translation APIs (Google, DeepL, Microsoft).
- [ ] Allow fallback behavior if the preferred API fails.
- [x] Custom key formats when created or renamed allow options like PascalCase, snake_case, camelCase, kebab-case.
- [ ] Statusbar action copy full translation path.
- [x] Key validation warn users of duplicate keys when added or updated.
- [x] Diagnostics check translation files for issues and suggest quick fixes.
- [x] Option Auto-detect i18n translation files within a project.
- [x] Maintain original JSON formatting (spaces, indentation) to avoid unnecessary git diffs.
- [ ] Sync missing translations ensure consistency across languages.
- [ ] Display inline hover editor for translation keys in code.
- [x] Search for keys or values that contain a specific string.
- [ ] Auto-merge similar keys to reduce redundancy.
- [x] Suggest existing keys for reuse when adding new ones.
- [x] Rename keys and update references in code automatically.
- [x] Detect and clean up unused translation keys.
- [x] Copy values from existing translation keys to new or updated keys.
## Contributing
Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
## License
This project is licensed under the [MIT License](LICENSE.txt) - see the LICENSE file for details.