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

@simplelocalize/typesafe-i18n-connector

v1.0.5

Published

Import and export typesafe-i18n translations to/from flat JSON files compatible with SimpleLocalize

Readme

@simplelocalize/typesafe-i18n-connector

Import and export typesafe-i18n translations to/from flat JSON files compatible with SimpleLocalize.

Installation

npm install @simplelocalize/typesafe-i18n-connector

typesafe-i18n (>=5.0.0) is a peer dependency and must be installed in your project.

Usage

Export translations

Reads typesafe-i18n translation files from disk, flattens them into flat key-value JSON files, and writes them to the output directory.

import { exportTranslations } from '@simplelocalize/typesafe-i18n-connector'

// Use defaults (outputs to ./locales-json/)
await exportTranslations()

// Or customize
await exportTranslations({
  outputDir: './my-translations',
  defaultNamespace: 'common',
})

Import translations

Reads flat JSON files from the input directory, unflattens them, and stores them as typesafe-i18n translation files on disk.

import { importTranslations } from '@simplelocalize/typesafe-i18n-connector'

// Use defaults (reads from ./locales-json/)
await importTranslations()

// Or customize
await importTranslations({
  inputDir: './my-translations',
  defaultNamespace: 'common',
})

Options

ExportOptions

| Option | Type | Default | Description | | ------------------ | -------- | ---------------- | ------------------------------------------------------ | | outputDir | string | ./locales-json | Directory to write exported JSON files to | | defaultNamespace | string | base | Filename (without .json) for root-level translations |

ImportOptions

| Option | Type | Default | Description | | ------------------ | -------- | ---------------- | ------------------------------------------------------ | | inputDir | string | ./locales-json | Directory to read JSON files from | | defaultNamespace | string | base | Filename (without .json) for root-level translations |

File structure

The connector reads and writes flat JSON files organized by locale and namespace:

locales-json/
├── en/
│   ├── base.json        # root translations
│   ├── counter.json     # "counter" namespace
│   └── features.json    # "features" namespace
├── de/
│   ├── base.json
│   ├── counter.json
│   └── features.json
└── ...

Each JSON file contains flat key-value pairs:

{
  "greeting": "Hello {name}!",
  "welcome": "Welcome to the app."
}

Nested typesafe-i18n keys are flattened with dots:

{
  "section.title": "My Section",
  "section.description": "A description"
}

SimpleLocalize integration

After exporting translations, use the SimpleLocalize CLI to upload and download translations.

Example simplelocalize.yml:

uploadLanguageKey: en
uploadFormat: single-language-json
uploadPath: ./locales-json/en/{ns}.json
uploadOptions:
  - REPLACE_TRANSLATION_IF_FOUND
  - ACTIVATE_PRESENT_KEYS
  - DEPRECATE_NOT_PRESENT_KEYS
  - MARK_AS_ACCEPTED

downloadFormat: single-language-json
downloadPath: ./locales-json/{lang}/{ns}.json
downloadOptions:
  - EXCLUDE_DEPRECATED_KEYS

Workflow:

# 1. Export typesafe-i18n translations to JSON
npx tsx scripts/export.ts

# 2. Upload to SimpleLocalize
simplelocalize upload

# 3. Download translations from SimpleLocalize
simplelocalize download

# 4. Import JSON back into typesafe-i18n
npx tsx scripts/import.ts

Example

The example/ directory contains a full React + Vite app demonstrating the connector with:

  • Multiple locales (en, de, fr, es, pt, pl, it)
  • Namespace support (counter, features) with on-demand loading
  • Language switcher

To run the example:

cd example
npm install
npm run dev

License

MIT