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

@mylukin/easy-i18n-js

v0.1.2

Published

Framework-agnostic i18n extraction tool with plugin support for Svelte, Vue, and more

Readme

@mylukin/easy-i18n-js

A framework-agnostic i18n extraction and management tool with plugin support for Svelte, Vue, and more.

一个与框架无关的 i18n 提取和管理工具,支持 Svelte、Vue 等框架的插件系统。

Features

  • Framework-agnostic: Works with any JavaScript/TypeScript project
  • Plugin architecture: Built-in plugins for Svelte and Vue
  • AST-based extraction: Accurate extraction using Babel parser
  • Locale management: Update, merge, and sync locale files
  • CLI and API: Use as a command-line tool or programmatic API

Installation

npm install -D @mylukin/easy-i18n-js

# For Svelte support
npm install -D svelte

# For Vue support
npm install -D @vue/compiler-sfc

CLI Usage

Extract i18n strings

# Basic extraction
npx easyi18n extract -s ./src -o ./locales/en.json

# With custom patterns
npx easyi18n extract --include "**/*.{ts,tsx,vue}" --exclude "tests/**"

# Dry run (preview without writing)
npx easyi18n extract --dry-run

Update locale files

# Sync target locales with source
npx easyi18n update ./locales/en.json ./locales/zh.json ./locales/ja.json

# Remove unused keys
npx easyi18n update -f ./locales/en.json ./locales/zh.json

Check translation status

# Show coverage report
npx easyi18n status ./locales/en.json ./locales/zh.json ./locales/ja.json

# Find missing translations
npx easyi18n missing ./locales/en.json ./locales/zh.json

# Find unused keys
npx easyi18n unused ./locales/en.json ./locales/zh.json

Programmatic API

import {
  extract,
  extractFromDirectory,
  mergeResults,
  updateLocale,
  readLocaleFile,
  writeLocaleFile
} from '@mylukin/easy-i18n-js';

// Extract from code string
const items = extract(`$t('Hello, {name}')`, 'app.js');
console.log(items);
// [{ key: 'Hello, {name}', file: 'app.js', line: 1, column: 1, hasParams: true, params: ['name'] }]

// Extract from directory
const allItems = await extractFromDirectory('./src', {
  include: '**/*.{js,ts,vue,svelte}',
  exclude: ['node_modules/**']
});

// Merge and deduplicate
const merged = mergeResults(allItems);

// Update locale files
const source = await readLocaleFile('./locales/en.json');
const target = await readLocaleFile('./locales/zh.json');
const updated = updateLocale(source, target, { flush: true });
await writeLocaleFile('./locales/zh.json', updated);

Plugin System

Using built-in plugins

import { registerPlugin, sveltePlugin, vuePlugin } from '@mylukin/easy-i18n-js';

// Register plugins
registerPlugin(sveltePlugin);
registerPlugin(vuePlugin);

Creating custom plugins

import type { FrameworkPlugin, ExtractionItem } from '@mylukin/easy-i18n-js';

const myPlugin: FrameworkPlugin = {
  name: 'my-framework',
  extensions: ['.myext'],

  extract(code: string, file: string): ExtractionItem[] {
    // Your extraction logic
    return [];
  },

  isAvailable(): boolean {
    // Check if dependencies are installed
    return true;
  }
};

registerPlugin(myPlugin);

Supported i18n Patterns

The tool detects these common i18n function patterns:

// Function calls
$t('Hello')
t('Hello')
i18n.t('Hello')
this.$t('Hello')

// With parameters
$t('Hello, {name}', { values: { name } })
t('{count} items', { count: 5 })

// Vue templates
{{ $t('Hello') }}
{{ t('Hello') }}
v-t="'Hello'"

// Svelte templates
{$t('Hello')}
{t('Hello')}

API Reference

Extraction

  • extract(code, file, options?) - Extract from code string
  • extractFromTypescript(code, file, options?) - Extract from TypeScript
  • extractFromFile(filePath, options?) - Extract from file
  • extractFromDirectory(dir, options?) - Extract from directory
  • mergeResults(results) - Merge and deduplicate results

Locale Management

  • readLocaleFile(path) - Read JSON locale file
  • writeLocaleFile(path, data, options?) - Write locale file
  • updateLocale(source, target, options?) - Update locale data
  • sortKeys(obj) - Sort keys alphabetically
  • findMissing(source, target) - Find missing translations
  • findUnused(source, target) - Find unused keys
  • getCoverage(source, target) - Get translation coverage stats

Plugin Management

  • registerPlugin(plugin) - Register a framework plugin
  • unregisterPlugin(name) - Remove a plugin
  • getRegisteredPlugins() - List registered plugins

License

MIT