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

radius-i18n

v0.1.1

Published

`radius-i18n` is a tool designed to simplify internationalization (i18n) by leveraging **Google GenAI APIs** to generate translations and manage localization files. With `radius-i18n`, you can automate translation keys, regenerate missing values, and enri

Readme

radius-i18n

radius-i18n is a tool designed to simplify internationalization (i18n) by leveraging Google GenAI APIs to generate translations and manage localization files. With radius-i18n, you can automate translation keys, regenerate missing values, and enrich translations using contextual notes.


Installation

Install radius-i18n as a development dependency:

  • npm:

    npm install radius-i18n --save-dev
  • Yarn:

    yarn add radius-i18n --dev

Configuration

Create a configuration file named radius.config.json in your project root:

{
  "locale_base": "en",
  "locales": ["en", "id"],
  "locale_path": "./src/locales",
  "change_delay": 2000,
  "genai_key": "apikey"
}

Explanation of Configuration Options

| Key | Description | | ------------------ | ------------------------------------------------------------------------------------------ | | locale_base | The base locale used as the source language for translation. | | locales | List of target locales for translation. | | locale_path | Directory where localization files are stored/generated. Must have read-write permissions. | | change_delay | Delay (ms) before the watcher applies changes after file save. | | genai_key | Your Google GenAI API key (not service account). |

Changing the Model

By default, the tool uses:

gemini-2.5-flash

To override this, set (lowercase key):

"genai_model": "gemini-2.5-pro"

If not provided, the default model remains "gemini-2.5-flash".


Setup Localization Files

Inside your locale_path, create a folder for the base locale (e.g., en) and define translation JSON files.

Example: src/locales/en/header.json

{
  "homeNavLabel": "",
  "adminNavLabel": "",
  "profileNavLabel": "",
  "subtitleHeader": "",
  "__future__trx__": ["loginBtn", "registerBtn"],
  "__note__": [
    {
      "key": "subtitleHeader",
      "note": "This key is about a machine, create a simple subtitle.",
      "lang": "en"
    }
  ]
}

Rules

  • Empty values ("") → tool generates translation automatically.
  • Non-empty values → not overwritten unless included in __future__trx__.
  • __future__trx__ → force-regenerate keys even if they already have values.
  • __note__ → guidance notes given to GenAI for more accurate translation. Supports nested keys: "parent.child".

Notes and future lists are removed automatically after processing.


Important Considerations

1. Directory Permissions

locale_path must be readable and writable so the watcher can update files.

2. Complete Notes Before Saving

When you add/update notes:

  • Do not save mid-note.

  • When file is saved, the watcher triggers translation immediately.

  • After translation completes, the system removes:

    • __note__
    • __future__trx__

3. Error Handling

If translations fail:

  • Check the console logs.
  • Ensure your GenAI API key is valid.
  • Ensure your JSON structure follows the guidelines.

Scripts

Add to package.json:

"scripts": {
  "radius:w": "radius-translate"
}

Run:

npm run radius:w

This starts the watcher that monitors and updates localization files automatically.


Usage Guidelines

  1. Define translation keys.

    • Leave values empty for auto-generation.
    • Add keys to __future__trx__ when you want them regenerated.
  2. Add contextual notes using __note__.

    • Helps GenAI produce more accurate translations.
    • Notes should be complete before saving.
  3. Edit or add new keys anytime, watcher will handle them automatically.


Example Workflow

  1. Add welcomeMessage with an empty value in en/header.json.

  2. Save file.

  3. The watcher detects change and generates:

    • English base value (if needed)
    • Translations for all listed locales.

To ensure future regeneration, include:

"__future__trx__": ["welcomeMessage"]

Happy localizing with GenAI! 🚀