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

xlf-analyze

v0.3.5

Published

Get statistics from XLF translation files

Readme

xlf-analyze

Script for analyzing .xlf files (XLIFF version 1.2).

Rationale and example run: https://leibrug.pl/xlf-analyze

Features

  • Count <target>s per state (number and % of all, new, translated, etc.)
  • Compare content in new and translated <target>s with corresponding <source>s
  • Count words in <source>s (for amount/price estimation of translations)
  • Point out ids of problematic translations

Usage

As a command

npx xlf-analyze <file> <options>

where <file> is a path to one of the language files (that is, not the "base" messages.xlf).

Run the script against all the language files to get the full insight - there may be differences between them.

As a module

const analyze = require('xlf-analyze');

analyze(file, options).then(result => console.log(result));

With this method, you need to interpret result yourself, for example there are no percentage stats. Interface XlfAnalyzeResult describes shape of the result object.

Options

Options can be passed as flags (for the npx use-case) or as a plain object. They are all: boolean, optional, and false by default. Examples:

# Both have equal effect (word counter disabled by default or by explicit option)
npx xlf-analyze messages.pl.xlf
npx xlf-analyze messages.pl.xlf --words=false

# Both have equal effect (word counter enabled)
npx xlf-analyze messages.pl.xlf --words
npx xlf-analyze messages.pl.xlf --words=true

// Word count enabled in-code
analyze('messages.pl.xlf', { words: true });

You can also save values to environment variables - that way you don't need to write flags every run, however - if passed - the command-line arguments take precedence. This works only for the npx use-case.

| Description | CLI flag | Property of options | Environment variable | | ----------------------------------------- | --------- | --------------------- | -------------------- | | Add word count to the output. | --words | words | XLF_ANALYZE_WORDS | | Return ids of problematic <trans-unit>s | --ids | ids | XLF_ANALYZE_IDS |

Problematic translations

newButChanged

Has state="new", but different than source

Probably didn't set state after translation:

<source>Hello!</source>
<target state="new">Cześć!</target>

translatedButUnchanged

Has state="translated", but same as source

Can be incorrectly marked:

<source>Hello!</source>
<target state="translated">Hello!</target><!-- still needs translation -->

Another example is some proper name...

<source>KFC</source>
<target state="translated">KFC</target><!-- may be worth undoing i18n on such text -->

...or something trivial, that shouldn't be marked for translation, like interpuntion or interpolation:

<source>.</source>
<target state="translated">.</target>

empty

Empty or missing state value

<trans-unit id="...">
  <source>Hello!</source>
  <target>Cześć!</target>
</trans-unit>
<trans-unit id="...">
  <source>Hello!</source>
  <target state="">Cześć!</target>
</trans-unit>

none

No translation at all

<trans-unit id="...">
  <source>Hello!</source>
  <!-- missing target element -->
</trans-unit>

nonStandard

Non-standard state value

There are 10 standard state values defined in schema and the translation has none of them:

<source>Hello!</source>
<target state="x-halfway">Cze</target>