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

xlf-extract

v0.2.2

Published

Extract source messages from XLIFF (.XLF) files and stores them in YAML files for translation

Downloads

11

Readme

Build Status npm version

xlf-extract

Extracts source messages from XLIFF (.xlf) files into a translation bundle. This is a simple YAML file that can be copied and translated for different locales.

The translated messages can be populated back into the XLIFF files using xlf-translate.

These tools are intended to simplify the localization of Angular 2 i18n - enabled apps.

In Angular 2 each change in the application may alter the unit IDs in the message file. Normally, you'd have to track each unit and update its translation.

With this set of tools the correct translations can be filled-in automatically from the YAML message bundles based on your unique keys.

See the sample i18n Angular app for more details.

Installation

npm install -g xlf-extract

Usage

xlf-extract messages.xlf --lang-file=lang/en.yml

This will extract all source elements from the messages.xlf file into the language file.

Optionally, specify --use-target to extract the target (translated) messages:

xlf-extract --use-target messages.xlf --lang-file=lang/en.yml

Description

Normally, you'd localize an attribute using the following syntax:

<span i18n="A hello world message for the localized component">Hello!</span>

This utility makes use of the optional meaning tag to associate the message with an unique key.

<span i18n="localized.component.hello|A hello world message for the localized component">Hello!</span>

The key will be persisted in the messages file as a "meaning":

<trans-unit id="cb5fabf68b14f52c0d7cbc2b90393f8897310ba7" datatype="html">
  <source>Hello!</source>
  <target/>
  <note priority="1" from="description">A hello world message for the localized component</note>
  <note priority="1" from="meaning">localized.component.hello</note>
</trans-unit>

This utility will extract the source messages along with descriptions into a message bundle. This file is then copied and translated for different locales.

The message bundle is an YAML file that lists all messages as a tree. For example, the localized.component.hello key and its translation are represented as:

localized:
    component:
        # A hello world message for the localized component
        hello: Bonjour!

To populate the message file with the translations from the message bundle, use the xlf-translate companion tool.

See Also