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

@rtl-first/locale-scaffolder

v0.1.0

Published

Scaffold a new locale (ar.json) and wire it into any i18n system with one command

Readme

@rtl-first/locale-scaffolder

Scaffold a new locale and wire it into any i18n system with one command.

Part of the rtl-first framework — build for the world from day one.

What it does

One command. It detects your i18n library, copies source locale files, updates your config, and generates a LocaleSwitcher component.

npx @rtl-first/locale-scaffolder ./my-project
  Locale Scaffolder Report
  ═══════════════════════════

  i18n system:    i18next / react-i18next
  Source locale:  en-US (2,313 keys across 12 files)
  Structure:      nested-dirs

  Created:
  ✓  Created directory: i18n/ar/
  ✓  Created i18n/ar/common.json (847 keys)
  ✓  Created i18n/ar/app.json (423 keys)
  ✓  Updated i18n/language.ts — added ar locale entry
  ✓  Generated rtl-overrides/components/LocaleSwitcher.tsx

  Next steps:
  1. Translate 2,313 keys in the new locale files
  2. Add <LocaleSwitcher /> to your header/navigation
  3. Run: npx @rtl-first/direction-injector ./ to add dir="rtl"
  4. Run: npx @rtl-first/audit ./ to check all RTL layers

Supported i18n Libraries

| Library | Structure | Config Update | |---------|-----------|--------------| | i18next / react-i18next | nested-dirs, flat | ✅ | | next-intl | flat | ✅ | | vue-i18n | flat, nested-dirs | ✅ | | react-intl / FormatJS | flat | ✅ | | Angular i18n | flat | ✅ | | svelte-i18n | flat | ✅ |

What it generates

  1. Locale files — copies source locale (en.json) to target (ar.json) preserving structure
  2. Config update — registers the new locale in your i18n config (language.ts, i18n.ts, etc.)
  3. LocaleSwitcher — a ready-to-use component (React .tsx or Vue .vue) that switches locale and direction

Usage

# Scaffold Arabic locale (default)
npx @rtl-first/locale-scaffolder ./my-project

# Preview changes without modifying files
npx @rtl-first/locale-scaffolder ./my-project --dry-run

# Hebrew instead of Arabic
npx @rtl-first/locale-scaffolder ./my-project --lang he

# Prefix values with [AR] for easy spotting during development
npx @rtl-first/locale-scaffolder ./my-project --stub prefix

# Overwrite existing locale
npx @rtl-first/locale-scaffolder ./my-project --force

# JSON output
npx @rtl-first/locale-scaffolder ./my-project --json

Stub Modes

Control how English values appear in the new locale files:

| Mode | Example | Use case | |------|---------|----------| | copy (default) | "Save" | App works immediately, translate gradually | | prefix | "[AR] Save" | Easy to spot untranslated strings in UI | | empty | "" | Forces translation before use |

Programmatic API

const { run } = require('@rtl-first/locale-scaffolder');

const result = run('./my-project', {
  lang: 'ar',
  dryRun: true,
  stubMode: 'prefix'
});

console.log(result.detection.localeInfo.sourceFiles);
console.log(result.scaffold.changes);

Features

  • Zero dependencies — just Node.js
  • Auto-detects i18n library and locale structure
  • Updates config — registers locale in language.ts / i18n config
  • Generates LocaleSwitcher — React or Vue component with RTL direction toggle
  • Idempotent — won't overwrite existing locale (use --force)
  • Three stub modes — copy, prefix, or empty
  • Files go to rtl-overrides/ — follows fork-rtl-methodology isolation pattern

License

MIT