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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bullhorn/linguist

v0.1.0

Published

A universal localization managment tool for web projects

Downloads

4

Readme

linguist Build Status Coverage Status

A CLI to help manage localization files developed and used by Bullhorn

Installation

npm install -g @bullhorn/linguist

Configuration

Setup you .linguistrc file

{
    locale: 'en-US',          // default locale used for translations
    sources: ['./src'],       // list of directories to search for KEYS.
    dest: './l10n',           // where localization files are stored
    patterns: [               // file patterns to look for keys in
        '/**/*.html',
        '/**/*.ts'
    ],
    prefix: 'messages.',      // file prefix for saving localization files
    format: 'json',           // localization file format, ie. json, namespaced-json, pot, xliff, xliff2
    verbose: false,           // display extra information in console
    replace: false,           // replace existing translations when extraction keys
    clean: false,             // removed unused keys when extracting new keys
    keys: []                  // Extra regular expression to be used by the parser
}

Usage

Finding all the translations within your project files

linguist check [lang]

Usage: check [options] [lang]

Check for missing translation keys

Options:
    -h, --help               output usage information
    -s, --sources [sources]  specify source directories.
    -d, --dest <dest>        specify output directory.
    -v, --verbose            list all keys found.
$ linguist check en-US
+ Custom keys found, adding regular expression parser
✔︎ Extracted 109 strings from '/Projects/test/js'
✔︎ Extracted 349 strings from '/Projects/test/partials'
✔︎ Extracted 237 strings from '/Projects/test/node_modules/package'
* Loaded Control file
✔︎ 515 existing keys found
✗ Missing 105 keys
✗ Found 72 unused keys

Updating you control language file with all keys

linguist extract [lang]

Usage: extract [options] [lang]

Updates translation file with missing keys

Options:
    -h, --help               output usage information
    -s, --sources [sources]  specify source directories.
    -d, --dest <dest>        specify lang directory.
    -f, --format <format>    specify output format. (json, xliff, pot)
    -r, --replace            Replace the contents of output file if it exists (Merges by default).
    -c, --clean              Remove obsolete strings when merging.
$ linguist extract en-US
⠴ extracting...
✔︎ Extracted 100 strings from '/Projects/test/src'
✔︎ Saved to ./shared/i18n/de.json

Translating you control language

linguist translate [lang]

Usage: translate [options] [lang]

Translate source file to new language

Options:
    -h, --help             output usage information
    -d, --dest <dest>      specify localization resources directory.
    -f, --format <format>  specify output format. (json, xliff)
$ linguist translate de-DE
* Loaded Control file
✔︎ 1026 existing keys found
✗ Missing 352 translations
⠧ translating...350 of 352
✔︎ Saved to './shared/i18n/de-DE.json'

Convert

linguist convert [lang] [to]

Usage: convert [options] [lang] [to]

Convert translations to new format

Options:
    -h, --help             output usage information
    -d, --dest <dest>      specify localization resources directory.
    -f, --format <format>  specify output format. (json, xliff)
$ linguist convert -f xliff de-DE
* Loaded Control file
✔︎ Saved to './shared/i18n/de-DE.xlf'

Testing

To run all the unit tests, simply run:

yarn test