localize-ai
Advanced tools
+1
-1
| { | ||
| "name": "localize-ai", | ||
| "version": "1.5.0", | ||
| "version": "1.5.1", | ||
| "description": "AI-powered React localization with AST-based extraction, namespace-based loading, smart caching, debug mode and multi-provider support", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+85
-0
@@ -43,2 +43,3 @@ # localize-ai | ||
| - ๐ Debug mode (highlight translated & missing strings in UI) | ||
| - ๐งช Dry-run mode (preview extraction & translation without modifying files) | ||
@@ -126,2 +127,85 @@ --- | ||
| ## ๐ Debug Mode | ||
| localize-ai provides a built-in debug mode to visualize translation status directly in your UI. | ||
| Enable debug mode: | ||
| ``` | ||
| <LanguageContextProvider debug={true}> | ||
| <App /> | ||
| </LanguageContextProvider> | ||
| ``` | ||
| Behavior: | ||
| ๐ข Translated strings โ highlighted in green | ||
| ๐ก Missing translations โ highlighted in custom color | ||
| Configure debug color: | ||
| ``` | ||
| // localize.config.js | ||
| export default { | ||
| sourceLanguage: "en", | ||
| translationLanguages: ["hi", "fr", "es", "ar"], | ||
| provider: "gemini", | ||
| apikey: "VITE_GEMINI_API_KEY", | ||
| debugColor: "yellow", | ||
| context: "Kit kat condolence message page" | ||
| }; | ||
| ``` | ||
| ๐ Helps quickly identify missing translations during development. | ||
| --- | ||
| ## ๐งช Dry Run Mode | ||
| localize-ai supports a dry-run mode to preview the entire localization pipeline without writing any translations. | ||
| Run dry-run: | ||
| ``` | ||
| npx localize-ai translate --dry-run | ||
| ``` | ||
| What it does: | ||
| * Extracts strings using AST | ||
| * Validates template literals | ||
| * Detects missing / partial translations | ||
| * Shows summary without modifying files | ||
| * Example output: | ||
| ``` | ||
| ๐งช Running dry-run (no translations will be made)... | ||
| โ Invalid template literal detected | ||
| ๐ File: src/App.jsx | ||
| ๐ Line: 82 | ||
| ๐ Use {{var}} instead of ${var} | ||
| โ Extraction complete with namespaces | ||
| โ Cleaned namespaces: 2 | ||
| ๐ Starting localization pipeline | ||
| โน๏ธ Provider: gemini | ||
| โน๏ธ Source Language: en | ||
| โน๏ธ Target Languages: hi, fr, es, ar | ||
| ๐ Summary: | ||
| Total input strings: 22 | ||
| ๐ New strings: 0 | ||
| ๐ Missing translations: 0 | ||
| โ ๏ธ Partial translations: 0 | ||
| Translated now: 0 | ||
| Total stored translations: 22 | ||
| โ Done | ||
| ``` | ||
| Why use dry-run? | ||
| ๐ก๏ธ Safe preview before running translations | ||
| ๐ Catch errors (like invalid template literals) | ||
| ๐ Understand translation coverage | ||
| ๐ Ideal for CI checks and debugging. | ||
| --- | ||
| ## ๐ฆ Installation | ||
@@ -309,2 +393,3 @@ | ||
| npx localize-ai delete-sync # delete dead translations | ||
| npx localize-ai translate --dry-run # preview without writing files | ||
| ``` | ||
@@ -311,0 +396,0 @@ |
81677
2.58%487
21.14%