0.1.1 • Published 9 days ago

grunt-i18next-json2js v0.1.1

Weekly downloads
-
License
-
Repository
github
Last release
9 days ago

grunt-i18next-json2js

This plug-in is used to generate i18next.js for use according to the local internationalization language resource json file, and configure stubModules with requirejs config.

Getting Started

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-i18next_json2js --save-dev

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

grunt.loadNpmTasks("grunt-i18next_json2js");

The "i18next_json2js" task

Overview

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

grunt.initConfig({
  i18next_json2js: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

Options

options.cwd

See grunt documentation. For more general information on specifying targets, files and options see the grunt Configuring Tasks guide.

options.include

This optional custom property specifies which files to include. If it is omitted, all json files will be included in the specified src folders. Any grunt globbing pattern can be used (array or string).

options.src

This required property specifies the folders (not files!) the plugin should look for translation json files.

options.outputFile

The generated i18next.js path

Usage Examples

grunt.initConfig({
  i18next_json2js: {
    test_options: {
      cwd: "test/locales",
      include: ["**/*.json", "!**/ignore-this.json"],
      expand: true,
      src: ["*/"],
      outputFile: "test/sample/locales/i18next.js",
    },
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

0.1.1

9 days ago

0.1.0

23 days ago