Mmohebifar

i18n-pro-codemod

I18nize your codebase

transformationmigration
PRO
2 downloads
1 stars
How to Use
Run this codemod on your codebase using one of the following commands
Codemod PRO

This codemod is only available to PRO users.

Documentation

i18n-pro-codemod

Automatically extract hardcoded strings and internationalize your React codebase

This pro codemod intelligently identifies hardcoded text in your React components and transforms them into properly internationalized code using modern i18n libraries like next-intl or react-i18next.

🚀 Features

  • AI-powered: Uses advanced AI to generate meaningful translation keys and handle complex string patterns
  • Multi-library support: Works with next-intl and react-i18next
  • Smart Sharding: Handles large codebases by intelligently splitting work across teams/directories
  • Automated PR creation: Creates pull requests with proper reviews and formatting
  • Message catalog management: Automatically creates and updates translation files
  • Context-aware: Preserves code structure and handles complex JSX patterns

🔧 How It Works

The codemod scans your React/TypeScript files for hardcoded strings in JSX elements and transforms them into internationalized code:

Before

tsx

After

tsx

Generated Message Catalog (messages/en.json)

json

🔥 Advanced Interpolation Examples

The codemod handles complex scenarios with ICU syntax, including variables, pluralization, and rich text:

Variable Interpolation

Before:

tsx

After:

tsx

Generated Catalog:

json

Complex Conditional Logic

Before:

tsx

After:

tsx

Generated Catalog:

json

Rich Text with Components

Before:

tsx

After:

tsx

Generated Catalog:

json

🎯 What Gets Transformed

  • Hardcoded text in JSX elements (<div>text</div>)
  • String literals in JSX attributes
  • Complex nested text structures
  • Preserves existing component logic and structure

⚙️ Configuration Options

  • Library: Choose between next-intl or react-i18next
  • Sharding Method: Process large codebases by codeowner or directory
  • Catalog File Selection: Default structure or custom Zap package organization
  • AI Review: Automated code review and quality checks
  • Custom Scripts: Pre/post-run hooks for additional processing

💼 Professional Version

This is a professional codemod that requires a license for commercial use.

To access this codemod, please contact us for:

  • Enterprise licensing
  • Custom configuration support
  • Priority support and updates
  • Team training and onboarding

Ready to contribute?

Build your own codemod and share it with the community.