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

@dev-vortex/i18n-icu

v1.0.1

Published

Internationalization with ICU

Readme

Internationalization with ICU Library

This library aims to provide an agnostic and reliable mechanism to proivide and support internationaliizatiion with static and live translation file fetching through minimal or no setup.

Installation

yarn add @dev-vortex/i18n-icu

or

npm install @dev-vortex/i18n-icu

Configuration

TODO: explain all the config options and how to pass the config to library

Formatted

TODO: explain how to format a date, currency, number, etc...

Translate

Local files (static)

Load files (dynamic)

Quick Start

  1. Import the initialization method to have access to the api
import type { init } from '@dev-vortex/i18n-icu'
  1. Prepare the options for the initialization with the locale validator (this can be the type guardian of your app defined locales)
import type { I18nInitOptions } from '@dev-vortex/i18n-icu'

const Locale = {
   EN_US: 'en-US',
   SV_SE: 'sv-SE',
   HR_HR: 'hr-HR',
   AR_AR: 'ar-AR',
} as const

type AppLocaleKeys = keyof typeof Locale
type AppLocaleValues = typeof Locale[keyof typeof Locale]

const isValidLocale = (toVerify: unknown): toVerify is AppLocaleValues => {
   const toReturn = !!Object.keys(Locale).find(
       value => Locale[value as AppLocaleKeys] === toVerify,
   )
   return toReturn
}

const initOptions: I18nInitOptions = {
   checkValidLocale: isValidLocale,
}
  1. Prepare the i18n and i18n-icu option objects.

For the i18n we can just use the same as i18next here

const i18nOptions: InitOptions = {
    debug: false,
    fallbackLng: false,
    lng: deviceLocale(),
    saveMissing: true,
    parseMissingKeyHandler: parseMissingKeyHandler,
    missingKeyHandler: missingKeyHandler,
    resources: {
        [Locale.EN_US]: {
            translation: require(`./translations/${Locale.EN_US}.json`),
        },
        ...
    },
}

const i18nIcuOptions: I18nIcuInitOptions = {
    errorHandler: errorHandler,
}
  1. Call the init method to get the api.
const api = init(initOptions, i18nOptions, i18nIcuOptions)

API

Setting the language

Once we got the API we can start by settiing the current language

api.setLanguage('se_SV') // Normalizes and set the language

Get the current language

const currentLanguuage = api.getLanguage()

Get normalized locale

const currentLanguuage = api.normalizeLocale('en_GB')

Get the text for the provided key

const text = api.translate('KEY.TO.TEXT')