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

i18nfix

v0.1.13

Published

CLI to check/fix i18n JSON files (keys, placeholders, untranslated)

Downloads

1,162

Readme

i18nfix

Write one language. Ship all languages.

A CLI to check, fix, and translate i18n locale files.

Supported formats (common):

  • JSON: .json
  • YAML: .yml / .yaml
  • JS/TS modules exporting an object: .js / .ts (export default { ... } or module.exports = { ... })

What it can do:

  • Detect issues: missing keys, extra keys, empty values, possibly-untranslated values, placeholder mismatches
  • Fix structure: add missing keys (optionally fill with base), optionally remove extras
  • Translate only the problematic keys using an LLM provider (OpenAI / Claude / Gemini / OpenRouter)

Status: MVP / work in progress.

Requirements

  • Node.js >= 18

Getting started (integrate into an existing project)

1) Install

npm i -D i18nfix

2) Create/update config (Q&A)

npx i18nfix config

This writes i18nfix.config.json in your project root.

3) (Optional) Create new language files

If you currently only have one language and want to scaffold additional languages:

# create ja.ts / fr.ts (skips existing files)
npx i18nfix new --langs fr,ja

By default, i18nfix will follow an existing filename pattern if present (e.g. en.tsfr.ts).

4) Add npm scripts

Add to your project's package.json:

{
  "scripts": {
    "i18n:config": "i18nfix config",
    "i18n:check": "i18nfix check",
    "i18n:fix": "i18nfix fix --in-place",
    "i18n:fix:drop-extra": "i18nfix fix --in-place --drop-extra-keys",
    "i18n:fix:translate": "i18nfix fix --in-place --translate",
    "i18n:fix:translate:verbose": "i18nfix fix --in-place --translate -v"
  }
}

5) (Optional) Enable translation via .env

Create .env in your project root:

OPENAI_API_KEY=xxx
# or: OPENROUTER_API_KEY / ANTHROPIC_API_KEY / GEMINI_API_KEY

Then add a translate section to i18nfix.config.json:

{
  "translate": {
    "provider": "openai",
    "apiKeyEnv": "OPENAI_API_KEY",
    "model": "gpt-4o-mini",
    "batchSize": 50,
    "concurrency": 3,
    "delayMs": 0
  }
}

5) CI example (GitHub Actions)

Create .github/workflows/i18nfix.yml:

name: i18nfix

on:
  pull_request:
  push:

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run i18n:check

Quick start (recommended workflow)

1) Create config (wizard)

npx i18nfix init
# or update later
npx i18nfix config

This writes i18nfix.config.json in the current directory.

2) Check

npx i18nfix check
# JSON report
npx i18nfix check --json

3) Fix + Translate (recommended)

npx i18nfix fix --in-place --translate

(If you only want structural fixes: npx i18nfix fix --in-place.)

Example included

Try the included example files:

npx i18nfix check --config examples/i18nfix.config.json
npx i18nfix fix --config examples/i18nfix.config.json --in-place --translate

What the example demonstrates:

  • zh.json is missing app.cta (will be added)
  • home.subtitle is identical to base (flagged as possibly untranslated)
  • placeholder mismatch: {name} vs {username}
  • printf mismatch: %s vs %d
  • extra key: app.extraKey

Config file

Default filename: i18nfix.config.json

Minimal example:

{
  "base": "locales/en.json",
  "targets": ["locales/zh.json"],
  "keyStyle": "auto",
  "placeholderStyle": ["auto"],
  "ignoreKeys": [],
  "treatSameAsBaseAsUntranslated": true
}

Translate (LLM providers)

Keys should be provided via environment variables (recommended). i18nfix will also auto-load a local .env file.

Defaults / behavior:

  • Batch translation is enabled when batchSize is set (recommended for speed). If a batch output is missing keys or fails validation, i18nfix automatically retries those items in single-item mode.
  • By default i18nfix validates placeholders + HTML tags + basic Markdown markers.
  • Translation cache is enabled by default (.i18nfix-cache/translations.jsonl).

Example:

{
  "translate": {
    "provider": "openai",
    "apiKeyEnv": "OPENAI_API_KEY",
    "model": "gpt-4o-mini",

    "batchSize": 50,
    "concurrency": 3,

    "retryCount": 3,
    "retryBaseDelayMs": 400,

    "cache": true,

    "delayMs": 0
    // maxItems is optional; when unset there is no limit
  }
}

Supported providers:

  • openai (env: OPENAI_API_KEY)
  • openrouter (env: OPENROUTER_API_KEY) — OpenAI-compatible endpoint
  • claude (env: ANTHROPIC_API_KEY)
  • gemini (env: GEMINI_API_KEY)

Language handling:

  • targetLang is inferred from the target filename when not provided (e.g. zh.json, ja.json, fr-FR.jsonzh, ja, fr).
  • from/to languages are printed by default during translation. Use translate --no-show-langs to hide.

Documentation

  • Website: https://zhanziyang.github.io/i18nfix/
  • Recommended workflow: https://zhanziyang.github.io/i18nfix/docs/guides/workflow

Reference docs in-repo:

  • CLI reference: docs/CLI.md
  • Config reference: docs/CONFIG.md

CLI notes

  • translate --mode:
    • default is all (only keys with issues)
    • missing / empty / untranslated are narrower modes
  • maxItems:
    • optional (default: no limit)
    • when set, i18nfix will translate at most that many strings per run and print how many remain.
  • output validation (default on):
    • placeholders must match
    • HTML tags must be preserved
    • basic Markdown markers must be preserved
  • caching (default on):
    • .i18nfix-cache/translations.jsonl

License

MIT