GithubHelp home page GithubHelp logo

gulp-xgettext's Introduction

gulp-xgettext NPM version

Gulp plugin for running GNU xgettext.

Install

  1. Install the plugin with the following command:

    npm install gulp-xgettext --save-dev
  2. Install GNU xgettext

Usage

var gulp = require('gulp');
var xgettext = require('gulp-xgettext');

gulp.task('default', function () {
    return gulp.src(['src/**/*.cpp'])
        .pipe(xgettext({
            language: 'C++',
            keywords: [
                {name: 'get_local'}
            ]
        }))
        .pipe(gulp.dest('release'));
});

API

xgettext(options)

options.bin

Type: String

Default: 'xgettext'

GNU xgettext executable.

options.language

Type: String

A language that should be used to parse the files. By default xgettext will try to determine a language by file extension.

options.keywords

Type: Array

List of keywords that should be checked. Each keyword is an object with the following properties:

  • name: string, name of a localization function to search.
  • singular: integer, number of argument that represents singular form of a string.
  • plural: integer, number of argument that represents plural form of a string.
  • context: integer, number of argument that represents context of a string.

All properties, except name are optional. Arguments counting starts from one.

options.headers

Type: Object

A list of headers that will be used in the resulting .po file. The list of available headers with their descriptions can be found here. If a header is not specified an appropriate xgettext value will be used.

options.encoding

Type: String

Specifies the encoding of the input files. This option is needed only if some untranslated message strings or their corresponding comments contain non-ASCII characters By default the input files are assumed to be in ASCII.

options.comments

Type: String|Boolean

Reads the comments for translators from the input files and inserts them in the resulting .po file. Using a string as value specifies the tag of the parameter --add-comments[=tag], described in section 5.1.5 of xgettext documentation. An empty string or the boolean value true will set the parameter add-comments without a specific tag.

License

MIT © Dmitriy Simushev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.