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

translate-ui

v1.0.2

Published

Simple multi-language translation written with TypeScript

Readme

WTFPL

Simple UI translator. Really simple. Will help you if you need quickly translate UI of your application to other languages.

#Installation

 `npm install translate-ui`
  

Packaged as TypeScript and ES5 CommonJS module.

#Usage

  1. You need to create empty root translator for your application:

    rootTranslator.js

import { Translator } from 'translate-ui'

const translator = new Translator({
    // here are language dictionaries goes
    korean : {
        'My english phrase' : 'Korean translation',
        ...
    }
});

window._translator = translator; // it will help us later, be patient

translator.language = "korean"; //can be dynamically switched

export default translator;
  1. In your JS, wrap your existing string resources to _t function call:
import { _t } from 'rootTranslator'

something.innerHTML = _t( 'Hello World!' );

At this stage, nothing will change. _t will pass through phrases it doesn't know. But you'll see following warnings in the console:

[Localization] No translation for "Hello World!"
  1. Build vocabulary for translation:

In the browser's console, type:

> JSON.stringify( _translator );
"{"Hello World!":""}"

Here will be are all unknown phrases. Copy it, and send it for translation to Korean guy.

  1. When you received translated phrases, insert them into translator vocabulary.
const translator = new Translator({
    // here are language dictionaries goes
    korean : {
        "Hello World!" : "?№*(?*(:№;?*%"
    }
});

Bingo. You're done.

Advanced usage

There could be many translators in the system, assembled in hierarchies.

Lets create special local translator for some specific page, extending the vocabulary of the root translator:

import translator from 'rootTranslator'

export default translator.extend({
    // here are language dictionaries goes
    korean : {
        "By-by, world." : "#$%#%$!!!"
    }
});

Then, use it as translator in your local page.

As you can expect, it will use local phrases vocabulary first, and when it fail, it will ask the parent.

You can have as many translators as you want. Wanna have one per View, or one per JS module? You're welcome, feel yourself at home.

#License

WTFPL (http://www.wtfpl.net/)