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

aikit-translator

v0.1.3

Published

AI-powered translation package for React applications

Downloads

11

Readme

ai-translator

Repository

Introduction

ai-translator is a React internationalization translation toolkit based on multiple AI models (such as ChatGPT, Grok, and DeepSeek), supporting multi-language batch translation, automatic extraction of translation keys, command-line batch processing, type safety, and high extensibility.


Features

  • Supports multiple AI translation models (ChatGPT, Grok, DeepSeek)
  • Supports mutual translation for 30+ commonly used languages
  • Supports automatic extraction of translation keys from React components and t() functions
  • Provides CLI tools for batch translation and key extraction
  • Type-safe and easily extensible
  • Supports multiple runtime environments (Node.js, Vite, Webpack)

Installation

npm install ai-translator
# or
pnpm add ai-translator

Usage in React

import { TranslationProvider, useTranslation } from "ai-translator";

function App() {
  return (
    <TranslationProvider
      config={{
        model: "chatgpt", // Supports chatgpt/grok/deepseek
        apiKey: "your-api-key",
        sourceLanguage: "en",
        targetLanguage: "zh",
      }}
    >
      <YourComponent />
    </TranslationProvider>
  );
}

function YourComponent() {
  const { translate, currentLanguage, setLanguage, isLoading } =
    useTranslation();

  const handleTranslate = async () => {
    const result = await translate("Hello, world!");
    console.log(result.text); // 你好,世界!
  };

  return (
    <div>
      <button onClick={handleTranslate} disabled={isLoading}>
        {isLoading ? "Translating..." : "Translate"}
      </button>
    </div>
  );
}

CLI Usage

Extract Translation Keys and Auto-Translate

npx ai-translator extract -i "src/**/*.{ts,tsx,js,jsx}" -o locales/en.json --translate -l zh ja ko fr de es ...

Directly Translate Files or Directories

npx ai-translator translate -f ./locales/en.json -m chatgpt -s en -t zh ja ko
npx ai-translator translate -d ./locales -m deepseek -s en -t fr de es

Extract and Translate in One Step

npx ai-translator i18n -i "src/**/*.{ts,tsx,js,jsx}" -o locales/en.json -m grok -s en -t zh ja ko fr de es

Supported Languages

  • English (en), Simplified Chinese (zh), Traditional Chinese (zh-TW), Japanese (ja), Korean (ko)
  • French (fr), German (de), Spanish (es), Italian (it), Portuguese (pt)
  • Russian (ru), Arabic (ar), Turkish (tr), Vietnamese (vi), Thai (th)
  • Indonesian (id), Hindi (hi), Malay (ms), Persian (fa), Hebrew (he)
  • Polish (pl), Dutch (nl), Swedish (sv), Finnish (fi), Danish (da)
  • Norwegian (no), Czech (cs), Greek (el), Hungarian (hu), Romanian (ro)

API Reference

TranslationProvider Props

| Prop | Type | Required | Description | | ------ | ----------------- | -------- | ------------------------- | | config | TranslationConfig | Yes | Translation configuration |

TranslationConfig

| Prop | Type | Required | Description | | -------------- | --------------------------------- | -------- | -------------------- | | model | 'grok' | 'chatgpt' | 'deepseek' | Yes | AI translation model | | apiKey | string | Yes | API key | | sourceLanguage | string | Yes | Source language | | targetLanguage | string | Yes | Target language | | baseUrl | string | No | API base URL |

useTranslation Hook

Returns:

| Prop | Type | Description | | --------------- | -------------------------------------------- | ------------------- | | translate | (text: string) => Promise | Translate text | | currentLanguage | Language | Current language | | setLanguage | (lang: Language) => void | Set language | | isLoading | boolean | Whether translating |


Environment Variables

  • AI_TRANSLATOR_API_KEY: API key for AI model

License

MIT


For detailed documentation, secondary development, or enterprise customization, please contact the [email protected].