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

@gelbehexe/langdef

v1.0.5

Published

Converts *.langdef files to *.xlf files

Readme

langdef

Converts *.langdef files to *.xlf language files

Install

$ npm install @gelbehexe/langdef

Usage

Function

const Langdef = require('../');
Langdef({
	"source": __dirname+'/sample.langdef',
	"dest": __dirname+'/out',
	"hideDefault": false
})
	.then(function (res) {
		console.log(`Processed file "${res}"`);
	},function(err) {
		console.error(err);
	});

Terminal

langdef -t t3 -s /path/to/langdef/messages.langdef -d /tmp

Options

|name|description|default| |---|---|---| |source|source file '*.langdef' (required)|empty| |dest|dest path or file without extension (relative to source path or absolute)|empty| |type|Type of environment|empty| |hideDefault|Hide key for default language in filename|true| |defaultLocale|Set the default locale key|'en'| |pos|Position of the locale key in file name <append|prepend>|'append'| |namespace|Namespace attribute for xliff tag|empty| |copyFileAttributes|Whether to copy the original attributes from file tag or not |true| |extraFileAttrs|File attributes to add to file tag (e.g. "attr1=value1;attr2=value2" for console, otherwise use js object|empty| |xliffVersion|xliff version to use|1.0| |header|Whether to insert an empty header or not|true| |extension|Extension for target files|'xlf'| |useIdForSource|Whether to use id for source or not|false| |noDate|No date in filetag|true| |addSourceLang|Whether to add a 'source-language' attribute or not|false| |addTargetLang|Whether to add a 'target-language' attribute or not|false| |forceTarget|Whether to always add 'target' entry or not|false|

Options for cli-only

Show all options by using the help argument:

langdef --help

'langdef' format

Once upon the day, while I was working silently in my chamber as a TYPO3 Developer, the xlf language file format was introduced. I fount it quite complex to manage different files for each language.

So I created the 'langdef' format for my work and a parser to convert it to xlf format.

Here is a small example:

<?xml version="1.0" encoding="UTF8" standalone="yes"?>
<langDef>
	<file datatype="plaintext" original="messages" product-name="demo">
		<entry id="sampleLLKey">
			<source>english</source>
			<translations>
				<de>deutsch</de>
				<fr>allemand</fr>
			</translations>
		</entry>
		<entry id="folder">
			<source>folder</source>
			<translations>
				<de>Verzeichnis</de>
				<fr>annuaire</fr>
			</translations>
		</entry>
		<entry id="hello_goodbye">
			<source><![CDATA[Hello & Good Bye]]></source>
			<translations>
				<de><![CDATA[Hallo & Auf Wiedersehen]]></de>
				<fr><![CDATA[Bonjour & au revoir]]></fr>
			</translations>
		</entry>
		<entry id="html_greeting">
			<source><![CDATA[Hello <strong>World</strong>]]></source>
			<translations>
				<de><![CDATA[Hallo <strong>Welt</strong>]]></de>
				<fr><![CDATA[Bonjour <strong>Monde</strong>]]></fr>
			</translations>
		</entry>
		<entry id="only_english">
			<source>Only English</source>
		</entry>
		<entry id="only_german">
			<source>Only German</source>
			<translations>
				<de>Nur deutsch</de>
			</translations>
		</entry>
	</file>
</langDef>

Description

Root tag must be langdef. The <file> tag is the first child and is also present in target xlf file. You can use the option copyFileAttributes to adjust whether to copy its attributes to target file or not. There can be multiple entry tags. Each entry represents an entry in the target language file.

entry

Each Entry must have a per file unique id tag. Duplicate entries are triggering warnings and only the last one is used. The first subtag must be a source tag, optionally followed by a translation tag. Each translation tag may or may not contain a per entry unique language shortcut like de, fr, pl, which are represantating the target languages. For each target language a target file is created.

You may not enumerate all target languages in all entries.