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

i10010n

v0.4.3

Published

simple i18n for javascript

Downloads

18

Readme

i10010n

coming "soon"

  • Pluralization (this might take some thinking)
    • Maybe a generic variation system to allow for more flexibility
  • Tool to generate JSON configurations

changelog

  • 0.4.1
    • improved logging function; user logging function is now passed an error type, as seen in Error.js, as well as an object of relevant data and a message. JSDoc updates are not in yet, I didn't feel like it
  • 0.3.1
    • changed default logging function from console.error to () => {}
  • 0.3.0
    • broke the init function; now it takes an object with various configuration parameters. See the documentation for more details

what does it do?

i10010n allows you to easily translate your application, and dynamically use translated text when sending strings, making strings, doing other stuff with strings...

config

The config file is fairly basic. It is also a javascript file, not JSON. Obviously.

Note: You can do it in JSON, but it'll take more work. See the DB used by i18n-yummy for more details.

First, you're going to want to import some functions from i10010n:

import { define, ID } from "i10010n";

Then, you can configure the various template strings to support, as well as the different locales it's available in:

import { define, ID } from "i10010n";

export default {
    [ID `i ${0} template strings`]: {
        "yoda": define `template strings, i ${0}`
    }
}

Note: you can put anything you want in the ID template string values, but putting the indexes makes things a little clearer

You don't have to define the base language, since your template strings are already in that language. Probably.

usage

Elsewhere, you can do this:

import { init } from "i10010n";
import i10010nConf from "./theplacewhereimadetheconf";

const i10010n = init({DB: i18nConf});

console.log(
    i10010n("yoda") `i ${"love"} template strings`
);
// "template strings, i love"

if you're not english

You don't have to use English for the base language.

To specify a different base locale than "en", you can just say so when you initialize i18n, like so:

const i10010n = init({
  DB: i18nConf,
  defaultLocale: "yoda"
});

Setting things up this way would mean that you write your base template strings in yoda, and anything else will be a translation of that.

advanced(ish) usage

Let's say you have an array of things you want to put in a translated template string. You can do this:

const things3 = ["i18n", "internationalization", "yoda"];

console.log(
    i18n("yoda") `i like 3 things:\n${
        things3.map(thing => i18n("yoda") `i like ${thing}\n`;
    }`
);
/*
"3 things, i like:
i18n, i like
internationalization, i like
yoda, i like"
*/

It's like magic! Or Array.prototype.join!

credits

This project is quite inspired by i18n-yummy. I did rewrite everything from scratch (it's more than 9 lines, as you can probably tell), and changed some of the concepts, but the epiphany came from that.

One difference is that there is no static locale setting. You must provide the locale with each function call. This means that you do not need to have multiple instances of i10010n in an application that may respond in different languages from the same instance.