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

mojito-rb-gen

v0.0.1

Published

Localization utility that converts .properties files into JS/JSON resource bundles

Readme

mojito-rb-gen

Localization utility that converts .properties files into JSON/JS resource bundles.

Install

npm install -g mojito-rb-gen

Usage

Each .properties files in the source directory will be converted into a JSON or JS resource bundle.

One of the .properties file is the source resource bundle (by default en.properties, use --source-bundle to override) and contains the source strings that are usually modified during development. Other files contain the localized strings.

The JSON/JS localized resource bundles are generated by merging the source strings with the translated strings from the .properties files. This ensure that the localized resource bundles contain all the strings required by the application even if the translations are not yet available.

Usage:
  mojito-rb-gen [OPTIONS] [ARGS]

Options:
  -s, --source-directory [PATH] Source directory (Default is .)
  -o, --output-directory [PATH] Output directory (Default is .)
  -b, --source-boundle   [STRING] Source bundle file (Default is en.properties)
  -n, --use-namespaces   BOOLEAN Use namespaces when parsing properties files
  -t, --output-type      [STRING] Output type: json, js (Default is json)
  -w, --watch BOOLEAN    Watch the source directory for changes and rebuild
                         resource bundles
      --js-variable      [STRING] Varaible name used to generate Javascript file  (Default is MESSAGES)
  -k, --no-color         Omit color from output
      --debug            Show debug information
  -h, --help             Display help and usage details

Merge logic

With source bundle: en.properties

# Group 1 Key 1 Comment
group1.key1 = Group 1 Key 1
group1.key2 = Group 1 Key 2
group2.key1 = Group 1 Key 1

and localized properties: fr.properties

group1.key2 = Group 1 Key 2 (fr)
outdated = Outdated

The merge output in JSON will be:

{"group1.key1":"Group 1 Key 1","group1.key2":"Group 1 Key 2 (fr)","group2.key1":"Group 2 Key 1","outdated":"Outdated"}

Examples

Output types

JSON

$ mojito-rb-gen -s examples/src/ -o examples/out/json/
{"group1.key1":"Group 1 Key 1","group1.key2":"Group 1 Key 2 (fr)","group2.key1":"Group 2 Key 1","outdated":"Outdated"}

Javascript

$ mojito-rb-gen -s examples/src/ -o examples/out/js/default -t js
MESSAGES = {"group1.key1":"Group 1 Key 1","group1.key2":"Group 1 Key 2 (fr)","group2.key1":"Group 2 Key 1","outdated":"Outdated"};

Configure Javascript variable name

$ mojito-rb-gen -s examples/src/ -o examples/out/js/var/ -t js --js-variable MY_MESSAGES
MY_MESSAGES = {"group1.key1":"Group 1 Key 1","group1.key2":"Group 1 Key 2 (fr)","group2.key1":"Group 2 Key 1","outdated":"Outdated"};

Use namespaces

$ mojito-rb-gen -s examples/src/ -o examples/out/js/namespaces/ -t js --js-variable MY_MESSAGES_NS -n
MY_MESSAGES_NS = {"group1":{"key1":"Group 1 Key 1","key2":"Group 1 Key 2 (fr)"},"group2":{"key1":"Group 2 Key 1"},"outdated":"Outdated"};

Watch source directory for changes and rebuild resources bundles

$ mojito-rb-gen -s examples/src/ -o out -w
INFO: Start watching: examples/src/
INFO: en.properties changed, generate resource bundles

Use a different source bundle

$ mojito-rb-gen -s examples/src/ -o out -b en-US.properties