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

ilib-loctool-javascript-resource

v1.3.0

Published

A loctool plugin that knows how to process JS resource files

Downloads

64

Readme

ilib-loctool-javascript-resource

ilib-loctool-javascript-resource is a plugin for the loctool that writes localized strings to JavaScript resource files. It is typically used as a resource file type plugin, referenced from resourceFileTypes in project.json, while another plugin (such as ilib-loctool-json or ilib-loctool-javascript) extracts strings from source files.

This plugin does not read existing JavaScript resource files from disk; it only generates them during localization.

Configuring the Plugin

Standard Settings

To use this plugin, reference it from the resourceFileTypes setting in your project.json. The key names the source file type whose output should be delegated to this plugin. For example, to write JavaScript files for strings extracted from JSON:

{
    "resourceFileTypes": {
        "json": "ilib-loctool-javascript-resource"
    },
    "plugins": [
        "ilib-loctool-json",
        "ilib-loctool-javascript-resource"
    ]
}

You can also set resourceFileTypes.javascript when the ilib-loctool-javascript extraction plugin is in use.

Custom Settings

The plugin reads formatting and output-path settings from your project.json settings object.

settings.javascript

  • header: text placed before the JSON object in each output file. May include locale placeholders such as [localeUnder] that are replaced with the target locale. Default is ilib.data.strings_[localeUnder] = .
  • footer: text placed after the JSON object. Default is ;\n.
  • template: path template used to determine the output file path when an extraction plugin delegates output to this plugin. The template supports the same bracket substitutions as other loctool plugins (for example [locale], [localeDir], [dir], [filename]). When set, the output path is computed from the source file path and target locale rather than from resourceDirs alone.
  • extension: file extension for output files when no template is used. Default is .js.

settings.JavaScriptResourceFile

  • prefix: optional text prepended before the header in each output file. Useful for import statements or other boilerplate that should appear at the very top of the file.

Example configuration when delegating from the json plugin:

{
    "resourceFileTypes": {
        "json": "ilib-loctool-javascript-resource"
    },
    "settings": {
        "json": {
            "outputSourceLocale": true,
            "mappings": {
                "**/strings.json": {
                    "template": "resources/[localeDir]/strings.json"
                }
            }
        },
        "javascript": {
            "template": "resources/[locale].js",
            "header": "// THIS FILE IS AUTOGENERATED. DO NOT EDIT MANUALLY.\n",
            "footer": "\n// END OF FILE\n"
        }
    }
}

Source Locale Resource Files

When this plugin writes a resource file for the project's source locale, it outputs the source string for each resource, even when the source and target text are the same. For target locales, it only includes strings whose translation differs from the source.

Whether a source-locale file is created at all is controlled by the extraction plugin that supplies resources to this plugin, not by this plugin itself. For example:

  • settings.json.outputSourceLocale when using ilib-loctool-json
  • settings.javascript.outputSourceLocale when using ilib-loctool-javascript

When enabled, the extraction plugin populates source-locale resources during localization; this plugin then formats and writes them like any other locale.

License

Copyright © 2019, 2021, 2026 JEDLSoft

This package is released under the Apache License, Version 2.0. The full license text is available in the LICENSE file in the ilib-mono repository on GitHub.

Release Notes

See CHANGELOG.md.