npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

leximind-i18n

v0.2.0

Published

🌍 Next-gen multilingual translation engine for React β€” smart caching, auto-detection, advanced utilities, and blazing-fast performance

Readme

🧠 LexiMind i18n

The Best Multilingual Translation Engine for React

npm version npm downloads license GitHub stars

Make your React apps speak every language β€” with smart caching, advanced utilities, and unmatched performance.

πŸ“š Documentation β€’ πŸš€ Quick Start β€’ πŸ’‘ Examples β€’ πŸ› Report Bug


✨ Features

⚑ Lightning Fast

Smart caching system for offline support and instant translations.

πŸ” Intelligent Detection

Auto-detects language from URL, localStorage, browser, and HTML tags.

πŸͺΆ Lightweight & Powerful

Small bundle size with enterprise-grade features.

🎨 Advanced Formatting

Built-in date, number, and currency formatting with Intl API.

🌐 Dynamic Loading

Lazy load translations on demand with preloading support.

🎯 Developer-Friendly

Context Provider, utilities, performance monitoring, and TypeScript ready.

πŸš€ Production Ready

Translation validation, error handling, and performance insights.

πŸ”§ Highly Extensible

Rich utilities for pluralization, gender, markdown, and context.


πŸš€ Quick Start

Installation

npm install leximind-i18n i18next react-i18next

Basic Usage

import { initLexiMind, useLexiMind } from 'leximind-i18n'

// Initialize once in your app entry point
await initLexiMind({
  resources: {
    en: { translation: { welcome: 'Welcome', hello: 'Hello, {{name}}!' } },
    es: { translation: { welcome: 'Bienvenido', hello: 'Β‘Hola, {{name}}!' } },
    fr: { translation: { welcome: 'Bienvenue', hello: 'Bonjour, {{name}}!' } }
  },
  fallbackLng: 'en'
})

// Use in any component
function App() {
  const { language, setLanguage, t } = useLexiMind()
  
  return (
    <div>
      <h1>{t('welcome')}</h1>
      <p>{t('hello', { name: 'World' })}</p>
      
      <button onClick={() => setLanguage('en')}>πŸ‡ΊπŸ‡Έ English</button>
      <button onClick={() => setLanguage('es')}>πŸ‡ͺπŸ‡Έ EspaΓ±ol</button>
      <button onClick={() => setLanguage('fr')}>πŸ‡«πŸ‡· FranΓ§ais</button>
    </div>
  )
}

That's it! πŸŽ‰ Your app is now multilingual.


πŸ“– Core API

initLexiMind(options)

Initialize the translation engine with advanced caching and detection.

await initLexiMind({
  resources: { /* your translations */ },
  fallbackLng: 'en',
  cache: true,              // Enable smart caching (default: true)
  cacheVersion: '1.0.0',    // Cache version for invalidation
  backend: {
    loadPath: '/locales/{{lng}}/{{ns}}.json'
  },
  onLanguageChange: (lng) => {
    console.log('Language changed to:', lng)
  }
})

useLexiMind() Hook

React hook for component-level translations.

const { 
  language,      // Current language code
  setLanguage,   // Change language function
  t,             // Translation function
  ready,         // Initialization status
  i18n          // i18next instance
} = useLexiMind()

LexiMindProvider - Context Provider

Wrap your app for global translation access.

import { LexiMindProvider } from 'leximind-i18n/provider'

<LexiMindProvider onLanguageChange={(lng) => console.log(lng)}>
  <App />
</LexiMindProvider>

Advanced Utilities

import { 
  getLanguage,          // Get current language
  getAllLanguages,      // Get all loaded languages
  clearCache,           // Clear translation cache
  formatDate,           // Format dates with i18n
  formatNumber,         // Format numbers
  formatCurrency,       // Format currency
  preloadLanguages,     // Preload languages
  exists,               // Check if key exists
  getSafe               // Get translation with fallback
} from 'leximind-i18n'

// Format dates
formatDate(new Date(), 'fr') // "15 janv. 2025"

// Format currency
formatCurrency(99.99, 'EUR', 'de') // "99,99 €"

// Preload languages for better UX
await preloadLanguages(['es', 'fr', 'de'])

Translation Utilities

import {
  pluralize,              // Smart pluralization
  translateWithContext,   // Context-aware translations
  translateWithGender,    // Gender-specific translations
  batchTranslate,        // Batch multiple translations
  validateTranslations,  // Validate translation coverage
  translateMarkdown      // Markdown support
} from 'leximind-i18n/utils'

// Pluralization
pluralize('item', 5) // Uses count for plural forms

// Context-aware (formal/informal)
translateWithContext('greeting', 'formal')

// Validate coverage
const result = validateTranslations(['key1', 'key2'])
console.log(result.coverage) // "100%"

Performance Monitoring

import { 
  getPerformanceInsights,
  logPerformanceReport 
} from 'leximind-i18n/performance'

// Get metrics
const metrics = getPerformanceInsights()
console.log(metrics.cacheHitRate) // "95.3%"

// Log full report (dev only)
logPerformanceReport()

πŸ’‘ Advanced Examples

await initLexiMind({
  backend: {
    loadPath: 'https://cdn.example.com/locales/{{lng}}/{{ns}}.json',
    crossDomain: true
  },
  fallbackLng: 'en'
})
{
  "item": "{{count}} item",
  "item_plural": "{{count}} items",
  "item_zero": "No items"
}
t('item', { count: 0 })  // "No items"
t('item', { count: 1 })  // "1 item"
t('item', { count: 5 })  // "5 items"
{
  "user": {
    "profile": {
      "title": "User Profile",
      "edit": "Edit Profile"
    }
  }
}
t('user.profile.title')  // "User Profile"
const languages = [
  { code: 'en', name: 'English', flag: 'πŸ‡ΊπŸ‡Έ' },
  { code: 'es', name: 'EspaΓ±ol', flag: 'πŸ‡ͺπŸ‡Έ' },
  { code: 'fr', name: 'FranΓ§ais', flag: 'πŸ‡«πŸ‡·' }
]

function LanguageSwitcher() {
  const { language, setLanguage } = useLexiMind()
  
  return (
    <select value={language} onChange={(e) => setLanguage(e.target.value)}>
      {languages.map(lang => (
        <option key={lang.code} value={lang.code}>
          {lang.flag} {lang.name}
        </option>
      ))}
    </select>
  )
}

πŸ“š View all examples β†’


πŸ“¦ What's Included

  • βœ… Automatic language detection (browser + localStorage)
  • βœ… Instant language switching (no page reload)
  • βœ… Local and remote translation loading
  • βœ… React hooks API (useLexiMind)
  • βœ… Global translation helper (t())
  • βœ… Nested translation keys
  • βœ… Variable interpolation (Hello, {{name}})
  • βœ… Pluralization support
  • βœ… Namespace support
  • βœ… Missing key warnings
  • βœ… localStorage persistence
  • βœ… TypeScript support (coming soon)

πŸ› οΈ Built With

LexiMind is a lightweight wrapper around these battle-tested libraries:


πŸ“š Documentation


🀝 Contributing

Contributions are welcome! Feel free to:


πŸ“„ License

MIT Β© Rohan Singh


πŸ’¬ Support


Made with ❀️ for the React community

If you find this useful, please ⭐ star the repo!