Gulp plugin to convert CSV translation files to JSON using the csv package.
Install with npm:
npm install --save-dev gulp-translation2json
var gulp = require('gulp');
var translation2json = require('gulp-translation2json');
gulp.task('translate', function () {
gulp.src('translations/**/*.csv')
.pipe(translation2json())
.pipe(gulp.dest('dist'));
});
The plugin passes all options on to the csv parser. For a full list of options see the csv docs.
Extra options for the translation2json plugin:
-
keysColumn
Set the column index for the translation keys. Default value:
0
. -
valuesColumn
Set the column index for the translation values. Default value:
1
. -
indent
Set the indentation used for pretty printing. Set to
null
for no pretty printing. Default: (2 spaces).
MIT @smuldr