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

@mcpronovost/okp-i18n

v0.2.0

Published

A lightweight i18n solution specifically designed for Vite-based projects with multilingual support.

Readme

okp-i18n · npm version npm license · made in Canada made in Québec

OKP i18n is a lightweight internationalization solution specifically designed for Vite-based projects with multilingual support.

Features

  1. Translation Management

    • JSON-based translation files
    • Configurable default and supported languages
    • Dynamic translation file loading
    • Automatic fallback when translations missing
  2. Translation Functions

    • Simple t() function for translations
    • Support for pluralization using Intl.PluralRules
    • Language-specific translation via getTranslation()
    • Fallback to key when translation missing
  3. Development Tools

    • Command-line translation checker
    • Missing translation detection in source files
    • Support for multiple file types (.astro, .jsx, .tsx, .vue)
    • Console warnings for missing translations

Installation

npm i @mcpronovost/okp-i18n

Configuration

Default Configuration

{
  defaultLang: "en",
  currentLang: "en",
  supportedLangs: ["en"],
  useUrlLang: true,
  localesPath: "/src/locales",
}

Direct Configuration

import { initI18n } from "@mcpronovost/okp-i18n";

await initI18n({
  defaultLang: "fr",
  supportedLangs: ["en", "fr"],
  localesPath: "/src/services/locales",
});

Key Components

Translation Files

  • Format: JSON files in locales directory
  • Supports translations from multiple files
  • Supports pluralization rules (one, zero, other)
  • Automatic fallback to "other" form
{
  "Hello": "Bonjour",
  "Threads": {
    "one": "Sujet",
    "zero": "Sujet",
    "other": "Sujets"
  },
  "Message": {
    "one": "Message",
    "other": "Messages"
  },
  "User": "Utilisateur"
}

Translation Function

  • Simple t() function for accessing translations
  • Support for pluralization via count parameter
  • Language-specific translations via getTranslation()
  • Automatic fallback to key when translation missing

Translation Checker

  • Command-line utility for finding missing translations
  • Configurable via command line arguments:
    • --languages: Supported language codes (default: ["en"])
    • --locales: Path to locales directory (default: "./locales")
    • --src: Path to source files (default: "./src")
    • --extensions: File extensions to scan (default: [".astro", ".jsx", ".tsx", ".vue"])
  • Scans source files for t() function calls
  • Reports missing translations with easy to read console output

Direct Command

npx okp-i18n check --languages=en,fr --src=./src --locales=./src/locales

Script in package.json

  {
    "scripts": {
      "dev": "vite",
      "build": "vite build",
      "preview": "vite build && vite preview",
      "lint": "eslint .",
      "check-translations": "check-translations --languages=en,fr --src=./src --locales=./src/_services/locales"
    }
  }

Example Usage

Use default language for translations

import { useEffect } from "react";
import { t, initI18n } from "@mcpronovost/okp-i18n";

// Initialize i18n
await initI18n({
  defaultLang: "en",
  supportedLangs: ["en", "fr"],
  localesPath: "/src/locales"
});

// Use translations
function Home() {
  return (
    <div>
      <h1>{t("Welcome")}</h1>
      <p>{t("Welcome to the home page")}</p>
    </div>
  );
}

Use specific language for translations

import { useEffect } from "react";
import { getTranslation, initI18n } from "@mcpronovost/okp-i18n";

// Initialize i18n
await initI18n({
  defaultLang: "en",
  supportedLangs: ["en", "fr"],
  localesPath: "/src/locales"
});

// Use specific language translations
function Home() {
  const { t } = getTranslation("fr");
  return (
    <div>
      <h1>{t("Welcome")}</h1>
      <p>{t("Welcome to the home page")}</p>
    </div>
  );
}

Peer Dependencies

  • Vite (version 6 or higher)

License

This project is licensed under the BSD-3-Clause License.