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

@l10nmonster/helpers

v1.0.3

Published

Basic L10n Monster helpers and shared utils

Readme

L10n Monster Basic Helpers

Sources

FS Source Adapter

this.source = new adapters.FsSource({
    globs: [ '**/values/strings.xml' ],
    filter: (resourceId) => (resourceId.indexOf('dont_translate.properties') === -1),
    targetLangs: [ 'it', 'ja' ],
    resDecorator: (resMeta) => (resMeta.resourceId.indexOf('DNT') === -1 ? resMeta : { ...resMeta, targetLangs: [] }),
});

An adapter that reads sources from the filesystem.

  • The globs array (mandatory) can specify wildcard patterns relative to the base directory where the l10nmonster.cjs is placed.
  • The optional filter function can further filter out what's returned by the glob patterns.
  • targetLangs is an array of languages to translate to
  • The optional resDecorator function can modify the resource metadata

Resource Filters

Filters are used to convert raw strings returned by sources into segments that are suitable for translation (ideally not too small that they can't be translated, and not too long that prevent translation reuse). They can be configured in content types as a single resourceFilter property.

|Module|Export|Description| |---|---|---| |helpers|filters.SnapFilter|Filter for normalized resources in snap store.

Decoders

Decoders are used to convert strings with specific formats into either pure strings or placeholders. They can be configured in content types as a chain of decoders via the decoders property.

|Module|Export|Description| |---|---|---| |helpers|normalizers.namedDecoder|Generic wrapper to rename a decoder.| |helpers|normalizers.doublePercentDecoder|Decoder for %% escaping.| |helpers|normalizers.bracePHDecoder|Decoder for {param} style placeholders.| |helpers|normalizers.keywordTranslatorMaker|Decoder/encoder pair to protect/replace keywords.| |helpers|regex.decoderMaker(flag, regex, partDecoder)|Internal utility to create decoders.| |helpers|xml.entityDecoder|Decoder for XML entities.| |helpers|xml.CDataDecoder|Decoder for XML CData.| |helpers|xml.tagDecoder|Decoder for XML tags.|

Encoders

Encoders are used to convert pure strings and placeholders back to their original format. They can be configured in content types as a chain of encoders via the textEncoders and codeEncoders properties.

|Module|Export|Description| |---|---|---| |helpers|normalizers.gatedEncoder|Generic flag-based encoder execution.| |helpers|normalizers.doublePercentEncoder|Encoder for %% escaping.| |helpers|regex.encoderMaker(name, regex, matchMap)|Internal utility to create encoders.| |helpers|xml.entityEncoder|Encoder for XML entities.|

Targets

FS Target Adapter

this.target = new adapters.FsTarget({
    targetPath: (lang, resourceId) => resourceId.replace('values', `values-${lang}`),
});

An adapter that writes translated resources to the filesystem. It takes in the object constructor a targetPath function that given a language and the resource id of the source, it produces the target resource id.

Translation Providers

Translation providers are used to interface with the translation process.

|Module|Export|Async|Sync|Translation|Refresh|Description| |---|---|:---:|:---:|:---:|:---:|---| |helpers|translators.Grandfather|❌|✅|✅|✅|Create translations based on existing translated resources. |helpers|translators.Repetitions|❌|✅|✅|✅|Create translations based on leverage of 100% text matches. |helpers|translators.Visicode|❌|✅|✅|✅|Pseudo-localization with visual identification of string id's.

Other

|Module|Export|Description| |------|---|---| |helpers|utils.*|Internal utilities. No stable interface. Use at your own risk.| |helpers|analyzers.*|Miscellaneous analyzers.| |helpers|stores.JsonJobStore|Job store based on JSON files in the filesystem.| |helpers|stores.FileBasedJobStore|Abstract job store based on JSON files in a blob store.| |helpers|stores.FsSnapStore|Snap store based on JSON files in the filesystem.| |helpers|stores.FileBasedSnapStore|Abstract snap store based on JSON files in a blob store.| |helpers|stores.FsStoreDelegate|Delegate helper for FileBasedJobStore and FileBasedSnapStore to use the filesystem.|