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

grunt-tx

v1.1.7

Published

Grunt tasks to download translations & upload resources from/to Transifex

Downloads

10

Readme

Build Status

Grunt-Tx

Grunt tasks to download translations and upload resources to Transifex

Requirements

  • node.js >= 0.10.x or io.js >=1.8.1 (You might need node-gyp-install for io.js)
  • grunt ~0.4.5

On Linux

Since we depend on node-keytar, you might need to install a package there to make the installation work. Please refer to their README for instructions.

Getting started

In your project run: npm install --save grunt-tx.

Then go to your Gruntfile.js, include this plugin and add the configuration. Example:

// load the plugin
grunt.loadNpmTasks('grunt-tx');

grunt.initConfig({
  /*
    Transifex configuration
   */
  tx: {
    // note: this takes an array, so you can have multiple
    // resources per project
    //
    // if you need more than one project, just add another
    // key with the other project slug
    'YOUR_PROJECT_SLUG': [
      {
        // path to the source resource
        sourceFile: './po/template.pot',
        // target directory & path where we put the downloaded translations to
        // _lang_ will be replaced with the language code (`en` for example)
        // _type_ will be replaced with the lowercased type of the resource (`po` for example)
        targetFilePath: './po/_lang_._type_',
        // the i18n_type of your resource at Transifex
        // See http://docs.transifex.com/formats
        type: 'PO',
        // this is completely optional. If not set, we default to download
        // every available language for the resource
        languages: ['en', 'fr']
      }
    ]
  },
});

The plugin exposes two tasks:

  • grunt tx:download – downloads all translations for every configured project and their resources
  • grunt tx:upload – uploads all configured projects' resources

The plugin accepts TRANSIFEX_USER & TRANSIFEX_PASSWORD as environment variables. If they're not present, it'll prompt the user for their credentials and stores them in their keychain.

Note: if you need to support multiple projects with different credentials, this is totally supported by this plugin. However if you pass in the credentials via ENV, they'll take precedence over everything. This means, if you want to include this plugin into your CI workflow, you'll have to grant access to all projects configured to the user identified by the credentials provided in ENV.

Development

You're interested in helping out this project? You rock! Hope this little guide helps you to get started. If not, just ping us, we're very happy to help!

The module is written in ES2015 with the help of the fantastic babel. The source code can be found in the src directory. It's the only code that you should touch.

Setup

If you follow these three steps, you should be ready to go:

  1. git clone http://github.com/eHealthAfrica/grunt-tx
  2. cd grunt-tx
  3. npm install

Building

Run npm run build. Build output will be in lib and tasks directories. During development you can also use npm run watch, which watches for file changes in src and automatically builds everything.

npm run lint lints the code in src with the help of standard and babel-eslint

Test

npm test lints the code and runs the test.

Conventions

grunt-tx is using the wonderful semantic-release to automate its releases. To make that work, please stick to the Angular commit guidelines

Alternatives / Shoutouts

Thank you to:

which are great projects that you should definitely look at if you're looking to integrate Transifex within your workflow. We had different needs and this is how this project came to be.

Also big thanks to Inquirer.js and node-keytar, which enabled this project to prompt the user for their credentials and to save them into the keychain.

License

Apache 2.0, see LICENSE

Author

© 2015 Robin Mehner for eHealth Systems Africa