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

potools

v0.3.0

Published

Po file debug utilities.

Downloads

24

Readme

Potools

Build Status npm version Greenkeeper badge

A simple CLI utility to provide assistance with po-file based translations

Installation

To install globally use:

yarn global add potools or npm install -g potools

If you prefer to install this as a project dep then use:

yarn add potools --dev or npm install --save-dev potools

The command will be found in node_modules/.bin/potools.

Commands

debug

This command helps write out debug versions of pofile contents. It is both HTML and placeholder aware.

potools debug <potfile> [output] [format]

Options:
  --help    Show help                                                  [boolean]
  --format  The output format.
                             [choices: "unicode", "mirror"] [default: "unicode"]
  --output  Output path. If not provided outputs to stdout   [default: "stdout"]

Output Formats

There are two formats you can use:

  • unicode: converts input to use unicode characters.
  • mirror: converts input to use mirrored characters (recommended to be used via an RTL locale).

Placeholder Support

The debug command handles the following placeholder styles:

  • %(placeholder)s
  • %(placeholder)d
  • %s
  • %d
  • {placeholder}

See caveats for special handling of named placeholders for HTML substitution in the mirror format output.

Debug Examples:

potools debug ../bar/locale/templates/LC_MESSAGES/messages.pot

Will output to stdout in unicode format.

potools debug ../bar/locale/templates/LC_MESSAGES/messages.pot --format mirror

Will output to stdout in mirror format.

potools debug ../bar/locale/templates/LC_MESSAGES/messages.pot --format mirror --output ../test.txt

Will write the ouptut to ../test.txt.

Debug command caveats

The RTL debug locale generation (--format mirror) generally inverts input to emulate what an RTL translation will look like. It will also handle HTML by reversing parts of HTML AST during processing in order to keep a sane order of elements but reverse the order of text and HTML.

E.g: foo <a href="#whatevs">bar <span>test</span></a> becomes <a href="#whatevs"><span>ʇsǝʇ</span> ɹɐq</a> ooɟ.

When placeholders are used to substitute HTML, this will cause problems if the placeholders are inverted. To fix this placeholders that are prefixed with start or end and have a matching suffix will remain in their original placement order.

E.g: foo %(startSpan)sbar%(endSpan)s will become %(startSpan)sɹɐq%(endSpan)s ooɟ to preserve order.

Development

Requirements

  • git
  • Node6+
  • yarn (npm can be used in place of this if you prefer).

To get started first fork and clone this repo. Then run yarn install (or npm install) to install the dependencies.

Testing

To run the tests there are various commands:

  • yarn test or npm test: Runs the lint + tests
  • yarn test-coverage or npm run test-coverage: runs the tests with coverage
  • yarn test-watch or npm run test-watch: runs the tests with a watcher.