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-angular-gettext-transifex

v1.1.1

Published

Grunt tasks to extract translatable strings from Angular apps and upload them to Transifex and download translations and compile them

Downloads

4

Readme

grunt-angular-gettext-transifex

Grunt tasks that:

  • extract translatable strings from Angular apps and uploads them to Transifex
  • downloads translations and compile them

It makes use of grunt-angular-gettext & grunt-tx and assumes that those are configured properly in your project. Please refer to their respective documentation to find out how.

Workflow

  • template.pot is ignored in git.
  • On every successful build on our main branch we run grunt ng-gettext-transifex-upload
  • grunt ng-gettext-transifex-download is run on local machines whenever our translators tell us that the translation are ready and the resulting files are committed to the repo.

This way we prevent that template.pot is overwritten with local uploads or work in branches, which can lead to data loss. This is also the reason why the upload task defaults to exit when not run in a CI environment. You can overcome this by providing a environment variable, like this: CI=true grunt grunt ng-gettext-transifex-upload

Honestly I'm not really sure if this is useful for any project outside of our setup, but here it is :)

Getting started

In your project run: npm install --save-dev grunt-angular-gettext-transifex.

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

// load the plugin
grunt.loadNpmTasks('grunt-angular-gettext-transifex');

The plugin exposes two tasks:

  • grunt ng-gettext-transifex-upload – extracts the translatable strings and uploads them
  • grunt ng-gettext-transifex-download – downloads the translations and compiles them

Setup for TravisCI

As described our upload workflow is fully automated on TravisCI. You need to have the travis CLI tool installed and we assume that you have grunt-angular-gettext & grunt-tx properly configured in your project, follow these steps to get the same results as we do:

  1. travis encrypt TRANSIFEX_USER=YOUR_TRANSIFEX_USERNAME --add

  2. travis encrypt TRANSIFEX_PASSWORD=YOUR_TRANSIFEX_PASSWORD --add

  3. Add a script to your repository which goes along the lines of this:

    #!/usr/bin/env bash
    set -e
    
    # Don't upload if we're in a pull request
    [[ "$TRAVIS_PULL_REQUEST" == "false" ]] || {
      exit 0;
    }
    
    # Don't upload if we're in a branch
    [[ "$TRAVIS_BRANCH" == "Your branch, which is probably master" ]] || {
      exit 0;
    }
    
    # Don't upload if we're in a fork
    [[ "$TRAVIS_REPO_SLUG" == "githubusername/reponame" ]] || {
      exit 0;
    }
    
    grunt ng-gettext-transifex-upload
  4. Make that script executable chmod +x ./path/to_script_above.sh

  5. Add this to your .travis.yml

    after_success:
      - /path/to_script_above.sh
  6. Commit everything, push and be happy :)

Example project

Have a look at eHealthAfrica/move to see an example of our projects using it.

License

Apache 2.0, see LICENSE

Author

© 2015 Robin Mehner for eHealth Systems Africa