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

i18n-morph

v1.0.72

Published

Script to translate automatically i18n files using google translate API.

Readme

🌍 i18n-morph

A lightweight Node.js CLI tool that automates the translation of i18n JSON files using the Mistral AI API.

✨ Features

  • Translate i18n .json files to multiple languages
  • Leverages the power of Mistral AI for accurate translations
  • Simple config file to manage translations
  • CLI-friendly

📦 Installation

npm install i18n-morph

⚙️ Configuration

After installing the package, a config file named i18n-morph.config.js is generated in your project root:

module.exports = {
    sourceFile: "./path/to/sourcefile.json",        // File to base translations on
    targetFiles: [
        // { path: "./path/to/file.json", lang: "fr" },
        // { path: "./path/to/file2.json", lang: "de" }
    ],
    mistralApiKey: 'YOUR_API_KEY_HERE'              // Get your key from https://console.mistral.ai/api-keys
}
  • sourceFile: Path to your source i18n file (e.g., English base file).
  • targetFiles: An array of target files and languages to generate/translate.
  • mistralApiKey: Your Mistral AI API key.

📝 How to Force Re-Translation of Keys

By default, the package will not re-translate keys that already exist in the target file. However, if you want to force re-translation of specific keys (even if they already exist), simply wrap the keys in your target file with ##.

For example:

Source file (en.json)

{
  "hello": "Hello",
  "congrats": "Congratulations to you !"
}
{
  "hello": "Bonjour",
  "congrats": "##My wrong translation here##"
}

In the example above:

  • The value of the key "congrats" is wrapped in ## in the target file fr.json so it will be re-translated.

When running the translator, the value for "congrats" in the source file will be re-translated to French in the target file (e.g., "##My wrong translation !##" will be replaced with "Félicitation à toi !").


🚀 Usage

Once configured, simply run:

npx morph

The tool will:

  • Read your source i18n file
  • Use Mistral AI to translate missing keys in each target file
  • Merge translated keys without overwriting existing ones
  • Save the updated target files

📁 Example

Source file (en.json)

{
  "hello": "Hello",
  "goodbye": "Goodbye"
}

Config (i18n-morph.config.js)

module.exports = {
    sourceFile: "./src/i18n/en.json",
    targetFiles: [
        { path: "./src/i18n/fr.json", lang: "french" },
        { path: "./src/i18n/es.json", lang: "spanish" }
    ],
    mistralApiKey: "sk-..."
}

🧠 Notes

  • Languages should be specified in English (e.g., "french", "german", "japanese").
  • Keys wrapped in ## will be re-translated, even if they already exist in the target file.
  • Only missing keys are translated – existing ones are preserved.
  • Translation quality depends on Mistral’s model and your API plan.

🛠️ Development

Clone and run locally:

git clone https://github.com/AlbertDeTerre/i18n-morph.git
cd i18n-mistral-translator
npm install

📄 License

MIT


🙌 Acknowledgements

  • Mistral AI for the powerful language models
  • All contributors and users who support open-source i18n tools