0.0.5 • Published 9 years ago

grunt-msg-init-merge v0.0.5

Weekly downloads
47
License
-
Repository
github
Last release
9 years ago

grunt-msg-init-merge

Grunt task for msginit and msgmerge

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-msg-init-merge --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-msg-init-merge');

The "msgInitMerge" task

Overview

This task runs for each locale:

  • msginit if .po file does not exist to create it.
  • msgmerge if .po file exists to update it with new keywords.

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

grunt.initConfig({
  msgInitMerge: {
    your_target: {
      src: ['test/fixtures/myDomain.pot'],
      options: {
          locales: [{name: 'ru_RU', folder: 'ru'}, 'en'],
          poFilesPath: 'tmp/i18n/<%= locale%>/<%= potFileName%>.po',
      }
    }
  },
});

You should specify:

  • locales - list of locales
  • poFilesPath - template for *.po files location.
  • src - location of *.pot files.

Task in example above will create/update *.po files:

  • tmp/i18n/ru/myDomain.po
  • tmp/i18n/en/myDomain.po

Specifying target (e.g. "your target") is necessary!

Options

options.locales

Type: Array

Default value: []

List of locales, e.g.:

[{name: 'ru_RU', folder: 'ru'}, 'en']

If locale is an Object:

  • name - will be passed to msginit --locale=name
  • folder - will be used as locale variable in poFilesPath template (folder name).

options.poFilesPath

Type: String

Default value: ''

Template for *.po files location, e.g.:

tmp/i18n/<%= locale%>/<%= potFileName%>.po

Available variables:

  • locale - locale folder
  • potFileName - name of a *.pot file
  • potDirName - dir path of a *.pot file

options.msgInit

Type: Object

Default value:

msgInit : {
    cmd : 'msginit',
    opts : {}
}

You can specify path to msginit or additional options:

msgInit : {
    cmd : '/opt/local/bin/msginit',
    opts : {
        width : 50
    }
}

The 'cmd' property must be present if you decide to specify additional options

options.msgMerge

Type: Object

Default value:

msgMerge : {
    cmd : 'msgmerge',
    opts : {}
}

You can specify path to msgmerge or additional options:

msgMerge : {
    cmd : '/opt/local/bin/msgmerge',
    opts : {
        width : 50
    }
}

The 'cmd' property must be present if you decide to specify additional options

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago