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

google-translate-xlf

v0.2.3

Published

A command-line utility to automatically translate .xlf translation files using Google Translate

Downloads

6

Readme

google-translate-xlf

A command-line utility to automatically translate .xlf translation files using Google Translate

Installation

This is a command-line utility. To install this utility, run:

npm install -g google-translate-xlf

This will install the utility globally so that it can be run from any location. The executable installed by this module is translate-xlf.

Usage

Before you begin, you will need an .xlf file to translate! If you are using Angular 2+ and the Angular CLI, you will probably extract an .xlf file from your app by running ng xi18n inside your Angular project. This produces a file named messages.xlf inside your project folder.

Say we have an .xlf file named messages.xlf. Let's translate this file from English ("en") to Hindi ("hi") and save the translated file as messages.hi.xlf:

translate-xlf --in messages.xlf --out messages.hi.xlf --from en --to hi

Or, if you don't like typing, you can use the abbreviated versions of the arguments:

translate-xlf -i messages.xlf -o messages.hi.xlf -f en -t hi

For more usage help, run:

translate-xlf help

By default, a comment is prepended to the output file that looks like this:

<!-- Translated on May 15th 2018, 5:01:18 pm by google-translate-xlf: https://github.com/nfriend/google-translate-xlf -->

This behavior can be turned off by passing --comment false.

Caveats

This utility will not attempt to translate complex <source> values, like this:

<source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>

In this case, the utility will simply copy this element and rename it to <target>.

If this utility encounters something like this:

<source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>

only "The author is" will be translated.

It hopefully goes without saying that the translations produced by this utility will be far from perfect. The intention of this utility is to provide a very rough translation for development purposes.

Developing

The easiest way to develop on this module is to use test-driven development. Unit tests can be run with npm test. To automatically re-run the tests when you make changes to the files, run npm run test:watch.

Translation

This utility uses Google Translate's online API for its translations using this NPM package: https://www.npmjs.com/package/google-translate-api.