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

@alnliang/tlv

v1.1.3

Published

Lightweight AI-powered tool for verifying and correcting translations in JSON language files using any OpenAI-compatible API

Downloads

25

Readme

Translation Language Verifier (TLV)

AI-powered tool for verifying and correcting translations in JSON language files using any OpenAI-compatible API.

Installation

npm install @alnliang/tlv

Usage

import { TranslationVerifier } from '@alnliang/tlv';

const verifier = new TranslationVerifier({
  apiKey: 'your-api-key'
});

const englishJson = {
  "greeting": "Hello {{name}}!",
  "settings": {
    "title": "Settings",
    "theme": "Dark Mode"
  }
};

const translatedFiles = {
  'fr.json': {
    "greeting": "Bonjour {{name}}!",
    "settings": {
      "title": "Paramètres",
      "theme": "Mode sombre"
    }
  }
};

const results = await verifier.verifyTranslations(englishJson, translatedFiles);

Automatic Variable Pattern Detection

TLV automatically detects and handles different variable patterns in your JSON translations:

  • {{variable}} - Double curly braces (Handlebars, Mustache)
  • {variable} - Single curly braces
  • ${variable} - Dollar braces (Template literals)
  • %variable% - Percent signs
  • $variable$ - Dollar signs
  • [variable] - Square brackets

No configuration needed. The system analyzes your English JSON and automatically detects which pattern you're using.

Variable Pattern Examples

The verifier automatically detects and validates different variable patterns:

// Single curly braces
const singleCurlyEnglish = {
  welcome: "Hello {name}!",
  message: "You have {count} notifications"
};

// Double curly braces (Handlebars/Mustache)  
const doubleCurlyEnglish = {
  welcome: "Hello {{name}}!",
  message: "You have {{count}} notifications"
};

// Dollar braces (Template literals)
const dollarBraceEnglish = {
  welcome: "Hello ${name}!",
  message: "You have ${count} notifications"
};

// All work automatically - no configuration needed
const results = await verifier.verifyTranslations(englishJson, translatedFiles);

The system will:

  1. Auto-detect the variable pattern in your English JSON
  2. Validate that translations preserve the exact same pattern
  3. Suggest corrections for pattern mismatches
  4. Report errors when variables are missing or incorrectly formatted

Configuration

interface VerifierOptions {
  apiKey: string;
  baseURL?: string;      // Default: Google Gemini endpoint
  model?: string;        // Default: gemini-2.5-flash-preview-05-20
  systemMessage?: string;
  userContext?: string;
  ragProvider?: RAGProvider;
  ragOptions?: RAGEnhancedVerificationOptions;
}

Supported Providers

| Provider | Base URL | |----------|----------| | Google Gemini | https://generativelanguage.googleapis.com/v1beta/openai | | Anthropic Claude | https://api.anthropic.com/v1 | | Groq | https://api.groq.com/openai/v1 |

Any LLM with an OpenAI API compatible endpoint will work.

Other Providers

// OpenAI GPT (baseURL optional - defaults to OpenAI)
const verifier = new TranslationVerifier({
  apiKey: 'your-openai-api-key',
  model: 'gpt-4'
});

// Other providers require baseURL
const verifier = new TranslationVerifier({
  apiKey: 'your-groq-api-key',
  baseURL: 'https://api.groq.com/openai/v1',
  model: 'llama-3.1-70b-versatile'
});

// Local model
const verifier = new TranslationVerifier({
  apiKey: 'not-needed',
  baseURL: 'http://localhost:{PORT}/v1',
  model: 'llama3.1'
});

Response Format

interface VerificationResult {
  [languageKey: string]: {
    errors: Array<{
      stringID: string;
      languageFile: string;
      error: string;
      current: string | null;
      suggestion: string;
    }>;
    "fixed-json": Record<string, any>;
  }
}

Error Handling

try {
  const results = await verifier.verifyTranslations(englishJson, translatedFiles);
} catch (error) {
  console.error('Verification failed:', error.message);
}

Features

  • Automatic variable pattern detection - Works with any variable format
  • Translation accuracy verification
  • Placeholder validation
  • Nested JSON structure support
  • Missing key detection
  • Automatic correction suggestions
  • RAG interface support

Requirements

  • Node.js 16.0.0+
  • API key for chosen LLM provider

License

MIT