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

locai

v2.7.1

Published

CLI that translates JSON locale files with AI providers (OpenAI, Anthropic, Gemini, DeepSeek, xAI, DashScope).

Readme

Locai

CI

AI translation for JSON locale files.

Locai translates the JSON locale files of your project (en.json or en/translation.json) with an AI provider of your choice, from a single command. It works with any project that keeps its translations in JSON, for example Next.js, React or Vue apps using i18next.

🚀 Quick Start

Run it with npx, without installing anything:

# Translates your ./locales from English to Turkish, Spanish, and German
npx locai translate --source en --targets tr,es,de

Need a permanent setup? See the Configuration Guide to create a localize.config.ts file.

📖 Documentation

Getting Started

Introduction, installation options, and setting up your API keys.

Configuration Guide

Detailed guide on localize.config.ts, the supported locale file layouts, and advanced settings.

CLI Reference

Learn about translate, fix, review, and validate-config.

Providers

Supported providers (OpenAI, Anthropic, Gemini, DeepSeek, Dashscope, XAI), their default models, API keys, rate limits and fallback.

Core Concepts

How Locai's features work:

  • Context Categories: You define categories (keywords plus a prompt) in context.categories. When a string contains enough of a category's keywords, that category's prompt is added to the translation request. There are no built-in categories. AI classification of longer strings is optional (context.useAI, off by default).
  • Deep Context Analysis: Finds where each key is used in your TypeScript/TSX code (t("key") calls) and sends that usage with the translation request: file and line, component name, nearby comments, JSX props and a short code snippet. Turn it off with deepContext: false or --no-deep-context.
  • Vector Memory (optional): With vectorMemory.enabled: true, Locai stores OpenAI embeddings of translated strings in a local database. Near-identical strings (similarity ≥ 0.98) reuse the stored translation without a translation call; similar ones (≥ 0.85) are given to the model as a reference. Requires OPENAI_API_KEY, and each new string costs an embedding request.
  • Smart Sync: Locai stores a hash of each source string. A key is translated when it is missing from a target file or its source text changed since the last run. If you have 1000 translated keys and change 5, only those 5 are sent to the AI. Keys removed from the source file are removed from the target files.
  • Glossary & Brand Safety: Define protected terms (like "Locai", "API", "SaaS"). Locai swaps them for placeholder tokens in the text being translated, then restores your configured translation, so the model does not see or translate those terms in that text. (Source code sent by Deep Context Analysis is not tokenized.)
  • Auto-Fix: After each translation, rule-based checks repair what they can: unbalanced quotes, missing or damaged placeholders ({name}, ${name}, %s, %d), HTML tags and ending punctuation, plus markdown, code blocks and special characters if you turn those rules on. The checks do not reject a translation.
  • Provider Fallback: With useFallback (on by default), a failed request is retried with the other providers that have an API key set.
  • Confidence Scoring (opt-in): Each new translation gets a score (0-1) computed from checks on the translation itself: lost placeholders or HTML tags, untranslated text, leftover model commentary, unusual length or punctuation. Low scores are flagged for review; very low ones are not written to the locale file.
  • Interactive Review: locai review steps through the saved review queue in the terminal so you can approve or edit flagged translations; the ones you approve or edit are written to the locale file.

Development Guide

Contributing to Locai? Learn how to build, test, and run the project locally.

✨ Why Locai?

  • JSON Locale Files: Works with any project that stores translations as JSON (<lang>.json or <lang>/translation.json).
  • Fewer API Calls: Only new, changed or missing keys are sent to the AI. Strings already translated in the current run, or found in vector memory when it is enabled, are reused instead of triggering another translation call.
  • Flat or Nested Layout: Supports flat (en.json) and nested (en/translation.json) layouts. Target files are written in the same layout as the source file. The nested layout requires the file name translation.json.
  • TypeScript Config: localize.config.ts with types via defineConfig from locai/config.

🤝 Community & Contributing

We welcome contributions! Please see our Contributing Guide for details.

This project is governed by a Code of Conduct to ensure a welcoming environment for everyone.

📄 License

This project is licensed under the MIT License.