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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lang-tag

v0.11.1

Published

A professional solution for managing translations in modern JavaScript/TypeScript projects, especially those using component-based architectures. `lang-tag` simplifies internationalization by allowing you to define translation keys directly within the com

Readme

Lang-tag: Component-Colocated Translation Management / Translation Engine Proxy

A professional solution for managing translations in modern JavaScript/TypeScript projects, especially those using component-based architectures. lang-tag simplifies internationalization by allowing you to define translation keys directly within the components where they are used. Translations become local, callable function objects with full TypeScript support, IntelliSense, and compile-time safety.

Installation

npm i lang-tag
npm i -D @lang-tag/cli

Key Benefits

Lightweight Core (~1KB)

The core is optimized for performance, with a bundle size of just ~1KB (check on Bundlephobia). It provides essential TypeScript types and minimal utilities to help you build a custom lang-tag setup tailored to your project.

  • Component-local translations – define translations directly within components, avoiding scattered key structures
  • Light structure, full control – only the translation object shape is enforced; naming, config, functions, and libraries are all up to you
  • Flexible library support – integrate third-party packages effortlessly, with support for both classic mappings and fully customized lang-tag flows

Effortless translation structure

Instead of manually managing centralized translation files, lang-tag lets you colocate keys within components and automatically organizes them into namespaces based on your project structure. For example, all components in components/orders or pages in pages/order share the orders namespace. You define a simple folder-to-namespace mapping once, and lang-tag handles merging and file organization—while you retain full control over how namespaces are merged.

Set your rules, then let lang-tag do the rest.

Advanced CLI

Full functionality is available through an advanced CLI that keeps your application bundle size untouched:

  • Automatic translation collectionlang-tag collect scans your project for translation tags and aggregates them into organized JSON files (e.g., public/locales/en/common.json), based on your configuration
  • Dynamic configuration updateslang-tag regenerate-tags automatically refreshes translation settings in your code, using rules defined in your configuration (e.g., mapping namespaces based on folder structure)
  • Third-party translation importlang-tag import detects and integrates translations from external libraries, adapting them to your project’s translation system
  • Watch modelang-tag watch monitors your source files for changes and automatically re-collects/re-generates translations when needed

Practical and Flexible Architecture

The solution provides:

  • Framework agnostic – works with any JavaScript/TypeScript project and integrates easily with libraries like react-i18next
  • Library ecosystem support - create reusable component libraries with embedded lang-tag translations that consuming lang-tag applications can easily import/integrate and override
  • Full TypeScript support - complete type safety with IntelliSense for all translation keys and interpolation parameters
  • Flexible integration - seamlessly integrates with existing i18n libraries (i18next, react-i18next) while maintaining your current translation workflow
  • Automation-first - comprehensive CLI tools for collection, import, regeneration, and watch modes to streamline the entire translation workflow

Core Concept

lang-tag allows translation management by enabling component-colocated translation definitions. This approach eliminates the traditional complexity of managing distributed translation files and hierarchical key structures, allowing developers to define translations directly where they are consumed.

Component-Colocated Translation Pattern

Instead of maintaining separate translation files and complex key mappings, translations are defined inline within components:

// Component with colocated translations using custom i18n tag
import { i18n } from '../utils/i18n';

const translations = i18n(
    {
        greeting: 'Welcome {{name}} to our store!',
        orderSummary: 'You have {{count}} items in your cart.',
        actions: {
            proceed: 'Proceed to Payment',
            cancel: 'Cancel Order',
        },
    },
    {
        namespace: 'orders',
        path: 'components.checkout',
    }
);

function CheckoutComponent({ name, count }) {
    const t = translations.useT();

    return (
        <div>
            <h2>{t.greeting({ name })}</h2>
            <p>{t.orderSummary({ count })}</p>
            <div>
                <button>{t.actions.proceed()}</button>
                <button>{t.actions.cancel()}</button>
            </div>
        </div>
    );
}