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-zanata-js

v1.4.3

Published

A Grunt task to perform operations from/to Zanata through zanata-js

Downloads

17

Readme

grunt-zanata-js NPM version

A Grunt task to perform operations from/to Zanata through zanata-js

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide.

From the same directory as your project's Gruntfile and package.json, install this plugin with the following command:

npm install grunt-zanata-js --save-dev

Once that's done, add this line to your project's Gruntfile:

grunt.loadNpmTasks('grunt-zanata-js');

If the plugin has been installed correctly, running grunt --help at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a devDependency, which ensures that it will be installed whenever the npm install command is run.

The "zanata" task

Overview

In your project's Gruntfile, add a section named zanata to the data object passed into grunt.initConfig().

grunt.initConfig({
  zanata: {
    // To push POT/PO files
    push_unique_name: {
      options: {
        // Task-specific options go here.
      },
      files: [
        ...
      ]
    },
    pull_unique_name: {
      ...
    }
  },
})

Options

options.url

Type: String

Zanata server URL to connect. if not specified, a value in zanata.xml at the current directory will be used.

options.project

Type: String

Project name that hosted at Zanata server. if not specified, a value in zanata.xml at the current directory will be used.

options['project-version']

Type: String

Project version in the project at Zanata server. sources/translations will be pushed/pulled against this version. if not specified, a value in zanata.xml at the current directory will be used.

options['project-type']

Type: String

Project type. that should be one of gettext, podir, properties, utf8properties, xliff, xml, or file. if not specified, a value in zanata.xml at the current directory will be used.

options.skeletons

Type: Boolean Default value: false

A boolean value to determine if creating skeleton entries for PO files which have not been translated yet.

options.verbose

Type: Boolean Default value: false

A boolean value to display more detailed messages.

options.version

Type: String or Function

Similar to 'project-version'. but can be determined programmatically. function is supposed to return a string or Promise containing a string.

options.ignore_error_if_exists

Type: Boolean

A boolean valule not to raise an exception on creating a version even if a version already exists in Zanata.

Usage Examples

Push/Pull files under the certain directory

In this example, the targeted files are all of files at the specified directory. what kind of files will be performed is able to manage with type property. 'source' will download/upload POT files only, 'trans' will download/upload PO files only, and 'both' or no type property will do both. and if you want to specify locales rather than what locales are available on Zanata server, you can use locales property instead.

grunt.initConfig({
  zanata: {
    push_dir: {
      options: {
        ...
      },
      files: [
        {src: 'pot', type: 'source'}, // upload POT files only
	{src: 'po', type: 'trans'},   // upload PO files only
      ]
    },
    pull_dir: {
      options: {
        ...
      },
      files: [
        {src: 'pot', type: 'source'}, // download POT files only
	{src: 'po', type: 'trans'},   // download PO files only
      ]
    }
  }
})

Push/Pull certain files

In this example, the targeted source file are only one file in files property. this format doesn't support PO files' operations. please make sure if the document is available at the Zanata server first.

grunt.initConfig({
  zanata: {
    push_file: {
      options: {
        ...
      },
      files: [
        {src: 'pot/test.pot'},
      ]
    },
    pull_file: {
      options: {
        ...
      },
      files: [
        {src: 'pot/test.pot'},
      ]
    }
  }
})

Create a version

See also Gruntfile.js in this project.

grunt.initConfig({
  zanata: {
    createVersion: {
      options: {
        version: 'master'
      }
    }
  }
})

License

Copyright (c) 2016 Akira TAGOH Licensed under the MIT license.


Project created by Akira TAGOH.

This file was generated on Wed May 11 2016 12:23:07.