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.
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");
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.
},
},
});
See grunt documentation. For more general information on specifying targets, files and options see the grunt Configuring Tasks guide.
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).
This required property specifies the folders (not files!) the plugin should look for translation json files.
The generated i18next.js path
grunt.initConfig({
i18next_json2js: {
test_options: {
cwd: "test/locales",
include: ["**/*.json", "!**/ignore-this.json"],
expand: true,
src: ["*/"],
outputFile: "test/sample/locales/i18next.js",
},
},
});
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.
(Nothing yet)