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

super-simple-i18n

v1.0.3

Published

Simple, lightweight, and easy to use, i18n translation for Node.js for non-production purposes. It supports replacement variables and pluralization.

Readme

super-simple-i18n

Simple, lightweight, and easy to use, i18n translation for Node.js for non-production purposes. It supports replacement variables and pluralization.

Key features

  • Default Locale - using the default locale as a fallback
  • Fallback - returning specified string in case of any critical error
  • Pluralization - plural key selection, based on Intl.PluralRules
  • Replacement Parameters - supporting replaceable text through named parameters and consistent replacement
  • Non-throwing errors - non-disruptive compilation errors
  • Silent mode - hiding any warning and errors in the console
  • Functions or Classes - choose any style of using you need or like

Getting started

Install the package: npm i super-simple-i18n

// Functions
import { t } from "super-simple-i18n"
// or
import { translate } from "super-simple-i18n"

// Classes
import { T } from "super-simple-i18n"
// or
import { Translate } from "super-simple-i18n"

Options

  • locale : string - an active locale, required
  • defaultLocale : string - fallback for the active locale
  • content : { [propName: string]: any } - dictionaries with translations, required
  • plural : string | number | undefined - a pluralisaiton option
  • replacements : string[] | { [propName: string]: string } | undefined - replacement options
  • fallback : string | undefined - a string returned in case of errors
  • silent : boolean - hiding alerts in the console

Functions

// Full set of options

t("project.key", {
    locale: 'fr-FR',
    defaultLocale: 'en-EN',
    content: {
        'en-EN': {
            'project.key': 'Hello world!'
        },
        'fr-FR': {
            'project.key': 'Bonjour le monde !'
        }
    },
    plural: undefined,
    replacements: undefined,
    fallback: 'Hello world!',
    silent: false
})
// -> 'Bonjour le monde !'

// Minimum set of options

t("project.key", {
    locale: 'fr-FR',
    content: {
        'en-EN': {
            'project.key': 'Hello world!'
        },
        'fr-FR': {
            'project.key': 'Bonjour le monde !'
        }
    }
})
// -> 'Bonjour le monde !'

Classes

// Full set of options

let TClass = T("project.key", {
    locale: 'fr-FR',
    defaultLocale: 'en-EN',
    content: {
        'en-EN': {
            'project.key': 'Hello world!'
        },
        'fr-FR': {
            'project.key': 'Bonjour le monde !'
        }
    },
    plural: undefined,
    replacements: undefined,
    fallback: 'Hello world!',
    silent: false
}) // Translation class ititilization

TClass.format() 
// The format() method returns the translated string 
// -> 'Bonjour le monde !'

// Minimum set of options

t("project.key", {
    locale: 'fr-FR',
    content: {
        'en-EN': {
            'project.key': 'Hello world!'
        },
        'fr-FR': {
            'project.key': 'Bonjour le monde !'
        }
    }
}).format()
// -> 'Bonjour le monde !'

Examples

const settings = {
    locale: "en-EN",
    defaultLocale: "en-EN",
    content: {
        "en-EN": {
            string: "Hello world!",
            nested: {
                string: "Hello world!",
                plural: {
                    regular: {
                        one: "Apple!",
                        other: "Apples!",
                    },
                    replace: {
                        array: {
                            one: "Hello %@!",
                            other: "Hello %@ and %@!",
                        },
                        template: {
                            one: "Hello {{name_1}}!",
                            other: "Hello {{name_2}} and {{name_1}}!",
                        }
                    },
                },
                replace: {
                    array: "Hello %d and %d!",
                    template: "Hello {{name_2}} and {{name_1}}!"
                },
            },
        },
        "fr-FR": {
            greetings: "Bonjour!"
        }
    },
}



// Basic

t("string", { ...settings })
// -> 'Hello world!'

t("nested.string", { ...settings })
// -> 'Hello world!'



// Pluralization and replacement

t("nested.plural.regular", {
    ...settings,
    plural: 2
}),
// -> 'Apples!'

t("nested.plural.replace.array", {
    ...settings,
    plural: 2,
    replacements: ["James", "Kate"]
})
// -> 'Hello James and Kate!'

t("nested.plural.replace.template", {
    ...settings,
    plural: 2,
    replacements: {
        name_1: "James",
        name_2: "Kate"
    }
})
// -> 'Hello Kate and James!'

t("nested.replace.array", {
    ...settings,
    replacements: ["James", "Kate"]
})
// -> 'Hello James and Kate!'

t("nested.replace.template", {
    ...settings,
    replacements: {
        name_1: "James",
        name_2: "Kate"
    }
})
// -> 'Hello Kate and James!'


// Fallbacks

t("string", {
    locale: "fr-FR",
    defaultLocale: "en-EN",
    content: settings.content
})
// -> 'Hello world!'

t("something", {
    locale: "fr-FR",
    defaultLocale: "en-EN",
    content: settings.content,
    fallback: "ERR"
})
// -> 'ERR'

Changelog

  • 1.0.3: Class usage
  • 1.0.2: Refactoring and fixes
  • 1.0.1: DefaultLocale as fallback bugfix
  • 1.0.0: Initial stable release